#Adaman

1 messages · Page 1 of 1 (latest)

cunning sealBOT
unreal trout
#

checkout_session = stripe.checkout.Session.create(
customer_email=email,
line_items=[{'price_data': {'unit_amount': 1000, 'currency': 'gbp', 'product_data': {'name': 'Listing Fee - 1988 Herrera, Vasquez and Fitzpatrick high'}}, 'quantity': 1}, {'price_data': {'unit_amount': 100, 'currency': 'gbp', 'product_data': {'name': 'Search Boost Upgrade'}}, 'quantity': 1}],
metadata={
'payment_id': payment.id,
},
mode='payment',
payment_intent_data={
'metadata': {
'payment_id': payment.id
}
},
success_url=get_full_url(request, reverse('confirm_payment_successful_view', args=[car.id, payment.id])),
cancel_url=get_full_url(request, reverse('delete-car-return-to-listing-view', args=[car.id]))
)

Hi @civic barn Long story short this is an example of how I'm generating a checkout session (the line items are generated dynamically so these are just examples). When I get to the checkout page itself however, only one of the line items counts towards the total, the other is set to 0.

civic barn
#

can you provide an example Checkout Session ID or a request ID?

unreal trout
#

how do you mean sorry?

#

is there a way I can get that from the url?

civic barn
#

Each Checkout Session is assigned an ID. If you're in live mode, it'll look like cs_live...; if you're in test mode, it'll look like cs_test...

unreal trout
#

cs_test_b1yMPNxGH152VlJPypxm9sIGDfXttbNhCWQjbT3e61oW4u08DNxTHNfxzT could this be it?

#

should have the same line items as the screenshot I sent you

civic barn
#

Okay, I see we received a unit_amount of 0 for "Listing Fee - 1989 Anziel 39" 🤔

unreal trout
#

Ok I am an idiot

#

I just checked and apparently I kept my edit code that always passes a 0 for that the same as my code that I'm meant to be using for this 🤦‍♂️

#

Sorry about that

civic barn
#

All good, no worries!

unreal trout
#

Amazing what a second pair of eyes does for you

civic barn
#

Glad you found the culprit

unreal trout
#

Thanks mate, while I've got you quick can I ask another quick question?

civic barn
#

sure!

unreal trout
#

Promise this one doesn't involve my own gremlins

#

Is there an easy way of closing a checkout session from the API?

civic barn
unreal trout
#

Ahh so I'm guessing in that case it would just return an error?

civic barn
#

that's right

unreal trout
#

Perfect. Thanks so much mate.

#

Have a great evening.

civic barn
#

you too!

unreal trout
#

thanks