#hendr1x_api

1 messages ยท Page 1 of 1 (latest)

shell treeBOT
#

๐Ÿ‘‹ 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/1266371671569203304

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

calm pollenBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

nimble pasture
#

I'm trying to implement a 2 step checkout

scenic kayak
#

hi there!

nimble pasture
#

Hello

#

I coded everything and now am realizing it seems like SetupIntent doesn't support confirmation Tokens

scenic kayak
#

yes it works with SetupIntent

nimble pasture
#

I don't see it in any of the docs I am using

#

That doesn't help me...I already have a confirmation token created

scenic kayak
nimble pasture
#

ok.

#

Annoying

#

Everything was coded to work with payment_method

#

trying to convert to confirmationToken

#

doesn't seem to bring me any benefit

#

Thanks for your help though...I'll figure out how to get this data to confirm step

scenic kayak
#

Annoying
what do you mean? you asked if SetupIntent work with confirmationToken, and I said yes. what's the issue then?

nimble pasture
#

It seems when you converted your system from paymentMethod to confirmationTokens you made some large structural changes to how everything works

#

of course I am sure there are good reasons for this

#

but prior I provided payment_method to setupIntent/PaymentIntent

#

now I have to get the confirmationToken to a new place

#

I assume all the usage/saving of payment data has changed as well

scenic kayak
#

I'm not sure I follow. you don't have to use confirmationTokens if you don't want to.

nimble pasture
#

I was told by you guys its was the recommended

scenic kayak
#

yes it is recommended

#

but you don't have to

nimble pasture
#

I've already done 5 days of work as well

#

While I got you...is there a guide somewhere on how to handle saving payment details for a customer using confirmationToken?

#

so I they can reuse

scenic kayak
nimble pasture
#

It seems like there are differences

#

I just noticed that setupIntent doesn't accept currency

#

Where do I provide that now?

scenic kayak
#

yes there are some small differences. for example a SetupIntent doesn't have an amount or a currency.

nimble pasture
#

So where do I provide amount and currency?

#

I dont' see it on confirm either

scenic kayak
#

you don't. a SetupIntent is not for making a payment, it's just to save a card for later.

nimble pasture
#

Sorry

scenic kayak
#

is your goal to make a payment and also save the card for later?

nimble pasture
#

I appreciate your patience

#

save for later

scenic kayak
#

no worries, I'm happy to help ๐Ÿ™‚

nimble pasture
#

So how do I use a setupIntent that has been confirmed

scenic kayak
#

save for later
then yes it's a SetupIntent, without any currency or amount set.

nimble pasture
#

lol

#

I thought I was getting rid of all payment_methods

#

to use confirmation_tokens

#

Is there a guide on using a setupIntent to complete a charge

scenic kayak
nimble pasture
#

ok. So this is a bit of an issue for me

shell treeBOT
nimble pasture
#

Did I just lose you?

unique sun
#

we're just changing over so I'll help if you have any followups

nimble pasture
#

ok

#

just ignore everything before

#

Charge the saved payment later

#

Is it possible for me do this step with a confirmationToken and not a payment method code?

unique sun
nimble pasture
#

I just converted everything in my app to run from confirmation tokens.

#

so I have already successfully created the token and confirmed the setupIntent

#

I guess I don't even really get the idea of setupIntent

#

it seems like its just a way to save a paymentMethod

unique sun
#

yes

nimble pasture
#

Can i just

#
    clientSecret,
    confirmParams: {
      confirmation_token: '{{CONFIRMATION_TOKEN_ID}}',
      return_url: 'https://example.com/order/123/complete',
    },
  });
#

using the confirmation_token I used to create the setupIntent?

unique sun
#

no

nimble pasture
#

or confirm the setupItent I mean

unique sun
#

no, because the token is consumed when it's used.

nimble pasture
#

so the only way for me process a payment

#

is for me to retrieve the payment_method from you guys?

unique sun
#

by "payment_token" you mean a PaymentMethod ID pm_xxxx? yes, that is how it works; you have a Customer cus_xxx with a number of attached PaymentMethods(the SetupIntent is used to attach a PaymentMethod to a Customer without an initial payment), and you charge one of them by passing the ID of that attached PaymentMethod to a PaymentIntent.

nimble pasture
#

I just spent 5 days removing all traces of payment_method from my system

unique sun
#

not sure why you did htat

nimble pasture
#

So...everything now runs from confirmation_tokens

#

you guys said it was the recommended way

unique sun
#

a ConfirmationToken is just a short-lived ephermeral way to transport the context of the transaction from the frontend to the backend, not a persistent ID/object

nimble pasture
#

multiple times

unique sun
#

I doubt we said that explicitly. ConfirmationTokens are the recommended way to do certain flows(collecting details on the frontend and then being able to inspect them and add a "confirm your order" step before you use those details to complete a transaction or setup action).

nimble pasture
#

Thats fine

#

and I don't mean to come off as frustrated at you

#

I'm just way over my time allotment for this task

unique sun
#

that's all. Nothing is different in the overall model of Customer->PaymentMethod->PaymentIntent usage

nimble pasture
#

So let me clarify

#

For one time payments...using paymentIntent. I am using confirmationTokens. In that situation I don't need to worry about paymentMethods at all correct?

unique sun
#

if you have no interest in saving the card used in that one-time payment and using it again, then no, not really. You just confirm the PaymentIntent. There is a pm_xxx PaymentMethod created that you can look at, but it's not attached to the Customer object and can't be charged again.

nimble pasture
#

So now, sticking to the above guide...if I wanted to save the paymentMethod (attached to a customer) what is the recommended way

#

I still use confirmationTokens I assume. However I need to retrieve the paymentMethod correct?

unique sun
#

to be clear, you want to do the payment and also save the card after that transaction? (like a "save your card for future payments here" option)?

nimble pasture
#

I have two checkout flows...I'm sorry for the confustion. In this case I am discussing now, I want to do teh payment and save the card after the transaction...yes...exactly

#

It looks like you guys are making me do this

#
  'customer' => '{{CUSTOMER_ID}}',
  'type' => 'card',
]);```
unique sun
nimble pasture
#

I have my checkbox for "do you want to save payment method" on the same page has the elements object

#

I'm sorry I'm being a pain...this stuff is just very confusing to me

#

Is there a way to get a payment_method_id besides just looking up whats attached to the customer?

#

That's a real pain for how I coded it

unique sun
#

let's stick to one thing at at time. You're seemingly also asking how to list and charge an existing payment method, when I'm trying to explain just how to save a card during a payment(so that it's then available for future payments), so one thing at a time

nimble pasture
#

I have two flows...one that saves it for later (setupIntent) one that charges right away (paymentIntent)

#

both need to support saving card to customer

#

both are two step checkouts

#

Nothing is working...lol

#

So if you want to focus on something first that is fine

#

I think I understand how to handle both normal flows

#

I haven't grasped how to handle saving the card for later yet

unique sun
#

ok, well that is what I've been addressing in my recent replies. It's basically the same as the one-time payment flow, just that you also pass setupFutureUsage.

nimble pasture
#

ok

#

Can I just ask

#

Is there a way to get a payment_method_id besides just looking up whats attached to the customer?

#

Can I get it with a confirmation_token

#

or via a paymentIntent, setupIntent

unique sun
#

you can :

  • list PaymentMethods on the customer
  • look at the payment_method field on an existing completed PaymentIntent or SetupIntent
  • store the ID in your database and read that
nimble pasture
#
  1. is a pain I would like to avoid if possible
#
  1. I don't think I ever get the id now that I am using confirmationTokens
#

so I think I need to #2

unique sun
#

you do. It's on the PaymentIntent or SetupIntent after you use the ConfirmationToken to confirm it.

#

why is 1) a pain?

nimble pasture
#

No worries....its how my code is...I'll have to do a diff againist an existing list of saved payment methods

#

One last question please

#

I'm looking at the docs you provide above

#

stripe.elements(options?) is shown twice

#

once without support for setupFurtureUsages once with

#

Whats going on with that?

unique sun
#

because there's two ways to initialise the object :

  • the "traditional" way is you create an Payment/SetupIntent on page-load and you just give Elements the client_secret of that. The Intent has all the information on the amount/currency/do-I-want-to-save-the-card so it doesn't need all that passed in to the constuctor
  • the "deferred" way where you don't need to create the Intent until later, in which case you do need to pass the amount/currency/do-I-want-to-save-the-card as parameters to the constructor so Elements can show the right things.
nimble pasture
#

perfect

#

make sense

#

thank you so much for your help

#

it really makes a big difference

#

I clearly didn't understand the confirmation token stuff

#

thanks for clarifying that and all your help