PaymentMethods: retrieve, attach to and detach from customers, update, and list. Payment methods are usually created client-side with Stripe.js (or saved with a SetupIntent) and then attached server-side. See https://docs.stripe.com/api/payment_methods.
Functions
attach-payment-method
fn (payment-method: Str, customer: Str): Map
fn (payment-method: Str, customer: Str, options: ::stripe::api/RequestOptions | Map): Map
POST /v1/payment_methods/{payment_method}/attach - Attach a PaymentMethod to a customer. Prefer saving cards with a SetupIntent (::stripe::setup-intents), which also handles authentication; attaching directly skips it. Set the customer's default with update-customer(..., {invoice_settings: {default_payment_method}}).
Example
::pm ::stripe::payment-methods
::pm/attach-payment-method("pm_...", "cus_...")
detach-payment-method
fn (payment-method: Str): Map
fn (payment-method: Str, options: ::stripe::api/RequestOptions | Map): Map
POST /v1/payment_methods/{payment_method}/detach - Detach a PaymentMethod from its customer. The PaymentMethod cannot be used for payments afterwards.
get-payment-method
fn (payment-method: Str): Map
fn (payment-method: Str, opts: Map): Map
GET /v1/payment_methods/{payment_method} - Retrieve a PaymentMethod by ID.
list-payment-methods
fn (customer: Str): Map
fn (customer: Str, request: ListPaymentMethodsRequest): Map
fn (customer: Str, request: ListPaymentMethodsRequest, opts: Map): Map
GET /v1/customers/{customer}/payment_methods - List a customer's PaymentMethods. Optionally filter by type (e.g. "card").
update-payment-method
fn (payment-method: Str, request: UpdatePaymentMethodRequest): Map
fn (payment-method: Str, request: UpdatePaymentMethodRequest, options: ::stripe::api/RequestOptions | Map): Map
POST /v1/payment_methods/{payment_method} - Update a PaymentMethod attached to a customer. card accepts exp_month/exp_year updates; allow_redisplay is "always", "limited", or "unspecified".
Types
ListPaymentMethodsRequest
ListPaymentMethodsRequest type {
type: Str?,
allow_redisplay: Str?,
limit: Int?,
starting_after: Str?,
ending_before: Str?,
expand: Vec<Str>?
}
UpdatePaymentMethodRequest
UpdatePaymentMethodRequest type {
billing_details: Map?,
card: Map?,
metadata: Map?,
allow_redisplay: Str?,
expand: Vec<Str>?
}