From 4a7fe21ec2b5b93734a4f6d0e1736292629248c8 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 17 Oct 2024 17:25:48 +0100 Subject: Update Stripe and include the API key --- alphabetlearning/payments/models.py | 3 +++ alphabetlearning/payments/views.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'alphabetlearning') diff --git a/alphabetlearning/payments/models.py b/alphabetlearning/payments/models.py index 80d93c2..62bcbde 100644 --- a/alphabetlearning/payments/models.py +++ b/alphabetlearning/payments/models.py @@ -9,6 +9,9 @@ class Product(models.Model): name = models.CharField(max_length=255) stripe_product_id = models.CharField(max_length=100) + def __str__(self): + return self.name + class Price(models.Model): product = models.ForeignKey(Product, on_delete=models.CASCADE) diff --git a/alphabetlearning/payments/views.py b/alphabetlearning/payments/views.py index 8337177..ca81d86 100644 --- a/alphabetlearning/payments/views.py +++ b/alphabetlearning/payments/views.py @@ -15,6 +15,7 @@ from .models import Price from .models import Product from .models import ShoppingCart + stripe.api_key = settings.STRIPE_SECRET_KEY @@ -31,8 +32,8 @@ class CreateCheckoutSessionView(View): }, ], mode="payment", - success_url=domain + "payments/success/", - cancel_url=domain + "payments/cancel/", + success_url=domain + "/payments/success/", + cancel_url=domain + "/payments/cancel/", ) return redirect(checkout_session.url, code=303) -- cgit v1.2.3