stripe session
This commit is contained in:
@@ -47,9 +47,10 @@ class StripeIntegration:
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def create_checkout_session_subscription(price_id):
|
||||
def create_checkout_session_subscription(price_id, customer_id):
|
||||
try:
|
||||
checkout_session = stripe.checkout.Session.create(
|
||||
customer=customer_id, # Pass the existing customer ID here
|
||||
line_items=[
|
||||
{
|
||||
'price': price_id, # Use a pre-defined Stripe Price ID
|
||||
@@ -57,10 +58,10 @@ class StripeIntegration:
|
||||
},
|
||||
],
|
||||
mode='subscription',
|
||||
success_url='https://example.com/success?session_id={CHECKOUT_SESSION_ID}',
|
||||
cancel_url='https://example.com/cancel',
|
||||
success_url='https://qa-panel.mermsemr.com/subscription-success?session_id={CHECKOUT_SESSION_ID}',
|
||||
cancel_url='https://qa-panel.mermsemr.com/subscription',
|
||||
)
|
||||
return checkout_session.url
|
||||
return checkout_session
|
||||
except stripe.error.StripeError as e:
|
||||
print(f"Error creating subscription Checkout Session: {e}")
|
||||
return None
|
||||
Reference in New Issue
Block a user