dj-stripe / dj-stripe

dj-stripe automatically syncs your Stripe Data to your local database as pre-implemented Django Models allowing you to use the Django ORM, in your code, to work with the data making it easier and faster.
https://dj-stripe.dev
MIT License
1.56k stars 474 forks source link

feat: introduce PaymentMethod.last4 property and add last4 to __str__ #2018

Closed PabloCastellano closed 4 months ago

PabloCastellano commented 5 months ago

This PR adds a new property to retrieve the last 4 digits of a payment method. This is very convenient when associating a payment method in a ForeignKey attribute from the admin dashboard. Otherwise when there are multiple Payment methods associated to a customer, you never know which one you are choosing.

Before:

image

After:

image