#jkendrick - Checkout
1 messages ยท Page 1 of 1 (latest)
Hello, can you send me the docs that you were looking at for this? Happy to look in to them and discuss which may be best for you
Here are the docs for each implementation:
Client only: https://stripe.com/docs/payments/checkout/client
Client & Server: https://stripe.com/docs/payments/checkout
It appears that maybe the client-only integration does not support subscriptions? Is that right?
Thank you. Checking in to those
Gotcha. So instead of client only checkout, I think we typically recommend payment links at the moment https://stripe.com/docs/payments/payment-links
The pro for those is that they don't require you to write any code or process any requests on your server. The cons are that is is much less customizable and that you will always be directing users to buy the same item on the same page.
For Checkout where you are creating the Session on your own server, you gain a lot of flexibility and configurability. You have more settings to play with and you can set them as needed based on what you already know about your customer
When you say "you will always be directing users to buy the same item on the same page.", if it's a subscription payment link, they only ever have to visit the page 1x because it will just auto-renew, right?
Correct, Checkout can set up the subscription and the subscription will either charge the user automatically or automatically send them invoices depending on your configuration
Ok. One other question - we are wanting to be able to set the stripe customerID to be the same as a customer's userID on our app. Is it possible to have the payment link use a specific customer id? Or do payment links always just create a random customer ID? If that is the case, I think we might need to use the client/server checkout method in order to keep track of which of our users have subscribed (tracking by a shared userID/customerID in stripe & in our app).
Lmk if what I'm asking is not clear. ๐
Our Customer IDs will always be Stripe generated but I think we do have something for that. Checking our docs, will be back in a minute
We recommend using the client_reference_id field for that purpose. Here is the doc for that field in our server-side API https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-client_reference_id
And for payment links, you can pre-fill this information by adding a client_reference_id to the URL that you send your customers to https://stripe.com/docs/payments/payment-links#url-parameters
oh great! And do payment links offer webhooks that I can use to detect when a specific client_reference_id makes a purchase?
Yes, with payment links still create checkout sessions so you can listen to all of the same webhook events like checkout.session.completed
Also for subscription cycle payments we typically recommend listening for invoice.paid. This doc is a great overview on them if you have not already seen it https://stripe.com/docs/billing/subscriptions/overview
and would the client_reference_id be in the webhook event? So I know which user to give app access to.
It should be in the checkout.session.completed event but let me test that out to double check
Confirmed that if you set that URL parameter, that value will show up as the client_reference_id in the resulting checkout events
One thing to note is that that field will only be on the Checkout Session object. If you want to reference that ID from the subscription, you will likely want to use the API to set your customer ID as metadata on the Stripe Customer or Subscription object
Oh or the description on the customer object https://stripe.com/docs/api/customers/object#customer_object-description
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ok. thank you so much for your help!
Of course! Glad I could help you sort through some of this