# Customer recipes

Pay a supplier end to end, upload a bulk file, schedule a payment, exchange currency and fetch a statement.

Each recipe runs against the sandbox with a `wb_test_` key and the variables of the [walkthrough](/docs/customer-walkthrough). Every money-moving POST carries an `Idempotency-Key`; reuse the same key when you retry ([Idempotency](/docs/idempotency)).

```sh
export WIREBLOOM_API_URL=https://api.staging.banking.wirebloom.com/v1
auth=(-H "Authorization: Bearer $WIREBLOOM_API_KEY" -H "X-Tenant-Id: $WIREBLOOM_CUSTOMER_ID")
json=(-H "Content-Type: application/json")
```

## Pay a supplier: recipient, verification, payment, webhook, statement

Scopes: `recipients:write`, `payments:write`, `webhooks:manage`, `statements:read`.

1. Look up the bank fields the currency needs with [getRecipientRequirements](/reference/recipients#getRecipientRequirements), then create the recipient with [createRecipient](/reference/recipients#createRecipient):

```sh
curl -X POST "$WIREBLOOM_API_URL/recipients" "${auth[@]}" "${json[@]}" \
  -H "Idempotency-Key: supplier-acme-gbp" \
  -d '{ "type": "company", "name": "Acme Supplies Ltd", "currency": "GBP",
        "bank": { "accountNumber": "31926819", "routingCodes": { "sortCode": "601613" } } }'
```

2. Check the account holder name with [verifyRecipient](/reference/recipients#verifyRecipient) (Confirmation of Payee for GBP, Verification of Payee for EUR). In the sandbox a name containing `NOMATCH`, `CLOSE` or `UNAVAILABLE` gives that outcome; anything else matches. Other currencies answer `422` `verification-unavailable`.

```sh
curl -X POST "$WIREBLOOM_API_URL/recipients/<recipient id>/verify" "${auth[@]}"
```

3. Pay it with [createPayment](/reference/payments#createPayment). A payment can wait in `pending_approval` for a person; a key never approves.

```sh
curl -X POST "$WIREBLOOM_API_URL/payments" "${auth[@]}" "${json[@]}" \
  -H "Idempotency-Key: invoice-4711" \
  -d '{ "sourceBalanceId": "<GBP balance id>", "recipientId": "<recipient id>",
        "amount": { "amountMinor": "250000", "currency": "GBP" },
        "reference": "INV-4711", "submit": true }'
```

4. Follow it by webhook rather than polling: subscribe to `payment.status_changed` ([Webhooks](/docs/webhooks)). Each delivery is a hint; re-read the payment with [getPayment](/reference/payments#getPayment) before acting on money. A PDF confirmation is available from [getPaymentConfirmation](/reference/payments#getPaymentConfirmation).

5. At month end request a statement with [requestStatement](/reference/accounts#requestStatement) (`202`, a job), list with [listStatements](/reference/accounts#listStatements) and download with [downloadStatement](/reference/accounts#downloadStatement):

```sh
curl -X POST "$WIREBLOOM_API_URL/balances/<balance id>/statements" "${auth[@]}" "${json[@]}" \
  -d '{ "periodStart": "2026-10-01", "periodEnd": "2026-10-31", "format": "pdf" }'
```

## Bulk payments from a file

Scopes: `documents:write`, `payments:write`, `payments:read`.

1. Upload the CSV as a document of kind `bulk_payments` ([uploadDocument](/reference/activity#uploadDocument)), `PUT` the bytes to `upload.url`, then [completeDocumentUpload](/reference/activity#completeDocumentUpload). Wait for the document status `clean`.
2. Create the batch with [createBulkPayment](/reference/payments#createBulkPayment) (`template` `wirebloom_csv_v1`, the same file the web app accepts):

```sh
curl -X POST "$WIREBLOOM_API_URL/bulk-payments" "${auth[@]}" "${json[@]}" \
  -H "Idempotency-Key: payroll-2026-11" \
  -d '{ "documentId": "<document id>", "sourceBalanceId": "<balance id>", "template": "wirebloom_csv_v1" }'
```

3. Review the parsed rows with [listBulkPaymentRows](/reference/payments#listBulkPaymentRows), then [submitBulkPayment](/reference/payments#submitBulkPayment). Submitting answers `202` with a job (`Location: /v1/jobs/{jobId}`); every valid row becomes a payment. When the total falls in an approval tier the batch waits for a person.

## Scheduled payments

Scope: `payments:write`. A schedule is a payment template plus an iCalendar `rrule`. Preview the dates first with [previewScheduledPayment](/reference/payments#previewScheduledPayment), then create it with [createScheduledPayment](/reference/payments#createScheduledPayment):

```sh
curl -X POST "$WIREBLOOM_API_URL/scheduled-payments" "${auth[@]}" "${json[@]}" \
  -H "Idempotency-Key: rent-hq" \
  -d '{ "name": "Office rent",
        "template": { "sourceBalanceId": "<balance id>", "recipientId": "<recipient id>",
                      "amount": { "amountMinor": "450000", "currency": "EUR" }, "reference": "Rent HQ" },
        "schedule": { "rrule": "FREQ=MONTHLY;BYMONTHDAY=1", "startDate": "2026-12-01" } }'
```

Pause and resume with [deactivateScheduledPayment](/reference/payments#deactivateScheduledPayment) and [activateScheduledPayment](/reference/payments#activateScheduledPayment). In the sandbox, [simulateScheduledRun](/reference/simulations#simulateScheduledRun) makes the next occurrence due now.

## Exchange currency: quote, then execute

Scopes: `exchanges:write`, `exchanges:read`.

1. Ask for a quote with [createQuote](/reference/payments#createQuote). `fixedSide` says which amount is fixed:

```sh
curl -X POST "$WIREBLOOM_API_URL/exchanges/quotes" "${auth[@]}" "${json[@]}" \
  -d '{ "sellCurrency": "EUR", "buyCurrency": "USD", "fixedSide": "sell",
        "amount": { "amountMinor": "1000000", "currency": "EUR" } }'
```

2. Execute it before it expires with [createExchange](/reference/payments#createExchange); refresh an expired quote with [refreshQuote](/reference/payments#refreshQuote). Exchanges follow the account's approval policies.

```sh
curl -X POST "$WIREBLOOM_API_URL/exchanges" "${auth[@]}" "${json[@]}" \
  -H "Idempotency-Key: fx-2026-11-18-01" \
  -d '{ "quoteId": "<quote id>", "sellBalanceId": "<EUR balance id>", "buyBalanceId": "<USD balance id>" }'
```

The sandbox uses fixed fictional rates per EUR (GBP 0.85, USD 1.1, CHF 0.95, and more); [simulateFxRateMove](/reference/simulations#simulateFxRateMove) moves a pair. `exchange.completed` arrives by webhook.

## Reconcile with transactions

[listTransactions](/reference/activity#listTransactions) (`transactions:read`) pages through every movement; label them for your ledger with [createAnnotation](/reference/activity#createAnnotation) (`transactions:write`). Large exports run as jobs: [exportTransactions](/reference/activity#exportTransactions), then [getJob](/reference/activity#getJob) until `succeeded`, then download from `resultUrl` (pre-signed, 15 minutes).
