#facu_code
1 messages · Page 1 of 1 (latest)
đź‘‹ Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đź”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1285984673054593034
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
That is surprising. Can you send me the ID of an android payment that you saw this issue on?
Hi Pompey, this is the last payment intent ID I just tried to pay
payment_intent": {
"id": "pi_3Q0PnMFzbHzjdKYx1TSh4VRh",
"object": "payment_intent",
"amount": 400,
"amount_details": {
"tip": {
}
},
I see that that PM was set up on android originally and mandate data was passed for it. https://dashboard.stripe.com/test/logs/req_r23ubHGqxscgKJ
Can you show me the code for that specific confirm call? It looks to be different than the one you provided code for (type isn't card and such)
I thought that you didn't need to pass mandate data for an already saved ACH PM. Trying to think of what may be happening here
The code I use is the same for both card and ach
confirmPayment(getIntentByInvoice[0].stripeClientSecret, {
paymentMethodType: 'Card',
paymentMethodData: {
paymentMethodId: selectedPaymentMethod.stripeId,
mandateData: {
customerAcceptance: {
online: {
userAgent: userAgent,
ipAddress: ipAddress!,
},
},
},
},
}, {
setupFutureUsage: 'OffSession',
});
I’m sharing the same request, but this time made from iOS, where the payment is processed correctly and it doesn’t return the Android error.
"id": "pi_3Q0PMFFzbHzjdKYx10Z3RJkU",
"object": "payment_intent",
"amount": 300,
"amount_details": {
"tip": {
}
},
The error that appears in the console when I try to pay with Android and the error occurs is this
{"error": {"code": "Failed", "declineCode": null, "localizedMessage": "When confirming a PaymentIntent with a us_bank_account PaymentMethod and setup_future_usage, mandate_data is required.", "message": "When confirming a PaymentIntent with a us_bank_account PaymentMethod and setup_future_usage, mandate_data is required.", "stripeErrorCode": null, "type": "invalid_request_error"}}
Hello! I'm taking over and catching up...
Can you remove paymentMethodType: 'Card', from your code and try again? You shouldn't specify Card for an ACH transaction.
I think specifying Card might be causing the Android SDK to drop some of those parameters.
Hello Rubeus!
The problem is that when I set ACH, it asks for data that I can’t access, as these are saved payment methods in Stripe, and I can’t access them fully
paymentMethodData: {
accountNumber: '',
routingNumber: '',
billingDetails: {
name: ''
}
Right... I'm not saying to change it, I'm saying to remove that line entirely. Does that not work?
Ahhh okay, let me try it
I can’t, it necessarily asks me for a paymentMethodType
{"error": {"code": "Failed", "declineCode": null, "localizedMessage": "You must provide paymentMethodType", "message": "You must provide paymentMethodType", "stripeErrorCode": null, "type": null}}
Hm, interesting. I wouldn't have expected that to be required when you're also specifying a specific, existing Payment Method. Hang on...
Wait, how are you creating the Payment Method? Where is it coming from?
From Stripe, I create it beforehand and then the data is used to attempt to charge the payment
How did you create it?
await initPaymentSheet({
merchantDisplayName: 'Cinch',
customerId: profile.stripeCustomerId,
setupIntentClientSecret: createIntent.stripeClientSecret,
allowsDelayedPaymentMethods: true,
primaryButtonLabel: t('ADD_PAYMENT_METHOD'),
});
// ===== Show payment sheet ===== //
const {error} = await presentPaymentSheet();
So that happens at some point in the past, then days/weeks later you're trying to pay an Invoice using that previously saved ACH Payment Method?
Or is that happening immediately before the Invoice payment?
Both cases can happen, the result is the same on Android, but on iOS it always works
I understand it works on iOS, but frankly that seems to be a fluke.
What happens if you only call confirmPayment(getIntentByInvoice[0].stripeClientSecret) with no additional arguments?
Oh, wait, the Payment Method isn't associated with the Invoice yet, right?
So the normal way you would do this would be to use collectBankAccountForPayment to collect the ACH details, then call confirmPayment: https://stripe.dev/stripe-react-native/api-reference/index.html#collectBankAccountForPayment
If you wanted to use an existing saved Payment Method that's where I'm getting a bit stuck, because the React Native SDK doesn't allow you to pass the correct options for that...
You might have to update the Payment Intent server side to add the Payment Method before calling confirmPayment in your app.
Right, it’s not associated with the invoice, and yes, I want to use a previously saved payment method.
Okay, and from the server, is there a way for me to add the mandateData?
Yeah, can you try associating the Payment Method with the Payment Intent server-side first, then call confirmPayment? https://docs.stripe.com/api/payment_intents/update#update_payment_intent-payment_method
You shouldn't need to specify mandate data for an already collected and saved ACH account. It should use the mandata data from the initial setup.
Right, okay, I’ll try this. Give me a few minutes to check if the backend team has already tried this before and if we can do it right away?