Skip to main content

apps.finances.services.customers

set_default_payment_method

def set_default_payment_method(
customer: djstripe_models.Customer,
payment_method: Union[djstripe_models.PaymentMethod, str])

Customer's default payment method should be set on the invoice_settings field. The

default_payment_method on the customer model is only a convenience for easier filtering; it is populated in the dj-stripe webhook.

Arguments:

  • customer:
  • payment_method:

remove_payment_method

def remove_payment_method(payment_method: djstripe_models.PaymentMethod)

This function needs to be run inside a transaction.

It locks all rows in PaymentMethods table that are related to a customer of a payment method you want to remove. This avoids race conditions when someone wants to quickly remove multiple payment methods.

Arguments:

  • payment_method: