Stripe Crash after select apply pay (Payment request is invalid: Error Domain=PKPassKitErrorDomain Code=1 "(null)")
Opened this issue · 7 comments
Crash app at this line :
objc_setAssociatedObject(viewController, &kSTPBlockBasedApplePayDelegateAssociatedObjectKey, delegate, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
Error : Payment request is invalid: Error Domain=PKPassKitErrorDomain Code=1 "(null)"
I'm running into this as well.. seems like a pretty old issue. Did you solve this @AshishPatel48 ?
By the way, this happens on the file PKPaymentAuthorizationViewController+Stripe_Blocks.m
Line 126 inside the method
+ (instancetype)stp_controllerWithPaymentRequest:(PKPaymentRequest *)paymentRequest
apiClient:(STPAPIClient *)apiClient
createSource:(BOOL)createSource
onShippingAddressSelection:(STPShippingAddressSelectionBlock)onShippingAddressSelection
onShippingMethodSelection:(STPShippingMethodSelectionBlock)onShippingMethodSelection
onPaymentAuthorization:(STPPaymentAuthorizationBlock)onPaymentAuthorization
onTokenCreation:(STPApplePaySourceHandlerBlock)onTokenCreation
onFinish:(STPPaymentCompletionBlock)onFinish
@jlubeck did you ever find a solution? I'm hitting this too
I ran into the same issue today.
I was able to resolve it by making sure I was setting the amount
property on my STPPaymentContext
instance, before requesting payment.
self.paymentContext?.paymentAmount = amount
self.paymentContext?.requestPayment()
It's unfortunate that the error message was so generic. I hope this helps someone.
What if the amount ends up being $0 (free), because of a promotion etc. This results in the same invalid request error. 😢
I ran into the same issue today.
I was able to resolve it by making sure I was setting the
amount
property on mySTPPaymentContext
instance, before requesting payment.self.paymentContext?.paymentAmount = amount self.paymentContext?.requestPayment()
It's unfortunate that the error message was so generic. I hope this helps someone.
This worked for me too:)
(It does say you should set it in the Stripe documentation specifically for Apple Pay BUT doesn't say it can't be 0!)
However, I set the actual amount on the Server (as recommended best practice).
I guess this can only cause a problem for dishonest people trying to change the price on the client but it's a bit messy.