0

我正在使用 Apple Pay 与 Stripe 的集成,我需要shippingAddress在显示订单信息之前从 Apple Pay 获取,因为我需要根据地址计算税费和运费。

目前,我可以获取 shippingAddress 但在显示信息窗口后。

我正在发送这个有效载荷:

    var paymentRequest = {
      requiredShippingContactFields: ['postalAddress','email', 'phone'],
      countryCode: 'US',
      currencyCode: 'USD',
      lineItems: this.buildLineItems(lineItems),
      total: this.buildTotal(lineItems)
    };

有没有办法在显示窗口之前获取货件信息或根据我获得的信息更新窗口?

来源:

谢谢

4

1 回答 1

0

为了获得您需要收听的货件信息onshippingcontactselected

session.onshippingcontactselected = (event) => {
  // You can do work asynchronously here; just call
  // session.completeShippingMethodSelection when you're done.
}

文档

https://stripe.com/docs/stripe-js/reference#payment-request-on

https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778009-onshippingcontactselected?language=javascript

于 2019-09-16T22:00:09.987 回答