#Som-payment-failed
1 messages · Page 1 of 1 (latest)
Hi there!
Let's use this thread to chat
You said: ```Getting this error after this
applePayContext.presentApplePay()```
So it looks like you aren't setting your publishable key client-side correctly. Are you following https://stripe.com/docs/apple-pay? Did you set your publishable key like it shows here: https://stripe.com/docs/apple-pay?platform=ios#setup-client-side
Yes I did set my publish key as mentioned in the article.
StripeAPI.defaultPublishableKey = "pk_test_GUbs5JkiUf0VPJa6fCUwt2vI"
Hmm okay, and what about server-side?
Is your Secret key set up correctly to initialize Stripe in order to create the PaymentIntent on your account?
No, I didn't use anything on sever side related to apple pay.
isn't directly communication with Stripe?
Cannot initialize FundingType from invalid String value unknown
now getting this error
Payment Failed: Optional(Swift.DecodingError.dataCorrupted(Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "card", intValue: nil), CodingKeys(stringValue: "funding", intValue: nil)], debugDescription: "Cannot initialize FundingType from invalid String value unknown", underlyingError: nil)))
So yeah you have to create a PaymentIntent on your server and pass the clientsecret to the client in order to actually process the payment with Stripe. See: https://stripe.com/docs/apple-pay?platform=ios#handle-payment
Hmm I'm not familiar with that error. What line is throwing that?
My this delegate not getting called
func applePayContext(_ context: STPApplePayContext, didCreatePaymentMethod paymentMethod: StripeAPI.PaymentMethod, paymentInformation: PKPayment, completion: @escaping STPIntentClientSecretCompletionBlock) {
so how I can pass the clientsecret key
You would need to fetch the client secret from your server within that applePayContext function.
But that function is not getting called
I mean, I'm not receiving callback in that function.
Hi 👋
Oh really? What changed?
- Add publish key again before payment request.
- Change the Test card from master card to discover card.
- Hit v1/payment_intents Api at client side for now.