Skip to content

Update payment handling data model#690

Draft
mitchelljkotler wants to merge 22 commits into
masterfrom
update-payment-handling-data-model
Draft

Update payment handling data model#690
mitchelljkotler wants to merge 22 commits into
masterfrom
update-payment-handling-data-model

Conversation

@mitchelljkotler

@mitchelljkotler mitchelljkotler commented May 27, 2026

Copy link
Copy Markdown
Member

This caches stripe data locally, to avoid needing to go to the Stripe API whenever that data is needed.
What's being cached:
Customer │ payment_brand, payment_last4, payment_exp_month, payment_exp_year, stripe_payment_method_id
Subscription │ stripe_status, current_period_end
Invoice │ hosted_invoice_url

The data is updated when Stripe sends webhooks for these models.

Testing - can test general payment related functionality and ensure everything displays as expected.

@allanlasser
allanlasser temporarily deployed to squarelet-pi-update-pay-git7s7 May 27, 2026 20:40 Inactive
@mitchelljkotler
mitchelljkotler temporarily deployed to squarelet-pi-update-pay-git7s7 May 27, 2026 21:07 Inactive
@allanlasser allanlasser linked an issue Jun 1, 2026 that may be closed by this pull request
@mitchelljkotler
mitchelljkotler force-pushed the update-payment-handling-payment-intents branch from cfed298 to 005478b Compare June 2, 2026 19:47
Comment on lines +52 to +59
card_brand = models.CharField(max_length=20, blank=True, default="")
card_last4 = models.CharField(max_length=4, blank=True, default="")
card_exp_month = models.PositiveSmallIntegerField(null=True, blank=True)
card_exp_year = models.PositiveSmallIntegerField(null=True, blank=True)
stripe_payment_method_id = models.CharField(
max_length=255, blank=True, default=""
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's break this out into its own table, so that we can support multiple cards for customers. This seems worth the performance tradeoff for the additional JOIN.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with breaking this out into its own table, but will do that in a follow up PR

Comment thread requirements/base.txt
# django-request-token
stack-data==0.3.0
# via ipython
stripe==15.0.0

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current Stripe library is v15.2.1, is there a reason to lock to 15.0.0?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think 15.0.0 was the latest when I did the update - I am not going to update for every point release. This is now in our tracker for things to update, so we will update it regularly.

@mitchelljkotler
mitchelljkotler changed the base branch from update-payment-handling-payment-intents to master June 25, 2026 20:04
@mitchelljkotler
mitchelljkotler force-pushed the update-payment-handling-data-model branch from e6feff0 to aabf61e Compare July 16, 2026 15:34
@eyeseast

Copy link
Copy Markdown
Collaborator

Got a 404 on plan detail, here locally: https://dev.squarelet.com/plans/2-professional/. It links to the organization, even if I'm paying as an individual. (This may already be happening in production, but if so, we should fix it here.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redo Stripe data model

3 participants