我正在尝试在Django的网页中集成条纹签出。我已经创建了以下的结帐会话:
try:
checkout_session = stripe.checkout.Session.create(
success_url=settings.WEB_DOMAIN + 'payment/success?session_id={CHECKOUT_SESSION_ID}',
cancel_url=settings.WEB_DOMAIN+'payment/cancelled',
payment_method_types=['card'],
mode='payment',
line_items=[
{
'name': name,
'images':image_link,
'quantity': 1,
'currency': 'usd',
'amount': price,
}
]
)
# i tried to update my database from here but evenif the payment fails database gets updated.
return JsonResponse({'sessionId': checkout_session['id']})
except Exception as e:
return JsonResponse({'error': str(e)})
结帐工作正常,但是付款后我不知道在哪里更新数据库中的某些值。如果对此有所了解,请给我一些建议。