#2Clutch-checkout
1 messages · Page 1 of 1 (latest)
Sounds like a plan. Thank you!
You should be able to set customer_email when you create a Checkout Session, and the user will not be able to update the email
Ahhh, gotcha - in that case there's no way to "pre-fill" the email for Payment Links
i see.
what endpoint would need to hit then to do this?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
this one?
Yup! Checkout Sessions offer more customization than Payment Links
so a sample request would be:
stripe.checkout.Session.create(
success_url="https://example.com/success",
cancel_url="https://example.com/cancel",
line_items=[
{
"price": "price_H5ggYwtDq4fbrJ",
"quantity": 1,
},
],
customer_email=“email@email.com”
mode=“subscription”,
)
correct?
is quantity really required?
Unless the price you're using is for metered billing, yes, quantity is required
Metered billing is another kind of pricing model where you have to report usage, which is then billed at the end of the billing cycle. From you're screenshot, none of those are metered billing prices
Great! Thanks for confirming
with the email, it would be non-editable right? or do I need to add something else to make it that way?
It should be non-editable! (That's what I was testing out in the beginning)
Looking at the sample response object, which field would correspond to the customer_id?
i see id but i also see customer
If you want a customer ID like cus_xxx it would be under customer. id is referring to the ID of the Checkout Session.
one last thing: can i omit the success and cancel url in my api call if i've already defined them in my stripe dashboard?
Where in your dashboard do you have them set?
it's associated with the payment link
Do you mind sharing specifically where you set it? Maybe a screenshot? Or a link?
looks like it's just the confirmation page which i'm guessing counts as the success_url?
so my issue is potentially with cancel
i'm not sure what triggers it
if a payment doesn't go through, i want the user to try again.
and if they don't want to pay anymore, they can always hit the return button
Thanks for sharing that! So yes, when working with Checkout Sessions this is completely separate from anything you've set for your payment links. You'll still need to set both success_url and cancel_url when creating the Session