djstripe.models.payment_methods
BankAccount
Bases: ExternalAccountMixin, StripeModel
External Accounts are transfer destinations on Account objects for Custom accounts. They can be bank accounts or debit cards.
Stripe documentation: https://stripe.com/docs/api/external_account_bank_accounts
account
attribute account
account_holder_name
property account_holder_name
account_holder_type
property account_holder_type
bank_name
property bank_name
country
property country
currency
property currency
default_for_currency
property default_for_currency
fingerprint
attribute fingerprint
human_readable_status
property human_readable_status
last4
property last4
routing_number
property routing_number
status
property status
stripe_class
attribute stripe_class
api_retrieve
api_retrieve(self, **kwargs)
Card
Bases: ExternalAccountMixin, StripeModel
Cards are external accounts (debit cards) on Stripe Custom Connected Accounts, used as "Payout Sources".
Stripe documentation: https://stripe.com/docs/api/external_account_cards
account
attribute account
address_city
property address_city
address_country
property address_country
address_line1
property address_line1
address_line1_check
property address_line1_check
address_line2
property address_line2
address_state
property address_state
address_zip
property address_zip
address_zip_check
property address_zip_check
brand
property brand
country
property country
cvc_check
property cvc_check
default_for_currency
property default_for_currency
dynamic_last4
property dynamic_last4
exp_month
property exp_month
exp_year
property exp_year
fingerprint
attribute fingerprint
funding
property funding
last4
property last4
name
property name
stripe_class
attribute stripe_class
tokenization_method
property tokenization_method
create_token
create_token(cls, number: str, exp_month: int, exp_year: int, cvc: str, api_key: str = djstripe_settings.STRIPE_SECRET_KEY, **kwargs) -> stripe.Token
Creates a single use token that wraps the details of a credit card. This token can be used in place of a credit card dictionary with any API method. These tokens can only be used once: by creating a new charge object, or attaching them to a customer. (Source: https://stripe.com/docs/api?lang=python#create_card_token)
:param number: The card number without any separators (no spaces) :param exp_month: The card's expiration month. (two digits) :param exp_year: The card's expiration year. (four digits) :param cvc: Card security code. :param api_key: The API key to use
DjstripePaymentMethod
Bases: models.Model
An internal model that abstracts the legacy Card and BankAccount objects.
Contains two fields: id and type:
idis the id of the Stripe object.typecan becard,bank_accountoraccount.
id
attribute id
object_model
property object_model
type
attribute type
from_stripe_object
from_stripe_object(cls, data)
resolve
resolve(self)
ExternalAccountMixin
Mixin for functionality shared between the Card & BankAccount external accounts of Stripe Connected Accounts.
account
attribute account: Account | None
default_api_key
attribute default_api_key: str
id
attribute id: str
api_list
api_list(cls, api_key = djstripe_settings.STRIPE_SECRET_KEY, **kwargs)
api_retrieve
api_retrieve(self, api_key = None, stripe_account = None)
get_stripe_dashboard_url
get_stripe_dashboard_url(self) -> str
PaymentMethod
Bases: StripeModel
PaymentMethod objects represent your customer's payment instruments. You can use them with PaymentIntents to collect payments or save them to Customer objects to store instrument details for future payments.
Stripe documentation: https://stripe.com/docs/api?lang=python#payment_methods
billing_details
property billing_details
customer
attribute customer
stripe_class
attribute stripe_class
type
property type
attach
attach(cls, payment_method: Union[str, PaymentMethod], customer: str | Customer, api_key: str = djstripe_settings.STRIPE_SECRET_KEY) -> PaymentMethod
Attach a payment method to a customer
detach
detach(self)
Detach the payment method from its customer.
:return: Returns true if the payment method was newly detached, false if it was already detached :rtype: bool
get_stripe_dashboard_url
get_stripe_dashboard_url(self) -> str