#ParkerDB - Payment Shee
1 messages ยท Page 1 of 1 (latest)
Hello ๐
Okay this has lots of options. Which one were you interested in?
The payment intent. My issue here is, I have a one time purchase for a customer. We currently create an invoice for it. The invoice has a payment intent attached to it. I supply the payment intent to the payment sheet (during initialization). The payment intent on the invoice has a payment method already attached to it which causes an error. Is there a way to remove the payment method on the payment intent so the payment sheet can work properly?
The payment intent
All these examples use a payment intent. Are you developing for Web or Mobile? Using Custom Code approach or pre-built components? What platform is this working on?
React Native. I am using the mobile payment element.
Okay great, that way I can be sure I'm looking at the same code snippets you are
Okay sounds good
Alright so which part are you having trouble with?
The payment intent. If I supply a payment intent from a finalized invoice instead of creating a new one, I get an error because the payment intent already has a payment method attached to it.
Is this mobile payment element compatible with paying invoices?
Okay so you are passing in invoice.payment_intend.client_secret to your RN front-end?
Yes
For the finalized invoice? And the invoice is not automatically progressing?
I set the invoice to not automatically progress because I want the payment to occur on the client side with the mobile payment element
Okay so you bring the user back on-session to complete the payment process. And is the error showing up in the RN front-end or when you make the API request to confirm the payment intent?
I never manually confirm the payment intent. It seems the mobile payment element does that for me. I get an error when attempting to present the payment sheet
Unfortunately the error gives back an empty error object.
This flows works just fine if the customer doesnt have a default payment method attached to their account
The error is on the front end though, to answer your question
Hmmmm....so if you don't want to bill customers automatically where are they getting a Payment Method set as their default_for_invoice?
I'm sorry, I am not sure what your question is asking
How did the customer get the default payment method set?
We have default payment methods for all our customers since we charge their subscriptions that way. We set a customers default payment method when they add their card information to their account. This is separate from the flow of them purchasing a one-off item
Ah, and this part of your flow is for one-off invoice payments?
Yeah that still sounds bug-ish to me. Let me take a look
Can you share one of the finalized invoices?
Can you share a screenshot of where the error occurs? How does the error manifest in the integration.
Can you share a payment intent ID?
in_1KrPxqCj4tMJs7FaMiKrnwTt
pi_3KrPxwCj4tMJs7Fa18fk7Wlo
Error object on front end
Object {
"code": "Failed",
"declineCode": null,
"localizedMessage": null,
"message": null,
"stripeErrorCode": null,
"type": null,
}
This comes from the error returned after calling await presentPaymentSheet();
Hi there! Jumping in here since @bleak yew needs to step away. Can you provide your initPaymentSheet code?
And can you confirm what version of React Native SDK you are using?
SDK 44
const initializeOneTimePaymentSheet = async (paymentIntentId: string) => { setLoadingPaymentSheet(true); const { customer, ephemeralKey, paymentIntent } = await getOneTimePaymentSheetParams(paymentIntentId); if (!paymentIntent) { return null; } const { error } = await initPaymentSheet({ customerId: customer, customerEphemeralKeySecret: ephemeralKey, paymentIntentClientSecret: paymentIntent, }); if (!error) { setLoadingPaymentSheet(false); } };
The payment intent returned from the backend is the payment intent on the invoice
Sorry, I meant the Stripe React Native version
Can you log out the customer ID and make sure it is the same one as the invoice's customer?
I am using the most updated version of stripe/stripe-react-native. In my package json, it is version 0.2.3
Yes the customer IDs align
The most updated is 0.7.0 ๐
I don't know why it should really matter, but I'd recommend testing updating your SDK.
It is possible there was an old bug with this flow that has since been fixed.
And to confirm you are seeing this behavior on iOS?
Have you tested on Android?
When I run expo install stripe/stripe-react-native
the version compatible with expo SDK44 is 0.2.3
It occurs on both platforms
If there isn't a customer default payment method, it works fine
Ah didn't realize you are using Expo
Okay sounds like I will need to reproduce this on my end to figure out exactly what is going on. It seems like a bug as far as I can tell... we have tested this flow before and it works fine on Web so not sure why PaymentSheet isn't liking it. Can you create a new issue on Github (https://github.com/stripe/stripe-react-native/issues) with full details? I'll then nudge our React Native team internally and we will reproduce and look at a fix.