#mike35x95x1-setup_future_usage

1 messages ยท Page 1 of 1 (latest)

past hornet
#

Hi, looking...

#

Can you share the request id that included setup_future_usage?

hardy peak
#

hm, how can I retrieve it?

past hornet
#

In your Dashboard request log. It's req_xxx

hardy peak
#

looking for the right one, give me a moment

#

I'll try to create a new one. just a moment

#

pi_3LaEDTI9dUljRHPm0VDX7bof

#

just created. I can see there "setup_future_usage": 'off_session'

#

can you please confirm?

#

I used brand new card (Brazil card) that I've never used before and it tells me the same error

#

4000000760000002

past hornet
#

Okie I can see you created the PI. Can you confirm the PI?

#

after it's confirmed we would see the PM attached

hardy peak
#

confirm PI?

#

not sure I do following you. what is "PI confirming"?

past hornet
#

You have 2 steps: create a PI then confirm it via a client library, normally stripe.js

hardy peak
#

or is the confirmation used only when I want to use the pi to collect money without customer action?

past hornet
hardy peak
#

we have this done already

#

we have two different flows. with a new card and with existing card. but in both the card is not attached to the customer.

#

so do I need to confirm the PI only when I create it with a payment_method_id or even when we send the customer to the checkout page?

#

frankly speaking - should I confirm EVERY pi or only some...?

past hornet
#

I'm not really following your thoughts. No you don't need to confirm every PI, but I am unsure about your 2 flows

#

Here is the flow to utilize the setup_future_usage. You can see in step 6 you confirm the PI on client side

hardy peak
#

clarification: we sell software subscriptions and when the card is used for the first time we store its id in our system. on the software renewal we want to create pi with this card (pm) to not involve the customer anymore

past hornet
#

Any reason you don't use our Subscription?

#

it sounds like a good fit

hardy peak
#

it probably does but we want to try it first without. we have all the subscription features in our system already. I don't say we will not use it in the future but not for the time being

#

I am reading the last link but there is nothing about "confirming paymentIntent". however there is confirm: true on pi creation

zealous halo
#

Hey, taking over here. Can you clarify the ask for me? Sounds like you're having issues using s_f_u?

hardy peak
#

hi, it seems I becoming lost in your documentation ๐Ÿ™‚

#

I am trying to this simple scenario:

  1. do first payment with brand new card
  2. save the pm_id in our system
  3. create new paymentIntent with this card
  4. collect the money without customer action
zealous halo
hardy peak
#

I've done it already

#

do I need the automatic_payment_methods to be enabled?

zealous halo
zealous halo
hardy peak
#

ok. that's becauses it was suggested in the previous provided link

#

so back to the {confirm: true}. Still don't know if this should be in both (first purchase or only on the repeating one)

zealous halo
#

Can you share a pi_xxx ID with me that's proving troublesome?

hardy peak
#

"pi_3LaEnRI9dUljRHPm13kLdMzV"

#

just have created it with a new mexico visa card

#

"pm_1LaEnuI9dUljRHPmJlNDsCfi"

#

there are no pms on cus_MCthNndyc0ak1o

zealous halo
#

Ok, looks like the PI succeeded. And the intention was for that Payment Method to be saved to this customer: cus_MCthNndyc0ak1o ?

hardy peak
#

yes

#

I try now to use the same card to purchase something else

zealous halo
hardy peak
#

and it's back:

#

I tried to create new pi with the pm_1LaEnuI9dUljRHPmJlNDsCfi for a cus_MCthNndyc0ak1o and get the error message. can you please clarify what exactly I did wrong in this case?

zealous halo
#

Can you share the req_xxx ID that threw that error

hardy peak
#

how can I retrieve the req_xxx from a fail request? I only have an exception in my code

#

I can provider the payload I am sending to the stripe.paymentIntent.create if it helps...

#

this is what I am sending:
{
amount: 2500,
currency: "EUR",
description: "Muse Thing Standard Subscription (monthly)",
customer: "cus_MCthNndyc0ak1o",
payment_method_types: [
"card",
],
payment_method: "pm_1LaEnuI9dUljRHPmJlNDsCfi",
setup_future_usage: "off_session",
confirm: true,
}

#

and I get the error above. I really don't know what I am doing incorrectly

zealous halo
#

Why are you passing setup_future_usage: "off_session" again? That's likely the issue

hardy peak
#

so I should not use it when I am sending pm and confirm?

#

req_kiO7ITKlutszSs

#

that's the failed request

#

I removed it from the request but the result is same: req_oIZKmC0MVRXTzP

zealous halo
#

In that instance its not reusable as it wasn't saved to the customer

hardy peak
#

i am confused

#

this is what I do:

  1. create pi with the s_f_u
  2. redirect the customer to pay THIS pi
  3. capture the webhook of the checkout sessions
  4. retrieve the pi and the pm
  5. save the pm to our database
  6. create new pi with the pm and want to collect the money without customer action
#

where exactly I do have the problem?

zealous halo
#

But pm_1LaEnuI9dUljRHPmJlNDsCfi wasn't created with s_f_u. That's the issue โ€“ its not reusable

hardy peak
#

ok, so what can I do now with it?

#

is there any way how to fix it?

zealous halo
#

Are you passing payment_intent_data.setup_future_usage when you create your Checkout Sessions?

hardy peak
#

not sure - a moment

zealous halo
#

That message is the underlying issue

hardy peak
#

so even I have pi with the s_f_u I still have to send same parameter to the checkout.session.create...?

zealous halo
#

You need to pass that param to Checkout, and then in the Payment Intent for the subsequent payments, you can use the pm_xxx and can omit s_f_u

hardy peak
#

wait a minute. maybe the problem is elsewhere. this is how I create the checkout session. Don't I miss the pi in the payload?

#

I thought that the checkout session is created with a link to pi where all the "rules" are set

zealous halo
#

You need to pass the setup_future_usage under payment_intent_data there

#

I've said this like 3 times haha

hardy peak
#

yes I know it now. believe or not - you're in your API docs everyday - for us it's one of many...

#

so the s_f_u will be used only in the checkout session and the pi will have only pm (if available) and confirm: true, am I correct?

zealous halo
#

Correct, yes

hardy peak
#

yes, it is understandable. I was just confused "when" or "in which object" I should use it.

#

however now it looks like I know and I can move forward. thanks for your help

zealous halo
#

np!

hardy peak
#

last question? is it possible to send pi_id to checkout session? or how does the checkout session know which pi is connected to?

zealous halo
#

It's not, no. Checkout will generate a PI

hardy peak
#

so I don't have to create PI before? this probably is my first misuse

#

so it's checkout (customer interaction) OR pi + pm + confirm (without customer interaction), right?

zealous halo
#

You don't nope, Checkout will generate a PI when required and you can pass parameters to that PI (via payment_intent_data)

zealous halo
#

You'd use Checkout to process an initial on-session payment which also saves the card to facilitate those future off-session payments