Closed dan-precup closed 3 years ago
Hi @dan-precup,
What simulator are you using? I haven't been able to reproduce this with the code provided with an iPhone 11 - 14.4 simulator and v21.4 of the SDK, I see:
Hi Yuki,
Thanks for the quick reply.
That is a great point you brought up. I was using an iPhone 12 simulator. I've tried on the iPhone 11 simulator and it looks exactly like the screenshot above. I then switched on 12 pro max actual device, same bug.
I then realised that it was the presence of required data that is doing the offending so I proceeded to erase the iPhone 12 simulator and surely enough I got the same screenshot as you did on this one as well.
If I added the required details back it reverted to the 0 amount.
I found the issue, it was completely on my end. I've foolishly tried to updated the paymentSummaryItems
from an STPPaymentContext
inside the applePayContext(_ context:, didSelectShippingContact)
delegate method and that was always 0.
Sorry for the confusion and thank you for the support!
Summary
If the payment method hasn't been created and the
paymentRequest.requiredShippingContactFields
in not an empty array the ApplePay sheet show a grand total of 0. If I change this:to
The correct amount is shown.
Also replacing:
with:
Fixes the issue as well
Code to reproduce
Both these methods present the ApplePay sheet:
iOS version
14.4
Installation method
Cocoapods
SDK version
21.4
Other information