【问题标题】:android pay update cart with shipping address amount after the MaskedWallet creation创建 MaskedWallet 后,带有送货地址金额的 android pay 更新购物车
【发布时间】:2016-02-22 15:18:50
【问题描述】:

根据链接中的 Android Pay 文档:https://developers.google.com/android-pay/android/tutorial#create_a_masked_wallet_request。我必须创建一个包含估计运费和税费的购物车来创建 MaskedWallet。但我有一种情况,运费和税金因送货地址而异。那么,有没有什么方法可以在没有运费和税费的情况下创建购物车,并且在创建 MaskedWallet 之后,根据在 MaskedWallet 中找到的送货地址添加运费和税费。如果是,那么如何使用此值更新 MaskedWallet 中的购物车。

【问题讨论】:

    标签: android android-pay google-client


    【解决方案1】:

    MaskedWallet 的运费和税金不是最终收取的价格(仅用于估算目的)。最终的运费和税费实际上是在您提出 FullWallet 请求时确定的。例如:

    LineItem shippingItem = LineItem.newBuilder()
                                    .setCurrencyCode("USD")
                                    .setDescription("Shipping")
                                    .setRole(LineItem.Role.SHIPPING)
                                    .setTotalPrice("You final shipping")
                                    .build();
    LineItem taxItem = LineItem.newBuilder()
                               .setCurrencyCode("USD")
                               .setDescription("Tax")
                               .setRole(LineItem.Role.TAX)
                               .setTotalPrice("You final tax")
                               .build();
    
    Cart.Builder cartBuilder = Cart.newBuilder().setCurrencyCode("USD");
    cartBuilder.addLineItem(shippingItem);
    cartBuilder.addLineItem(taxItem);
    cartBuilder.setTotalPrice("Your total price including shipping and tax");
    
    FullWalletRequest request = FullWalletRequest.newBuilder()
                                                 .setGoogleTransactionId(googleTransactionId)
                                                 .setCart(cartBuilder.build())
                                                 .build();
    

    【讨论】:

      猜你喜欢
      • 2020-05-02
      • 2013-06-29
      • 1970-01-01
      • 2015-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多