#danitoyy

1 messages ยท Page 1 of 1 (latest)

serene wrenBOT
bronze swallow
#

Unfortunately no. The client secret is only used for client-side actions

fleet patrol
#

Ahh, damn

#

Okay, I have some more questions regarding the payment methods and payment intents. I read the docs a lot of times. I have an implementation done already, but I am not sure I am doing it correctly.

First: We create a payment intent with a customer object inside it, then if he wants to save the card, we must pass setup future use as on_session(this is for our app, because we are not doing background transactions)

Second: The card should be automatically saved in the customer object and we can retrieve all of the saved cards from our backend to display them on the client side.

Third: when the customer chooses one payment method, we pass the paymentMethod Id and the customer Id in the next intend and the Payment Element UI should be able to dynamically change based on the secret, right ?

#

Should be automatically saved when he makes his first transaction****** More accurately said

bronze swallow
#

If you're already setting up the Payment Method for future usage, then why would you bring the customer back into the Payment Element? Why wouldn't you just create an off_session Payment Intent with confirm=true?

fleet patrol
#

Because we dont want to charge them offline, we want to charge them with clicking a button when they want to

#

And we don't want them to write the card again, so thats why we have it saved

#

In that case, we don't need confirm = true, right ?

#

When this is his first transaction ever, we create the Customer object. After that I always use his email to retrieve it and list the PaymentMethods

#

We have an endpoint which is returning them, so he can chose, then the frontend sends the paymentMethodId so that we can create a new intent with it for the next month - online of course ๐Ÿ™‚

bronze swallow
#

Is this for a web app? Or mobile?

fleet patrol
#

It should be for both. Currently web app only

#

But it should be working for mobile as well

#

The question is, will the Payment Element know that the customer does not have to write the data again and just click "pay" for example

bronze swallow
#

There's not currently any Elements or Stripe-created UI components for displaying saved payment methods, so you'd have to build that part yourself (at least for the web app side of things).

fleet patrol
#

Yeye, that part is okay for us to do

#

The question is what happens when we create a secret with the payment method id

#

Via the payment intents api

#

Will the window look like a ready to use pay button, which he just clicks ?

#

And everything is done

#

using the already saved card in the background

bronze swallow
#

Do you have a test integration set up? What happens when you pass in the client secret with a payment method id?

fleet patrol
#

My buddy has it, but I can't test it now exactly. Tomorrow I will and will message you if I have any problems

#

I just wanted to know if I am doing everything right on the backend

bronze swallow
#

Seems to be a viable workflow from what I can tell

#

We aren't available on the weekends, but we're back on Monday so we can help then

fleet patrol
#

First paymentIntent = new Customer + setup future use on_session

Which will save the card

Second paymentIntent next month = create new payment intent + retrieved customer inside + the paymentMethodId

#

But I am still losing it on the confirm = true

#

Do I need it for the second transaction or not ๐Ÿ˜„

bronze swallow
#

Is it part of a Subscription? Or are you just making these payments as one-off payments every time?

fleet patrol
#

One off payments every time

bronze swallow
#

Then yeah, that should work just fine as far as I can tell. the confirm=true part just makes sure the payment is attempted as soon at the Payment Intent is created/updated.

fleet patrol
#

Aha, so it is only used when it is offline

#

Basically if we want to charge automatically

bronze swallow
#

You can use it when the customer is online too (AKA on-session), but when you do offline (AKA off-session) payments, you HAVE to use confirm=true or else the API request will error out

fleet patrol
#

Okay

#

Thanks for the support

#

I think i am all good

#

Have a good one!