#vm1172
1 messages · Page 1 of 1 (latest)
Hey toby, nothing shows up in the logs [1]
[1] https://dashboard.stripe.com/logs
previously I had certificate issues which required me to create a new Apple Pay Processing Certificate [attached screenshot] and requestID req_CDKWVtZbfr5WFf:
invalid_request_error
We were unable to decrypt your request. Please make sure you've generated and uploaded your Apple Pay certificate at https://dashboard.stripe.com/settings/payments/apple_pay.
now, I can't even get to the stage of the apple pay lifecycle which triggers the POST /v1/tokens
@sullen star suggested I build for the App Store since Apple Pay is not supported in Expo Go [1]
[1] https://docs.expo.dev/versions/latest/sdk/stripe/#apple-pay
but im still facing issues here even after pushing to TestFlight and testing on device
Thread for reference: https://discord.com/channels/841573134531821608/1159474302631034970
I also couldn't find the error The data couldn't be read because it isn't in the correct format
defined anywhere in the Stripe Node library and its pretty vague so I don't know where to start. I can share the code if needed
@cloud saffron let me know if you need anything else, thanks for the help
Hey đź‘‹ sorry for the delay, the server is a bit busy at the moment. Thank you for the additional details, taking a look.
Hm, sorry, I'm a bit lost, I'm not the best at iOS dev work and may need to pull in a teammate, but let me start with trying to get some clarity.
The data couldn't be read because it isn't in the correct format
I don't see this error in the request that you referenced. Can you help me understand where you're seeing it surfaced? If that's coming directly from our API, that may be why you didn't find it in a library, I'm pretty sure those messages come right from the API rather than being in our SDKs.
I'm seeing it surfaced when calling const { paymentIntent, error } = await confirmPlatformPayPayment(clientSecret, params)
and then the error returned is the one listed above
I call confirmPlatformPayPayment while triggering onPress on the PlatformPayButton
- Using this library: https://github.com/stripe/stripe-react-native
confirmPlatformPayPaymentdocumentation: https://stripe.dev/stripe-react-native/api-reference/index.html#confirmPlatformPayPayment- version
0.28.0 - using Expo
I provided the requestID just to provide some more context on what error I received prior, you can safely ignore it for now
ahh gotcha
Hm, version 0.28.0 of our React Native SDK doesn't appear to be pinned as the expected version for a given Expo SDK version. What is Expo SDK version are you on?
"expo": "~49.0.10",
I installed @stripe/stripe-react-native via this command, so it should be the most recent package which Expo supports
ran this command
npx expo install @stripe/stripe-react-native
Hm, none of our version are listed as being pinned to Expo 49. The closest thing I'm seeing is version 0.23.3 being the right version when working with Expo 48.
https://github.com/stripe/stripe-react-native/blob/master/CHANGELOG.md
I'm on Expo 49, and when running expo doctor or the npx expo install command, it suggests to use v0.28.0
Hm, alright, just wanted to check that as I know Expo can be finicky if it doesn't have the right versions.
Sorry, no, I don't know what's going on here and am looping in a teammate to look.
okay no worries, appreciate it
Hey, still looking in to this. It looks like this can happen around XCode upgrades if the plist format changes. So it may be worth checking that your file matches the one expected by your current version of XCode https://stackoverflow.com/questions/45748140/xcode-9-distribution-build-fails-because-format-of-exportoptions-plist-has-chang
I see that a colleague asked to write in to our support so that we could take a deeper look, were you able to do that? Want to check on anything that may have happened in that conversation
Also, just to double check, have you printed out your client secret and the params that you are passing in to see that they are set to what you expect them to be?
hey Pompey, thanks for the response, give me a second
seems like this was asked 6 years ago, and I have a Managed Expo workflow, so I don't think this is relevant to us rn, but can double click on this
if i remember correctly, one of your colleagues asked to write into support for a different issue I was facing (not the one I'm facing above)
to answer your q: no i haven't reached out to support yet
printing out everything right now below -
{"clientSecret": "pi_3NyFpvCa1hzW9vNX0St9L4M1_secret_B8fLglMDkIlrJd8wIOHYF3kMh", "error": {"code": "Failed", "declineCode": null, "localizedMessage": "The data couldn’t be read because it isn’t in the correct format.", "message": "The data couldn’t be read because it isn’t in the correct format.", "stripeErrorCode": null, "type": null}, "params": {"applePay": {"cartItems": [Array], "currencyCode": "USD", "merchantCapabilities": [Array], "merchantCountryCode": "US", "requiredBillingContactFields": [Array], "requiredShippingAddressFields": [Array], "shippingMethods": [Array]}}, "paymentIntent": undefined}
params
const params = {
applePay: {
cartItems: cart,
merchantCountryCode: ALLOWED_COUNTRY,
currencyCode: CURRENCY.toUpperCase(),
shippingMethods,
requiredShippingAddressFields: [
PlatformPay.ContactField.Name,
PlatformPay.ContactField.PhoneNumber,
PlatformPay.ContactField.PostalAddress
],
requiredBillingContactFields: [PlatformPay.ContactField.PostalAddress],
merchantCapabilities: [
ApplePayMerchantCapability.Supports3DS,
ApplePayMerchantCapability.SupportsCredit,
ApplePayMerchantCapability.SupportsDebit
]
}
}
Interesting, "The data couldn’t be read because it isn’t in the correct format." is in your params before you even call confirmPlatformPayPayment?
I'm not entirely sure, but yes I think so. since once I call confirmPlatformPayPayment, that is where I receive the error from
đź‘‹ wasn't the issue with passing shippingMethods when calling confirm? We narrowed down on it a few days ago right?
hey hanzo
yes we did narrow it down to shippingMethods, but the same issue cropped up again
Looking at the code you shared above, you're still passing that parameter in your confirm params
i,e., removing shippingMethods still caused errors, so I added it back :/
{"clientSecret": "pi_3NyFzECa1hzW9vNX1wFre9vL_secret_Vuv7WIopT4tUIKpcRK6CrkuEM", "error": {"code": "Failed", "declineCode": null, "localizedMessage": "The data couldn’t be read because it isn’t in the correct format.", "message": "The data couldn’t be read because it isn’t in the correct format.", "stripeErrorCode": null, "type": null}, "params": {"applePay": {"cartItems": [Array], "currencyCode": "USD", "merchantCapabilities": [Array], "merchantCountryCode": "US", "requiredBillingContactFields": [Array], "requiredShippingAddressFields": [Array], "shippingMethods": [Array]}}, "paymentIntent": undefined}
what sort of errors?
Stripe Apple Pay Error {"code": "Failed", "declineCode": null, "localizedMessage": "The data couldn’t be read because it isn’t in the correct format.", "message": "The data couldn’t be read because it isn’t in the correct format.", "stripeErrorCode": null, "type": null}
sorry I am confused, you said removing shippingMethods still caused errors
are you saying that you're seeing the same error if you remove that parameter or are you seeing a different error when you remove shippingMethods?
yes im seeing the same error if i removed that parameter
shippingMethods wasn't the cause of the issue imo
the full error message you shared above
{"clientSecret": "pi_3NyFzECa1hzW9vNX1wFre9vL_secret_Vuv7WIopT4tUIKpcRK6CrkuEM", "error": {"code": "Failed", "declineCode": null, "localizedMessage": "The data couldn’t be read because it isn’t in the correct format.", "message": "The data couldn’t be read because it isn’t in the correct format.", "stripeErrorCode": null, "type": null}, "params": {"applePay": {"cartItems": [Array], "currencyCode": "USD", "merchantCapabilities": [Array], "merchantCountryCode": "US", "requiredBillingContactFields": [Array], "requiredShippingAddressFields": [Array], "shippingMethods": [Array]}}, "paymentIntent": undefined}
shippingMethods is present in the params.
I believe this is the same issue I asked you to write in about. It isn't really different from last time.
trying this
const params = {
applePay: {
cartItems: cart,
merchantCountryCode: ALLOWED_COUNTRY,
currencyCode: CURRENCY.toUpperCase(),
// shippingMethods: [],
requiredShippingAddressFields: [
PlatformPay.ContactField.Name,
PlatformPay.ContactField.PhoneNumber,
PlatformPay.ContactField.PostalAddress
],
requiredBillingContactFields: [PlatformPay.ContactField.PostalAddress],
merchantCapabilities: [
ApplePayMerchantCapability.Supports3DS,
ApplePayMerchantCapability.SupportsCredit,
ApplePayMerchantCapability.SupportsDebit
]
}
}
still errors out
what happens if you go back to just the three parameters like last time?
merchantCountryCode: 'us',
currencyCode: 'usd',```
it works now
{"clientSecret": "pi_3NyG4KCa1hzW9vNX0i3rfbu6_secret_PZYsihvOpdrNerVlvFHqCTKGF", "error": undefined, "params": {"applePay": {"cartItems": [Array], "currencyCode": "usd", "merchantCountryCode": "us"}}, "paymentIntent": {"amount": 2000, "canceledAt": null, "captureMethod": "Automatic", "clientSecret": "pi_3NyG4KCa1hzW9vNX0i3rfbu6_secret_PZYsihvOpdrNerVlvFHqCTKGF", "confirmationMethod": "Automatic", "created": "1696606560000", "currency": "usd", "description": "<StripePayments.STPPaymentIntent: 0x10a629ae0; stripeId = pi_3NyG4KCa1hzW9vNX0i3rfbu6; amount = 2000; canceledAt = nil; captureMethod = Optional(\"automatic\"); clientSecret = <redacted>; confirmationMethod = Optional(\"automatic\"); countryCode = nil; created = 2023-10-06 15:36:00 +0000; currency = usd; description = nil; lastPaymentError = nil; linkSettings = nil; livemode = false; nextAction = nil; paymentMethodId = Optional(\"pm_1NyG4OCa1hzW9vNXsBccC8Zz\"); paymentMethod = nil; paymentMethodOptions = nil; paymentMethodTypes = Optional([\"card\"]); receiptEmail = nil; setupFutureUsage = nil; shipping = nil; sourceId = nil; status = Optional(\"succeeded\"); unactivatedPaymentMethodTypes = []>", "id": "pi_3NyG4KCa1hzW9vNX0i3rfbu6", "lastPaymentError": null, "livemode": false, "nextAction": null, "paymentMethod": null, "paymentMethodId": "pm_1NyG4OCa1hzW9vNXsBccC8Zz", "receiptEmail": null, "shipping": null, "status": "Succeeded"}}
Cool
Try adding the additional parameters back in one by one
it fails when I add back requiredShippingAddressFields with the following item PlatformPay.ContactField.PostalAddress
I will share the relevant code snippet with you now
<PlatformPayButton
onPress={pay}
onShippingContactSelected={async (contact) =>
onShippingContactSelected(contact.shippingContact)
}
onShippingContactSelected is used to calculate tax for the user and this callback is triggered whenever the user selects a shipping contact in the Apple Pay sheet IF ContactField.PostalAddress was included in the requiredShippingAddressFields array
my onShippingContactSelected function below:
const onShippingContactSelected = async (shippingContact: ShippingContact) => {
const postalCode = shippingContact.postalAddress.postalCode
const { amount, normalizedTax } = await getTax(postalCode)
const newCart: PlatformPay.CartSummaryItem[] = [
{
label: 'Subtotal',
amount: amount.toString(),
paymentType: PlatformPay.PaymentType.Immediate
},
{
label: 'Tax',
amount: normalizedTax.toString(),
isPending: false,
paymentType: PlatformPay.PaymentType.Immediate
},
{
label: 'Shipping',
amount: '0.00',
isPending: false,
paymentType: PlatformPay.PaymentType.Immediate
},
{
label: 'Total',
amount: (amount + normalizedTax).toString(),
isPending: false,
paymentType: PlatformPay.PaymentType.Immediate
}
]
setCart(newCart)
const { error } = await updatePlatformPaySheet({
applePay: {
cartItems: newCart,
shippingMethods: [],
errors: []
}
})
if (error !== undefined) console.error('onShippingContactSelected', error)
const order = {
subtotal: amount,
tax: normalizedTax,
total: amount + normalizedTax
}
const token = await getItem('token')
await CheckoutSessionAPI.updatePaymentIntent(paymentIntentId, shippingContact, order, token)
}
right, this is why I asked you to write in the last time we worked on this issue as this requires a deeper investigation.
We'll need to reproduce and look into exactly what's going on.
This isn't something we can do on discord while working with multiple different folks at the same time. If you can create a very simple app with just the minimal code that's required to reproduce the issue and write in via our support then we can investigate with proper context and help you much better.
Debugging complex topics live on discord is not super easy especially when it comes down to tricky bugs like this.
ah got it, i thought when you mentioned to write in you were intimating to just shoot over a message on updating types or generic error messages but that makes sense apologies
i'll rephrase, its likely that its an issue from my side, and that the cart item data is getting mangled when using updatePlatformPaySheet and updatePaymentIntent (which is a BE endpoint)
I'll try creating a simple app to repro the issue
No worries 👍 appreciate it
to close this out, so currently you don't have any leads on what might be causing the issue yeah?
yeah I don't see anything wrong with the logic you currently have.
It might be something tiny we're missing/overlooking