CustomerAdapter

interface CustomerAdapter

A bridge to your backend to fetch customer-related information. Typically, you will not need to implement this interface yourself. You should instead use CustomerAdapter.create, which manages retrieving and updating a Stripe customer for you.

The methods in this interface should act on a Stripe Customer object.

Implement this interface if you would prefer retrieving and updating your Stripe customer object via your own backend instead of using the default implementation.

Use CustomerAdapter.create to create an instance of a CustomerAdapter.

Types

Link copied to clipboard
object Companion
Link copied to clipboard
sealed class PaymentOption

A representation of a saved payment method, used for persisting the user's default payment method.

Link copied to clipboard
sealed class Result<T>

Properties

Link copied to clipboard

Whether this backend adapter is able to create setup intents. A SetupIntent is recommended when attaching a new card to a Customer, and required for non-card payments methods. If you are implementing your own CustomerAdapter, return true if setupIntentClientSecretForCustomerAttach is implemented, Otherwise, return false.

Link copied to clipboard

A list of payment method types to display to the customer. Valid values include: "card", "us_bank_account" If null or empty, the SDK will dynamically determine the payment methods using your Stripe Dashboard settings.

Functions

Link copied to clipboard
abstract suspend fun attachPaymentMethod(paymentMethodId: String): CustomerAdapter.Result<PaymentMethod>

Attaches a payment method to a customer

Link copied to clipboard
abstract suspend fun detachPaymentMethod(paymentMethodId: String): CustomerAdapter.Result<PaymentMethod>

Detaches the given payment method from a customer

Link copied to clipboard

Retrieves a list of payment methods attached to a customer

Link copied to clipboard

Retrieve the saved payment method option from a data store. If null, the customer does not have a default saved payment method.

Link copied to clipboard

Saves the payment option to a data store.

Link copied to clipboard

Returns a SetupIntent client secret to attach a new payment method to a customer. This will call your backend to retrieve a client secret if you have provided a setupIntentClientSecretProvider in the CustomerAdapter.create call.

Link copied to clipboard

Updates a payment method with the provided PaymentMethodUpdateParams.