Recipes
Save an account for future payments
Connect a customer's bank account once, then charge it whenever they buy again without asking for bank details.
Account-on-file payments give returning customers one-click checkout. The customer connects their account once; you store only the account uuid and charge it later with their authorization.
1. Connect the account
- 1Create a Connect Link with POST /connect/link/create for a new or existing End User.
- 2Send the customer to the returned url. They choose their bank and authorize DRUO to link the account.
- 3Wait for the
Account.connectedwebhook, then save the account uuid against your customer record.
Node.js — create a Connect Link
const link = await fetch("https://api.druo.com/connect/link/create", {
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
"DRUO-Version": "2021-11-22",
"Content-Type": "application/json",
},
body: JSON.stringify({
existing_end_user_id: "eur_422f0f81-5001-4cce-a229-242d9ab9960a",
intro_text: "Connect your bank to pay faster next time.",
redirect_url: "https://shop.example.com/account/payment-methods",
primary_reference: "cus_merchant_771",
}),
}).then((r) => r.json());
// Redirect the customer to link.url2. Charge the saved account
When the customer buys again, call POST /payments/create with the saved account uuid as funding_source_id. Check that the account status is still CONNECTED first with GET /accounts/{account_uuid}.
Node.js — charge the account on file
const account = await fetch(`https://api.druo.com/accounts/${savedAccountUuid}`, {
headers: { Authorization: `Bearer ${accessToken}`, "DRUO-Version": "2021-11-22" },
}).then((r) => r.json());
if (account.status !== "CONNECTED") {
// Ask the customer to reconnect with a new Connect Link
}
const payment = await fetch("https://api.druo.com/payments/create", {
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
"DRUO-Version": "2021-11-22",
"Content-Type": "application/json",
},
body: JSON.stringify({
tenant_id: "ten_35516d40-ca41-4fa3-885c-d13d0ccdae0a",
funding_source_id: savedAccountUuid,
amount: 1599,
currency: "USD",
description: "Order NW-10588",
statement_descriptor: "NOVO* NW10588",
auto_send_receipt: true,
}),
}).then((r) => r.json());3. Let customers remove it
Offer a way to remove a saved account. Call PUT /accounts/{account_uuid}/disconnect with disconnection_reason set to END_USER_REQUESTED, then delete the uuid from your records.
Prefer an embedded experience? DRUO Components can save the account during checkout and offer express one-tap buttons on later visits.

