#2clutch - checkout session
1 messages ยท Page 1 of 1 (latest)
Hey there can you share that API request? https://stripe.com/docs/api/request_ids
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
or event ID
cs_test_a1IT7ANxUoqj8eg8XNltEVdcj07ZwQYcim5vfluRm6f4TRDh7cqocajLzT
the url returned reflect the right pricing: https://checkout.stripe.com/pay/cs_test_a1IT7ANxUoqj8eg8XNltEVdcj07ZwQYcim5vfluRm6f4TRDh7cqocajLzT#fidkdWxOYHwnPyd1blpxYHZxWjA0TF1zXzdPQz1qUjV0QjB2MGhNfGFWSkI3ME1yQXU9PV9pYlxyRH1df05hZGhsdl1Uf0pEc2BSR2YxVXVdbE5oa2BjPW58Vkgyd39BMUtUZ05ca2EzNGZqNTV3aERiTGZQUScpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl
{
"id": "cs_test_a1IT7ANxUoqj8eg8XNltEVdcj07ZwQYcim5vfluRm6f4TRDh7cqocajLzT",
"object": "checkout.session",
"after_expiration": null,
"allow_promotion_codes": null,
"amount_subtotal": 5000,
"amount_total": 5000,
"automatic_tax": {
"enabled": false,
"status": null
},
but as you can above, amount in the request response reads 5000 when it should be reading 50
Stripe's amount units are in the smallest unit for the currency, so in USD that is in cents, not dollars
If you look up the request that create that price, you'll find it has unit_amount=5000 too: https://dashboard.stripe.com/test/logs/req_DTyekJicu1ikJS
in USD that means $50.00
This thread has been archived. If you need help with anything else please ask in #dev-help or contact Stripe Support: https://support.stripe.com/contact
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
๐ What's the question you still need answered?
customer is empty and my understanding is that it's supposed to have the customer_id
what am i misunderstanding about the flow?
"billing_address_collection": null,
"cancel_url": "https://www.google.com/",
"client_reference_id": null,
"consent": null,
"consent_collection": null,
"currency": "usd",
"customer": null,
"customer_creation": "always",
"customer_details": {
"email": "test@vitelhealth.com",
"phone": null,
"tax_exempt": null,
"tax_ids": null
},
to give you context of what i'm talking about
Where are you getting back the null customer? Right after creating the Checkout Session? Or after retrieving the Customer Session after it's been compelted?
this is right after creating the session
Are you passing in a customer when you create the Checkout Session? If not, then getting a null customer right after creation is expected. The customer won't be created until they've actually completed the checkout flow
what would be the most efficient way to retrieve the customer_id right after the checkout flow has been successfully completed?
If you're listening for the checkout.session.completed event, customer should be populated on the Checkout Session returned there. If you're relying on being redirected to the success URL you'd simply retrieve the Checkout Session after being redirected and get it from there
do you mind rephrasing the second option?
sounds like the first option would be to setup a webhook?
After a Checkout Session is successfully completed the customer will be redirected to the success URL you passed in during creation. This should be a page on your site, and you can build something into your integration so that when a user hits that success page you retrieve the Checkout Session (we go into detail about that here https://stripe.com/docs/payments/checkout/custom-success-page)
session = stripe.checkout.Session.create(
success_url="http://yoursite.com/order/success",
success_url="http://yoursite.com/order/success?session_id={CHECKOUT_SESSION_ID}",
# other options...,
)
for the snippet above, why do i need to pass 2 urls?
You should only be passing one - the doc I sent over had one highlighted in red, and the other in green to indicate you delete the first line and replace it with the second
i see
i'm confused about the transition from step 1 to step 2
step 2 being the success page.
since the transaction is being handled by stripe, how do i pickup that the transaction has been succesful?
conceptually
You'd only be redirected t your success page if the transaction is succesful, and from there you can re-retrieve the Checkout Session to double check it has a successful status
okay.
can you please this open the weekend? i'll run some tests and if i have follow up questions, i'll add them and you can get back to me on Monday.
would that work?
I'm going to be locking this thread when I leave for the day, but you're welcome to come back Monday and ask us to reopen - we don't leave threads open here if there's no one online on our end to actively be helping