implementing stripe subscription

This commit is contained in:
rizwanisready
2024-07-29 11:41:49 +05:30
parent 53a572c19e
commit cdf9d06e8c

View File

@@ -542,21 +542,23 @@ def create_checkout_session(request):
# customer=customer.id, # Optional: Link the session to the Stripe customer created above
line_items=[
{
"price_data": {
"currency": "gbp",
"product_data": {
"name": subscription.title, # Adjust with your subscription/product name
},
"unit_amount": int(
final_amount * 100
), # Unit amount in cents/pence
"tax_behavior": "inclusive", # or 'exclusive', based on your tax settings
},
"price": "price_1PgkAUCesU6kunsI0AwDONty",
# "price_data": {
# "currency": "gbp",
# "product_data": {
# "name": subscription.title, # Adjust with your subscription/product name
# },
# "unit_amount": int(
# final_amount * 100
# ), # Unit amount in cents/pence
# "tax_behavior": "inclusive", # or 'exclusive', based on your tax settings
# },
"quantity": 1,
}
],
# allow_promotion_codes=True,
mode="payment",
# mode="payment",
mode="subscription",
# discounts=[{"coupon": "VLMAsicx"}],
success_url=request.build_absolute_uri("/subscriptions/success/"),
cancel_url=request.build_absolute_uri("/subscriptions/cancel/"),