【问题标题】:android pay update cart with shipping address amount after the MaskedWallet creation创建 MaskedWallet 后,带有送货地址金额的 android pay 更新购物车
【发布时间】:2016-02-22 15:18:50
【问题描述】:
【问题讨论】:
标签:
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();