#FrancescaM

1 messages ยท Page 1 of 1 (latest)

past finchBOT
mystic hull
#

๐Ÿ‘‹ happy to help

#

do you need the backend or the mobile code to be in Java?

blazing cairn
#

Hi, I need the mobile code

#

I'm trying to follow this guide

#

but I have an error in flowController.configureWithPaymentIntent

mystic hull
#

in the section 4 you can choose between Kotlin and Java

blazing cairn
#

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'.

mystic hull
#

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

blazing cairn
#

ok thank you very much

mystic hull
#

let me know if you need any more help

blazing cairn
#

Do you have a mobile example code?

mystic hull
#

what's the error you're getting now?

blazing cairn
#

Always the same.

#

but now I'm getting the client secret from server response

mystic hull
#

would you mind sharing the PaymentIntent Id pi_xxx?

blazing cairn
#

yes one moment please

#

pi_3MSKjCDFRkIUCY8O0MMwIfnF_secret_kJQh5Fg7PI5xkNnvxj7UTwpuB

#

This is the ephimeral Key value: pk_test_go1gfDIzAfF4Oaspj9KXLmZu0083I5ce0x

mystic hull
#

looking into it

mystic hull
#

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

blazing cairn
#

ok so in this code

#

new PaymentSheet.CustomerConfiguration(
response.getPaymentId(),
publishableKey
)

#

I have to not use response.getPaymentId?

mystic hull
#

it's the backend code that's needs to be corrected not the front-end

blazing cairn
#

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

astral cipher
#

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?

blazing cairn
#

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

astral cipher
#

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.

blazing cairn
#

yeah, I know

#

maybe I have to use the actual integration

astral cipher
#

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.

blazing cairn
#

ok perfect, thank you