Skip to content
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.

Stripe Crash after select apply pay (Payment request is invalid: Error Domain=PKPassKitErrorDomain Code=1 "(null)") #31

Open
AshishPatel48 opened this issue Aug 24, 2017 · 7 comments

Comments

@AshishPatel48
Copy link

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)"

@jlubeck
Copy link

jlubeck commented Mar 26, 2018

I'm running into this as well.. seems like a pretty old issue. Did you solve this @AshishPatel48 ?

@jlubeck
Copy link

jlubeck commented Mar 26, 2018

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

@seancrowe5
Copy link

@jlubeck did you ever find a solution? I'm hitting this too

@schahxeb
Copy link

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.

@mitchtreece
Copy link

What if the amount ends up being $0 (free), because of a promotion etc. This results in the same invalid request error. 😢

@danipralea
Copy link

I have the same crash
image

@MattTrigg
Copy link

MattTrigg commented Jul 1, 2020

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.

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants