sub scription prooductds

This commit is contained in:
CHIEFSOFT\ameye
2025-08-23 13:39:38 -04:00
parent e53abb288a
commit da1724c671
6 changed files with 86 additions and 11 deletions
+10 -5
View File
@@ -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
)
)