sub scription prooductds
This commit is contained in:
@@ -22,16 +22,20 @@ class StripeIntegration:
|
||||
# payment_method="pm_card_visa", # Replace with a valid payment method ID or attach one later
|
||||
return customer
|
||||
|
||||
def create_product(self, data):
|
||||
# Example of creating a Product and Price
|
||||
product = stripe.Product.create(name="Premium Plan")
|
||||
@staticmethod
|
||||
def create_product(display_name, monthly):
|
||||
logger.info(f"Inside Stripe_Product ===== : {display_name}")
|
||||
product_name = display_name
|
||||
product = stripe.Product.create(name=product_name)
|
||||
price = stripe.Price.create(
|
||||
unit_amount=1000, # Amount in cents (e.g., $10.00)
|
||||
unit_amount=monthly, # Amount in cents (e.g., $10.00)
|
||||
currency="usd",
|
||||
recurring={"interval": "month"},
|
||||
product=product.id,
|
||||
)
|
||||
return {'product_id': product.id, 'price_id': price.id}
|
||||
|
||||
@staticmethod
|
||||
def create_subscription(self, data):
|
||||
subscription = stripe.Subscription.create(
|
||||
customer='customer.id',
|
||||
@@ -40,4 +44,5 @@ class StripeIntegration:
|
||||
],
|
||||
payment_behavior="default_incomplete", # Recommended for handling initial payment
|
||||
expand=["latest_invoice.payment_intent"], # To get details for payment confirmation
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user