#FrancescaM
1 messages ยท Page 1 of 1 (latest)
Hi, I need the mobile code
I'm trying to follow this guide
but I have an error in flowController.configureWithPaymentIntent
in the section 4 you can choose between Kotlin and Java
and I don't understand why
yeah I know, I choose Java
but at a certain point I use the function configureWithPaymentIntent
and I have the following error: java.lang.IllegalStateException: PaymentSheet cannot set up a PaymentIntent in status 'succeeded'.
this means that the client_secret that you're using belongs to a PaymentIntent that succeeded previously
you need to create a new PaymentIntent and use the new client_secret
ok thank you very much
let me know if you need any more help
Do you have a mobile example code?
what's the error you're getting now?
would you mind sharing the PaymentIntent Id pi_xxx?
yes one moment please
pi_3MSKjCDFRkIUCY8O0MMwIfnF_secret_kJQh5Fg7PI5xkNnvxj7UTwpuB
This is the ephimeral Key value: pk_test_go1gfDIzAfF4Oaspj9KXLmZu0083I5ce0x
looking into it
ok so the problem is that you're creating a PaymentIntent with a PaymentMethod and you're confirming it on the backend
meaning that with the create API you're already paying the PaymentIntent
if you need the customer to choose their Payment Method on the front-end you shouldn't pass that parameter
ok so in this code
new PaymentSheet.CustomerConfiguration(
response.getPaymentId(),
publishableKey
)
I have to not use response.getPaymentId?
it's the backend code that's needs to be corrected not the front-end
ah ok
So in this endpoint braintree/v1/stripe/payment we have to delete the parameter paymentMethodId?
This is the endpoint that gives the client secret
Hi there ๐ I'm jumping in as my teammate needs to step away. Sorry, but I'm not readily recognizing that endpoint, is that an endpoint for your backend server?
I call this endpoint to get the client secret
It works
but now I'm trying to implement a PaymentSheet and I'm not able to do this
because I have a problem with this paymentMethodId
and yes it's an endpoint for my backend server
It sounds like you'll need to change your backend endpoint to support this new process then, but if that endpoint is being relied upon by an existing integration changing it could be problematic.
Right now it sounds like the problem is your endpoint confirming the Payment Intents at the same time it is creating them. If that endpoint is being used by another part of your integration, then you'll need to modify it handle the two distinct flows, or create a second endpoint to handle the new flow.
Either way, the new flow should avoid using confirm=true when creating the intent. If you elect to use the same endpoint, then you may need to adjust it so that it doesn't require a Payment Method parameter if it is currently requiring that value be present.
ok perfect, thank you