I am using stripe with django and I want to pass some information I received from the checkout session to success page.
After reading the documentation https://stripe.com/docs/payments/checkout/custom-success-page#modify-success-url I modified success url to
MY_DOMAIN = 'http://127.0.0.1:8000/orders'
success_url=MY_DOMAIN + '/success?session_id={CHECKOUT_SESSION_ID}',
cancel_url=YOUR_DOMAIN + '/cancel/',
metadata={
"price_id": price_id,
}
)
def Success(request):
session = stripe.checkout.Session.retrieve('session_id')
return render(request, 'orders/success.html')
But this gives me an error:
Invalid checkout.session id: session_id
If I manually put instead of "session_id" the actual id that is printed in the url everything works fine.
So my question is what should I write instead of 'session_id' in order to retrieve the session?