#victoria.fabris - card details for subscription

1 messages · Page 1 of 1 (latest)

devout cradle
#

Hello, can you send me a link to the doc that you are following?

#

And just to confirm, the end goal here is to allow one of your users to start a subscription by inputting their card details on your site?

grim spire
grim spire
#

And yes, the purchase is going to be through subscription

devout cradle
#

Thank you for the clarification. You can certainly do that. It sounds like you are doing this on your own custom checkout page, for that we typically recommend creating the Subscription object for the customer first and then using our Elements frontend components to collect the payment details and pay the Subscription's first PaymentIntent

#

Is this helping you get closer to the answer? I feel like I am throwing a lot out

grim spire
#

yeah, im doing it very customized. Im going to see if the elements in the frontend will help me with that

#

But in general, in the backend im going to send a requisition to the frontend, and the card details is not going to come to the backend, right?

#

this is how my code is right now, im hard coded the card details just to make sure this works in tests

#

But i will not have this full access to the details when on production, right? so how can i set in the Customer.create the payment_method?

devout cradle
#

So if the user is on your app when the payment is getting made, we actually recommend making the Customer+Subscription objects first, then when the user makes payment on the frontend with the Payment Element, the card will be automatically attached to the Subscription/Customer objects

#

You could do a flow where the frontend created a token and sends it to the backend for you to do more things from there, but we typically recommend the method outlined in that doc as it is more flexible and straightforward.

grim spire
#

I think i have more questions about this flow, but i will test first and then come back here. Thank you so much!

devout cradle
#

Great to hear that this helped you move forward, happy to answer any questions as they come up.