(self, api_key=None)
return 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
Call the stripe API's retrieve operation for this model.
Call the stripe API s retrieve operation for this model .
def _get_stripe_account_id(self, api_key=None) -> Optional[str]:
        """
        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
        """
        api_key = api_key or self.default_api_key

        try:
            djstripe_owner_account = self.djstripe_owner_account
            if djstripe_owner_account is not None:
                return djstripe_owner_account.id
        except (AttributeError, KeyError, ValueError):
            pass

        # Get reverse foreign key relations to Account in case we need to
        # retrieve ourselves using that Account ID.
        reverse_account_relations = (
            field
            for field in self._meta.get_fields(include_parents=True)
            if field.is_relation and field.one_to_many
            # Avoid circular import problems by using the app registry to
            # get the model class rather than a direct import.
            and field.related_model
            is apps.get_model(app_label="djstripe", model_name="account")
        )

        # Handle case where we have a reverse relation to Account and should pass
        # that account ID to the retrieve call.
        for field in reverse_account_relations:
            # Grab the related object, using the first one we find.
            reverse_lookup_attr = field.get_accessor_name()
            account = getattr(self, reverse_lookup_attr).first()

            if account is not None:
                return account.id

        return None
def _get_stripe_account_id ( self , api_key = None ) -> Optional [ str ] : api_key = api_key or self . default_api_key try : djstripe_owner_account = self . djstripe_owner_account if djstripe_owner_account is not None : return djstripe_owner_account . id except ( AttributeError , KeyError , ValueError ) : pass # Get reverse foreign key relations to Account in case we need to # retrieve ourselves using that Account ID. reverse_account_relations = ( field for field in self . _meta . get_fields ( include_parents = True ) if field . is_relation and field . one_to_many # Avoid circular import problems by using the app registry to # get the model class rather than a direct import. and field . related_model is apps . get_model ( app_label = "djstripe" , model_name = "account" ) ) # Handle case where we have a reverse relation to Account and should pass # that account ID to the retrieve call. for field in reverse_account_relations : # Grab the related object, using the first one we find. reverse_lookup_attr = field . get_accessor_name ( ) account = getattr ( self , reverse_lookup_attr ) . first ( ) if account is not None : return account . id return None