Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Update stripe checkout text #384

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion services/billing.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ def create_checkout_session(self, owner: Owner, desired_plan):
customer = owner.stripe_customer_id
customer_email = None

new_plan = settings.STRIPE_PLAN_IDS[desired_plan["value"]]

session = stripe.checkout.Session.create(
billing_address_collection="required",
payment_method_types=["card"],
Expand All @@ -379,7 +381,7 @@ def create_checkout_session(self, owner: Owner, desired_plan):
subscription_data={
"items": [
{
"plan": settings.STRIPE_PLAN_IDS[desired_plan["value"]],
"plan": self.format_plan_value(new_plan),
"quantity": desired_plan["quantity"],
}
],
Expand All @@ -391,6 +393,9 @@ def create_checkout_session(self, owner: Owner, desired_plan):
f"Stripe Checkout Session created successfully for owner {owner.ownerid} by user #{self.requesting_user.ownerid}"
)
return session["id"]

def format_plan_value(self, plan_value):
return plan_value[:-1] + '-' + plan_value[-1]

@_log_stripe_error
def update_payment_method(self, owner, payment_method):
Expand Down
Loading