#2Clutch-checkout

1 messages · Page 1 of 1 (latest)

silent ether
#

Hello! Give me a minute to confirm something and I"ll get back to you

plush crane
#

Sounds like a plan. Thank you!

silent ether
#

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

plush crane
#

for checkout right, we're just using the payment link

#

do we just append to the url?

silent ether
#

Ahhh, gotcha - in that case there's no way to "pre-fill" the email for Payment Links

plush crane
#

i see.

#

what endpoint would need to hit then to do this?

#

this one?

silent ether
#

Yup! Checkout Sessions offer more customization than Payment Links

plush crane
#

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?

silent ether
#

Unless the price you're using is for metered billing, yes, quantity is required

plush crane
#

what do you mean by metered for billing?

#

does this count as metered for billing?

silent ether
#

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

plush crane
#

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?

silent ether
#

It should be non-editable! (That's what I was testing out in the beginning)

plush crane
#

Looking at the sample response object, which field would correspond to the customer_id?

#

i see id but i also see customer

silent ether
#

If you want a customer ID like cus_xxx it would be under customer. id is referring to the ID of the Checkout Session.

plush crane
#

Great! Thank you so much!

#

i sincerely appreciate the help

plush crane
#

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?

silent ether
#

Where in your dashboard do you have them set?

plush crane
#

it's associated with the payment link

silent ether
#

Do you mind sharing specifically where you set it? Maybe a screenshot? Or a link?

plush crane
#

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

silent ether
#

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