#TheUchi007 - Subscription Checkout

1 messages ยท Page 1 of 1 (latest)

silk vale
#

Hi ๐Ÿ‘‹

#

Okay so you are using the Payment Element to capture the users payment details when they are signing up for the subscription?

restive dragon
#

Yes. Well, I am trying to lol but I can't figure out how to make it work, since I am required a client_secret

silk vale
#

Okay, so you've got some options.

#

You can create a Setup Intent to render the Payment Element, create the Payment Method on the customer and then use it on the subscription.

restive dragon
#

Hmm ok. Quick question, if I were to create the payment intent(which seems to require me to create the subscription on the customer, but mark as incomplete), can I retrieve the payment method used in there for other type of transactions?

#

In other words, if I just do the process of doing the whole payment and such, can I use that same payment method for, let's say, buying a book?

silk vale
#

Okay if you are creating the subscription it will automatically create the first invoice with a payment intent. So that part is covered.

#

If you are using the above parameter, the payment method will be saved to the Customer record. So then you can use that payment method for one-off purchases as well.

restive dragon
#

Ah ok, so as long as I add that parameter, it will save that info that I can use for later purchases, correct?

silk vale
restive dragon
#

Awesome, thank you so much!

silk vale
#

Sure thing ๐Ÿ™‚
Subscriptions can get pretty complex so it's good to test things out thoroughly to be sure you get the behavior you expect.

#

Those are also complicated because, well, subscriptions are complicated. But it's worth the work of figuring them out.

restive dragon
#

That is amazing, that will be really handy, thanks!

silk vale
#

Happy to help ๐Ÿ‘

restive dragon
#

I have one more question

#

Ok, so I am at the step in where I create the subscription on the customer on Stripe. The subscription is created as and marked as "incomplete". It will remain that way till I actually process the payment, and then I will update to active. My question is, how can I get the client_secret if the user were to leave, and then come back? I can see the subscription in the subscription list on the customer object, but I am not sure how to get a client_secret

silk vale
#

Okay so the client_secret is actually on the latest_invoice.payment_intent. You specify that you want to expand those properties when you create or retrieve the subscription. This allows you to get and use the `client_secret``.

restive dragon
#

Aah I see it, thank you so much! You are awesome!

silk vale
#

Happy to help