allow_redirects: 'never' — prevents redirect-based payment methods (e.g., 3D Secure). This is necessary for machine-to-machine flows where there is no browser to redirect.
getCardFingerprint(paymentMethodId)
Retrieve the card fingerprint from a Stripe PaymentMethod.
Parameters
Parameter
Type
Description
paymentMethodId
string
Stripe PaymentMethod ID (pm_...).
Returns
Promise<string> — The card fingerprint string. This is consistent per card number within a Stripe account.
Throws
Error — If the PaymentMethod does not have a card fingerprint (e.g., it's not a card-type PaymentMethod).
Stripe API Call
Calls stripe.paymentMethods.retrieve(paymentMethodId) and returns pm.card.fingerprint.
findOrCreateCustomer(clientId, paymentMethodId)
Find an existing Stripe Customer by client ID, or create a new one.
Parameters
Parameter
Type
Description
clientId
string
The HMAC-derived client identifier.
paymentMethodId
string
Stripe PaymentMethod ID to attach to a new customer.
Returns
Promise<Stripe.Customer> — The existing or newly created Stripe Customer.
Behavior
Search: Calls stripe.customers.search() with query metadata["stripe402_client_id"]:"${clientId}"
If found: Returns the first matching customer
If not found: Creates a new customer with:
payment_method: paymentMethodId — attaches the card
metadata: { stripe402_client_id: clientId } — for future lookups
The stripe402_client_id metadata field links Stripe Customers to stripe402 client IDs.