DRUO
Get started
Recipes

Accept a one-time payment

Charge a customer once from their bank account, either through a hosted Checkout Link or directly from your server.

Use this recipe for a single purchase, an invoice or a deposit. Pick the hosted option if you don't want to build a payment form; pick the direct option when the customer's account is already connected.

Option A: hosted Checkout Link

  1. 1Get an access token with POST https://auth.druo.com/oauth/token.
  2. 2Create a Checkout Link with POST /checkout/link/create, passing the amount in transaction and a redirect_url.
  3. 3Send the customer to the returned url. They pick their bank, authorize the payment and come back to your redirect_url.
  4. 4Fulfil the order only after the Transaction.successful webhook arrives. Don't rely on the redirect alone.
Node.js — create a Checkout Link
const res = await fetch("https://api.druo.com/checkout/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",
    link_name: "Order NW-10422",
    transaction: {
      amount: 4820,
      currency: "USD",
      description: "Order NW-10422",
      statement_descriptor: "NOVO* NW10422",
    },
    redirect_url: "https://shop.example.com/orders/NW-10422",
    metadata: { order_id: "NW-10422" },
  }),
});
const link = await res.json();
// Redirect the customer to link.url

Option B: charge a connected account

If the customer already connected an account (see the account-on-file recipe), create the payment directly with POST /payments/create and pass the account's uuid as funding_source_id.

Node.js — create a payment
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: "acc_f5f1cd79-5efe-4a21-b516-f586dc9105b7",
    amount: 4820,
    currency: "USD",
    description: "Order NW-10422",
    statement_descriptor: "NOVO* NW10422",
    auto_send_receipt: true,
    primary_reference: "NW-10422",
  }),
}).then((r) => r.json());
// payment.status starts as CREATED or PENDING

Track the result

StatusWhat to do
PENDING / PROCESSINGShow the order as awaiting payment.
SUCCESSFULFulfil the order.
FAILED / CANCELEDAsk the customer to try again; read remarks for the reason.
REFUNDED / REVERSED / DISPUTEDReverse fulfilment or open a review.
To refund later, call PUT /payments/{transaction_uuid}/refund with a reason.