OnLink
Guides

Convert a customer balance

Convert a customer’s GBP, EUR or USD to KES, or KES to any of them, at your rate, attach your own fee, and know exactly what the customer was paid.

A customer conversion takes money from one of your customer's accounts in one currency and pays it into the same customer's account in another. The pairs are a foreign currency against KES, in either direction: GBP, EUR or USD to KES, and KES to GBP, EUR or USD. Between two foreign currencies (GBP to EUR, USD to GBP, …) there is no direct pair: convert through KES in two steps, and a request that names two foreign currencies is refused 422 CONVERSION_PAIR_UNSUPPORTED with that message.

These calls are on a Remittance account and need their own scopes: customer_transfers:write to convert and customer_transfers:read to quote and read a conversion back. A key that holds only conversions:* (which convert your own balance, see Convert USD to KES) or customer_accounts:* is refused 403 insufficient_scope, and errorCode names the scope it lacks. See Products and scopes.

The customer must be verified and hold an account in both currencies: a customer who is suspended or closed is refused 409 CUSTOMER_NOT_ACTIVE (details.status says where the customer is). The customer is checked once more just before the money is taken: if they are no longer verified by then, the conversion ends failed with customer_not_active and nothing is taken. Once the money has left, the conversion runs to its end whatever happens to the customer. Every customer belongs to you alone: another partner's customer id reads exactly like one that does not exist. A conversion needs no confirmation code: it moves money between two accounts of the same customer, and your signed request is the authorisation.

1. Ask for a quote (optional)

Send from, to and amount as query parameters, for example ?from=GBP&to=KES&amount=100.00:

GET /v1/customers/{id}/conversions/quote

The answer:

{
  "rate": "170.00",
  "source": "100.00",
  "target": "17000.00",
  "indicative": true,
  "asOf": "2026-11-19T10:00:00.000Z"
}
  • rate is the KES per one unit of the foreign currency, to 2 decimal places, in both directions: what the customer would be paid per unit going to KES, or pays per unit coming from KES. It is the rate set for your account.
  • target is source × rate (foreign to KES) or source ÷ rate (KES to foreign), rounded down to the cent.
  • A quote is indicative. It does not hold a rate and it does not reserve money. The rate is fixed when the conversion executes.
  • A pair with no rate configured for your account yet is refused 503 FX_RATE_NOT_CONFIGURED, and details.pair names it (GBP-KES, EUR-KES or USD-KES). Nothing is guessed and nothing is borrowed from another pair: contact us to have a rate configured. Retrying will not clear it.

2. Create the conversion

POST /v1/customers/{id}/conversions
Content-Type: application/json
{
  "from": "GBP",
  "to": "KES",
  "amount": "100.00",
  "partnerReference": "remit-2026-11-19-0007",
  "idempotencyKey": "cnv-2026-11-19-0001",
  "partnerFee": { "amount": "1.50", "currency": "GBP" }
}

The answer is a 202. The conversion has been accepted and is running:

{
  "id": "7d0a2f4e-3c1b-4b8e-9a52-6e1f0c3d8a17",
  "status": "processing"
}
  • amount is a decimal string in the currency you convert from, with at most two decimal places. Never a JSON number.
  • partnerReference is your own reference, up to 64 characters, echoed on every read.
  • idempotencyKey makes the create safe to retry. The same key with the same customer, body and fee returns the same conversion, and never converts twice. The same key with anything different (another customer, amount, fee amount or fee currency, or a conversion of your own balance) is refused 422 IDEMPOTENCY_KEY_REUSED. 8 to 64 characters from A-Z a-z 0-9 _ -.
  • partnerFee is optional: see Your fee. Any field the call does not take is 400 UNKNOWN_BODY_FIELD.
  • The write is limited to ten a minute per partner.
  • Before accepting, we check that the customer's account in the currency you convert from holds the amount plus your fee, after everything already in flight on that account (payouts, transfers, other conversions and fees waiting to be paid). If it does not, the create is refused 422 CONVERSION_INSUFFICIENT_BALANCE and nothing moves. The amount and your fee are held on the account until the conversion ends.
  • The minimum is 1.00 of a foreign currency, or KES 100.00 when you convert from KES (CONVERSION_AMOUNT_BELOW_MINIMUM). There is one maximum per conversion (CONVERSION_AMOUNT_ABOVE_MAXIMUM): it is the same for every partner and is not set on your account. For USD it is a USD amount. A GBP or EUR conversion is held to the same size worth of KES, at the current rates, so the largest GBP or EUR amount moves a little with the market: quote it first, and split a larger conversion into several. If the rate needed to size it cannot be read right now you get 503 CONVERSION_RATE_UNAVAILABLE; retry with the same idempotencyKey.

3. Wait for the result

A conversion ends in one of two states, and both are announced by one event, customer.conversion.updated, whose data.status tells them apart:

statusWhat it means
processingStill running. Wait for the webhook or read it back again later. If it is still processing 30 minutes after you created it, contact us and quote the conversion id.
settledThe money left the customer's from account and is in their to account. Your fee, if you attached one, is paid to your account after this.
failedNothing was paid into the customer's to account. Any money it took has been returned to their from account, and no fee is owed. failureReason (and reason) says why.

A customer conversion never sends conversion.settled or conversion.failed: those are the events of conversions of your own balance. Read it back with GET /v1/customers/{id}/conversions/{conversionId}:

GET /v1/customers/{id}/conversions/{conversionId}
{
  "id": "7d0a2f4e-3c1b-4b8e-9a52-6e1f0c3d8a17",
  "status": "settled",
  "from": "GBP",
  "to": "KES",
  "source": "100.00",
  "target": "17000.00",
  "rate": "170.00",
  "partnerReference": "remit-2026-11-19-0007",
  "failureReason": null,
  "createdAt": "2026-11-19T10:00:00.000Z",
  "settledAt": "2026-11-19T10:00:41.000Z",
  "failedAt": null,
  "customerId": "a9c1d2e3-0000-4000-8000-000000000020",
  "partnerFee": "1.50"
}

rate and target are null until the rate is fixed; once set they never change. partnerFee is your fee in the currency converted from (from), "0.00" when none. On a conversion that failed, partnerFee is always "0.00", both here and on its customer.conversion.updated event: no fee is charged on a conversion that does not happen, whatever fee you asked for. While a conversion is still processing it shows the fee you asked for. A conversion that is not this customer's, or not yours, reads 404 CONVERSION_NOT_FOUND.

Why a conversion fails

failureReason (and reason on the event) is one of:

ReasonWhat happenedThe customer's money
insufficient_balanceThe account no longer held the amount when the conversion ran.Never taken
debit_refusedThe money could not be taken from the customer's account.Never taken
fx_unavailableThe exchange could not be made.Taken and returned
provider_otp_not_receivedThe exchange could not be authorised in time.Taken and returned
rate_moved_beyond_toleranceThe rate moved too far between your create and the exchange, so we did not trade.Taken and returned
customer_not_activeThe customer was suspended or closed after you created the conversion, before it started.Never taken

In every case nothing was paid into the account the customer converts to, and you can create a new conversion with a new idempotencyKey. A conversion is reported failed only once any money it took is back.

A conversion is not a deposit

The money a conversion pays into the customer's account is OnLink's own movement, never an outside payment. It is not announced as customer.deposit.received: count a conversion once, on customer.conversion.updated's target, and never as a deposit.

4. Your fee

A partnerFee is your fee on converting a customer's money. It is in the currency you convert from (the same currency as amount), is taken from the customer's account and paid to your own account in that currency after the conversion settles, and is never owed on a conversion that fails.

{ "partnerFee": { "amount": "1.50", "currency": "GBP" } }
  • partnerFee.currency must equal from; any other currency is 422 PARTNER_FEE_CURRENCY_MISMATCH.
  • The fee is at most the lower of a share of the amount and a ceiling, both set for your account. With no terms set only "0.00" is accepted. Over the limit is 422 PARTNER_FEE_OVER_CAP, and details.cap is the largest fee that would have passed. When details says no fee can be carried at all: if both details.capBps and details.capAbsolute are zero, no fee terms are set for that currency (contact us); otherwise your terms are set and the amount is too small to carry a fee, so send a fee of zero ("0.00").
  • A malformed fee is 422 PARTNER_FEE_AMOUNT_INVALID.
  • If your own account in that currency cannot receive the fee the create is refused 409 PARTNER_FEE_ACCOUNT_UNAVAILABLE: send "0.00", or contact us.
  • The fee is judged inside the create, after your partner account is locked, so a change to your terms can never land between the check and the money.

Errors worth handling

Every code on these routes is catalogued in Errors.

StatusCodeMeaning
404CUSTOMER_NOT_FOUNDNo customer with that id belongs to you.
409CUSTOMER_NOT_ACTIVEThe customer is not verified. details.status says where they are.
409MONEY_MODE_MISMATCHThe customer's money (live or sandbox) is not the same kind as your conversions'. The quote refuses it too, so it never promises what the create would refuse.
409ACCOUNT_NOT_READYOne of the two accounts cannot move money yet. details.reason and details.currency say which and why.
422CONVERSION_PAIR_UNSUPPORTEDNot a foreign currency against KES. Between two foreign currencies the message says to convert through KES in two steps.
422CONVERSION_INSUFFICIENT_BALANCEThe account does not hold the amount and your fee after what is already in flight. Nothing moved.
422PARTNER_FEE_OVER_CAP and the other fee codesThe fee is over the cap, in another currency, or malformed.
503FX_RATE_NOT_CONFIGUREDNo rate is configured for that pair on your account yet. details.pair names it. Nothing moved; contact us.
503CONVERSION_RATE_UNAVAILABLE, CONVERSION_BALANCE_UNAVAILABLEA rate or the balance could not be read right now. Retry with the same idempotencyKey.

On this page