#RiderFx3

1 messages ยท Page 1 of 1 (latest)

prime coralBOT
fierce parcel
#

Hi

fickle siren
#

๐Ÿ‘‹ happy to help

#

could you elaborate a bit more?

fierce parcel
#

The context :

The client create a cart with a subscription and products, so I need to subscribe him to a plan, then charge hjm for the product in a one-time payment.

#

For example : pi_3M3Gh2DY4NUh1pUi0E7GmSn2

#

"message": "Your card was declined. This transaction requires authentication."
"type": "card_error"

#

But I already did the auth before with a SetupIntent

#

Here is the flow I want to do :

  • Cart validation
  • Create SetupItent
  • 3DS Auth
  • Subscribe to a plan
  • Then, charge the card immediately for one-time payment
#

But I got rejected when trying to charge the payment intent off_session

fickle siren
#

a couple of things to note here

fierce parcel
#

wow !

fickle siren
#

another thing, is that you don't need to create a SetupIntent

fierce parcel
#

The problem is I don't have the items products stored in stripe dashboard

fickle siren
#

instead you can use the latest_invoice.payment_intent from the created Subscription to pass the client_secret to the front-end

fickle siren
#

if it's a custom price, you can create that with price_data

fierce parcel
#

I needed to create a SetupIntent to authenticate the card before creating the subscription

#

Because of 3DS2

fickle siren
#

no need to do that

#

I'll explain

#

just give me a sec

fierce parcel
#

This was the only solution the support give to me ...

fickle siren
#

I'm giving you another ๐Ÿ™‚

fierce parcel
#

Okay I will listen

#

You still here ?

fickle siren
#

yes sorry, just give me a moment please

#

basically when you create the Subscription you can expand on latest_invoice.payment_intent this would give you a client_secret that you would then use with the Payment Element on the frontend to collect the payment details

#

when creating the Subscription make sure to also use payment_settings: {save_default_payment_method: 'on_subscription'},

fierce parcel
#

I don't need to return on the frontend at this step because the customer alrteady give his card number ...

#

All the script is actually in PHP

#

So before creating the subscription I already have a customer_id and a valid payment_method

fickle siren
#

I'm suggesting a different flow all together

#

you start by creating the Subscription

#

and then you collect the payment details and at the same time pay the first invoice

fierce parcel
#

Is there a way to do all this things only in backend ?

#

Maybe creating the subscription without charge, add the products in the invoice, then charge ?

fickle siren
#

I do understand that it is hard to change your workflow, especially if you have been working on it for a while

#

but I can give at least a couple of reasons why this flow is better

fierce parcel
#

I don't understand why it will works like that and not if I get the payment_method before ...

#

Maybe the key is here ?
"On the backend, create the subscription with status incomplete using payment_behavior=default_incomplete."

fickle siren
#

let me double down on why it's better to use the workflow I described to you earlier

#

when you create a SetupIntent the user would be prompted with a 0 (zero) authentication and wouldn't know about the actual price of the subscription

#

2- even when setting up a payment method for off_session future usage, the issuing bank could still ask for 3DS (upon their discretion) which means that your customer might have to do 2 authentication back-to-back

#

which is not really a good experience for your user

fierce parcel
#

Yes this was my original problem

#

But this problem seems to be solved if I edit the invoice before the first charge right ?

fickle siren
#

no not really

fierce parcel
#
  • create setupintent
  • create a sub but dont finish it
  • edit invoice to add items
  • complete the sub

?

fickle siren
#

this is really an overkill for the 2 steps that I'm giving you

  • create a subscription with add_invoice_items
  • send the client_secret to the frontend
fierce parcel
#

Yes but it means really lot of work in my javascript flow

fickle siren
#

by confirming the PaymentIntent on the frontend you would be doing:
1- collecting a valid Payment Method(PM)
2- attaching the PM to the Subscription
3- paying your 1st invoice including the one-off payment

fierce parcel
#

It also means that the customer have to click a first time on a button, then after that you prompt to him a popup for enetering his card ?

fickle siren
#

4- validating 3DS if needed

fickle siren
fierce parcel
#

Okay thanks for your help I will try

fickle siren
#

it's really well explained

fierce parcel
#

Yes I understand the problem is that I build all my logic in backend wich is really easier for me because I have a lot of checks to do

#

As I do only one call to my backend in my flow

fickle siren
#

the only difference would be instead of using a SetupIntent you would use a PaymentIntent

fierce parcel
#

Yes but I have 2 calls instead of 1

fickle siren
#

why do you need 2 calls?

fierce parcel
#

First call : creating the sub, retrieve client secret and send it to front
Second call : get Payment Method and re-send it to backend

fickle siren
#

no you don't do the second call

#

when the customer enters their Payment Details using the PaymentElement, we (Stripe) will send the payment details and do all of the list I sent you earlier about creating the PM, attaching it to the customer/subscription, paying the invoice etc...

fierce parcel
#

Yes but I have logic to do in the backend if payment fail etc..

#

So it's not so simple because I already have a huge system implemented

#

Seems simple with the little examples on the docs lol

#

But not simple at all with a lot of logic and checks I have to do in the backend

fickle siren
#

I understand your frustration, and I know that it's not easy, but you will thank us on the long run, this is the best approach and we don't take this statement lightly

fierce parcel
#

The problem with Stripe is you best approach is changing every 2 month and honestly it's very frustrating to change logic all the time ๐Ÿ˜ฆ

#

Anyway thanks for your helps now I have to do a lot of testings lol

fickle siren
#

I hear you, and that might be the case if you started working on something before a release of a new feature, but AFAIK the Subscription approach has been around for quite sometime now, I'm sorry that you have been maybe mislead previously, but I assure you that we're here to support you in the best way possible and that's exactly what I'm trying to do here

#

please do come back for any and every Q you have along the way, I might not be around, but my colleagues will do as good as a job if not better than myself ๐Ÿ™‚

fierce parcel
#

Thanks a lot