djstripe.models.base

IdempotencyKey

Bases: models.Model

action

attribute  action

created

attribute  created

is_expired

property  is_expired: bool

livemode

attribute  livemode

uuid

attribute  uuid

StripeBaseModel

Bases: models.Model

djstripe_created

attribute  djstripe_created

djstripe_updated

attribute  djstripe_updated

stripe_class

attribute  stripe_class: type[APIResource]

stripe_data

attribute  stripe_data

api_list

api_list(cls, api_key = djstripe_settings.STRIPE_SECRET_KEY, **kwargs)

Call the stripe API's list operation for this model.

:param api_key: The api key to use for this request. Defaults to djstripe_settings.STRIPE_SECRET_KEY. :type api_key: string

See Stripe documentation for accepted kwargs for each object.

:returns: an iterator over all items in the query

get_expand_params

get_expand_params(cls, api_key, **kwargs)

Populate expand kwarg in stripe api calls by updating the kwargs passed.

StripeModel

Bases: StripeBaseModel

created

attribute  created

default_api_key

property  default_api_key: str

description

property  description: str

djstripe_id

attribute  djstripe_id

djstripe_owner_account

attribute  djstripe_owner_account: StripeForeignKey | None

expand_fields

attribute  expand_fields: list[str]

id

attribute  id

livemode

attribute  livemode

metadata

attribute  metadata

objects

attribute  objects

stripe_dashboard_item_name

attribute  stripe_dashboard_item_name

stripe_objects

attribute  stripe_objects

api_retrieve

api_retrieve(self, api_key = None, stripe_account = None)

Call the stripe API's retrieve operation for this model.

:param api_key: The api key to use for this request. Defaults to djstripe_settings.STRIPE_SECRET_KEY. :type api_key: string :param stripe_account: The optional connected account for which this request is being made. :type stripe_account: string

get_stripe_dashboard_url

get_stripe_dashboard_url(self) -> str

Get the stripe dashboard url for this object.

is_valid_object

is_valid_object(cls, data)

Returns whether the data is a valid object for the class

sync_from_stripe_data

sync_from_stripe_data(cls, data, api_key = None)

Syncs this object from the stripe data provided.

Foreign keys will also be retrieved and synced recursively.

:param data: stripe object :type data: dict :rtype: cls