OCI-Pay · API reference

The calls between participants

OCI-Pay has four kinds of participant: the switch each country's payments operator runs, the banks, the payment apps that issue their own addresses, and a trust registry that says who everyone is. This is what each one answers and what it sends. A person's own app talks only to its own service, so those endpoints are not here.

To watch these calls happen in order, with your own input, use the simulator.

Before you call

Who calls whom

ParticipantCallsIs called by
BankIts own country's switchIts own country's switch only
Payment appThe switch of the country the person's bank is inAny switch delivering to its addresses
SwitchIts banks, payment apps, the other country's switchIts banks, payment apps, the other country's switch
Trust registryNo oneEveryone: GET /v1/participants lists each participant's id, kind, country, address handle, base URL and keys

Every call is signed

The caller signs the exact body bytes with its Ed25519 key and sends the result in OCI-Signature: a detached compact JWS, <header>..<signature>. The protected header carries alg (EdDSA), kid, iss (the caller's registry id), iat, htm (the method) and htu (the full URL). The receiver finds the caller's key in the registry and refuses a signature more than two minutes old. There are no shared secrets and no bearer tokens between participants.

Retries are safe

Calls that move money or create a request take an Idempotency-Key header (up to 200 characters). Sending the same key with the same body returns the first answer, so a caller that timed out can simply send again. A pending payment sent again is pushed forward rather than replayed. The calls a switch makes to a bank or an app carry the payment's own id, and each of those is also answered once per id.

Money is a decimal string

Every amount is {"value": "250.00", "currency": "INR"}: the value a decimal string, never a number, the currency an ISO 4217 code. Countries are ISO 3166 two-letter codes. Times are ISO 8601 in UTC.

Errors have one shape

{"error": {"code": "…", "message": "…"}} with an HTTP status. The code is stable; the message is for people. A wrong PIN or too little money is not an error: the payment comes back with status failed and a failure_reason.

StatusCodeWhen
401 SIGNATURE_REQUIRED The call has no OCI-Signature header.
401 SIGNATURE_INVALID The signature does not check out, or was made for another method or URL.
401 SIGNATURE_EXPIRED The signature's iat is more than two minutes from the receiver's clock.
401 UNKNOWN_PARTICIPANT The signer is not an active participant in the trust registry.
403 FORBIDDEN The signer may not call this endpoint, such as a bank of another country.
400 IDEMPOTENCY_KEY_REQUIRED This call needs an Idempotency-Key header.
422 IDEMPOTENCY_KEY_REUSED The key was already used with a different body.
409 REQUEST_IN_PROGRESS The first call with this key has not finished. Retry shortly.
422 VALIDATION_ERROR A field is missing or malformed. The message names it.

The switch

Called by: Banks and payment apps

Each country's payments operator runs one switch. A bank calls the switch of its own country. A payment app belongs to one country and calls only that country's switch; an account in the other country is reached through it, over the link between the two switches. The switch never holds money or accounts: it finds who owns an address, moves the payment between the two banks, and keeps the positions to settle.

POST /v1/lookup

Look up an address

Who owns this address? Asked before a payment, so the payer sees a name to confirm.

Request body

address string A payment address, such as asha@wren or priya@sbi. The part after @ names who issued it.

Response

address string A payment address, such as asha@wren or priya@sbi. The part after @ names who issued it.
name string The holder's name.
verified ? boolean Whether the name comes from a checked identity.
bank_name string The bank that holds the account.
country string ISO 3166 two-letter country code.
assurance string How strongly the holder's identity was checked: low, substantial or high.
cross_border boolean True when payer and payee are in different countries, so a quote is needed.
POST /v1/quotes

Quote a cross-border payment

The rate, the fee and what the payee receives, held until the quote expires. Needed only when the payee is in another country.

Request body

from_address ? string The payer's payment address.
to_address string The payee's payment address.
amount object The amount, in the payer's currency unless said otherwise.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.

Response

quote_id uuid The quote this payment uses. Required when payer and payee are in different countries.
send object What the payer's side sends.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
receive object What the payee's side receives.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
rate string The exchange rate, as a decimal string.
fee object What the payer is charged on top.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
total_debit object What leaves the payer's account: amount plus fee.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
expires_at date-time When the request stops being payable.
POST /v1/payments

Send a payment

Moves money from the payer's account to the payee's address. The switch has the payer's bank hold the money, the payee's bank credit it, then the payer's bank take the held money. If the credit fails, the hold is released.

Idempotency-Key required.

Request body

id ? uuid The caller's id for this payment or request (a UUID). The same id is used by every party.
from_address string The payer's payment address.
from_name ? string The payer's name, as their bank or app holds it.
to_address string The payee's payment address.
amount object The amount, in the payer's currency unless said otherwise.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
note ? string Free text from the payer, at most 140 characters.
quote_id ? uuid The quote this payment uses. Required when payer and payee are in different countries.
collect_request_id ? uuid The request this payment answers, when it pays one.
payer ? object Sent by a payment app only: which bank account the money comes from.
↳ bank string The bank's id in the trust registry, such as bank:sbi.
↳ account string The account reference that bank gave this app when the person connected the account.
credential ? string The person's PIN, encrypted on their device to the bank's key. The switch passes it on unread.

Response

id uuid The caller's id for this payment or request (a UUID). The same id is used by every party.
status string Where it stands: the status after this call.
state string The switch's own state: received, credited, completed, failed or reversed.
failure_reason ? string Why it failed, such as wrong_pin or insufficient_funds.
direction string out for the payer's side, in for the payee's.
from_address string The payer's payment address.
to_address string The payee's payment address.
to_name ? string The payee's name, shown to the payer before they confirm.
amount object The amount, in the payer's currency unless said otherwise.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
receive ? object What the payee's side receives.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
fee ? object What the payer is charged on top.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
rate ? string The exchange rate, as a decimal string.
note ? string Free text from the payer, at most 140 characters.
collect_request_id ? uuid The request this payment answers, when it pays one.
created_at date-time When it was made (ISO 8601, UTC).
completed_at ? date-time When it finished, once it has.
GET /v1/payments/{payment_id}

Read a payment

The current state of a payment the caller started. Use it when a payment came back pending.

Request body

No body.

Response

id uuid The caller's id for this payment or request (a UUID). The same id is used by every party.
status string Where it stands: the status after this call.
state string The switch's own state: received, credited, completed, failed or reversed.
failure_reason ? string Why it failed, such as wrong_pin or insufficient_funds.
direction string out for the payer's side, in for the payee's.
from_address string The payer's payment address.
to_address string The payee's payment address.
to_name ? string The payee's name, shown to the payer before they confirm.
amount object The amount, in the payer's currency unless said otherwise.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
receive ? object What the payee's side receives.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
fee ? object What the payer is charged on top.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
rate ? string The exchange rate, as a decimal string.
note ? string Free text from the payer, at most 140 characters.
collect_request_id ? uuid The request this payment answers, when it pays one.
created_at date-time When it was made (ISO 8601, UTC).
completed_at ? date-time When it finished, once it has.
POST /v1/collect-requests

Ask someone to pay

A request for money. Nothing moves: the switch delivers it to whoever issued the payer's address, and the payer approves or declines there.

Idempotency-Key required.

Request body

id ? uuid The caller's id for this payment or request (a UUID). The same id is used by every party.
payee_address string The address asking for the money.
payee_name ? string The name of whoever is asking.
payee_assurance ? string How strongly the payee's identity was checked: low, substantial or high.
payer_address string The address being asked to pay.
amount object The amount, in the payer's currency unless said otherwise.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
note ? string Free text from the payer, at most 140 characters.
expires_at ? date-time When the request stops being payable.

Response

id uuid The caller's id for this payment or request (a UUID). The same id is used by every party.
status string Where it stands: the status after this call.
payee_address string The address asking for the money.
payer_address string The address being asked to pay.
amount object The amount, in the payer's currency unless said otherwise.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
expires_at date-time When the request stops being payable.
POST /v1/collect-requests/{request_id}/status

Answer or withdraw a request

The payer's side reports declined; the payee's side reports cancelled. A paid request is reported by the switch itself.

Idempotency-Key accepted.

Request body

status string Where it stands: the status after this call.
report ? boolean True when the payer declines and reports the request as unwanted.

Response

id uuid The caller's id for this payment or request (a UUID). The same id is used by every party.
status string Where it stands: the status after this call.
relayed boolean Whether the other party was told.
POST /v1/connect/accounts

Find a person's accounts at a bank

Payment apps only. The switch passes the question to the bank, adding which app is asking. The answer is the bank's.

The answer is the bank's, passed back unchanged: /switch/v1/connect/accounts.

Request body

bank string The bank's id in the trust registry, such as bank:sbi.
identity_token string The person's OCI-ID access token. The bank asks the identity that issued it who this is.

Response

bank string The bank's id in the trust registry, such as bank:sbi.
bank_name string The bank that holds the account.
country string ISO 3166 two-letter country code.
accounts array One entry per account.
↳ id string A short-lived id for this account, good for ten minutes.
↳ kind string The kind of account, such as savings.
↳ masked string The account number with all but the last four digits hidden.
↳ currency string ISO 4217 code.
↳ holder_name string The account holder's name.
↳ linked boolean Whether this app already has this account connected.
pin_key object The bank's public key (a JWK). The person's device encrypts the PIN to it.
POST /v1/connect/link

Connect an account to the app

Payment apps only. The bank checks the PIN and returns an account reference only this app can use.

The answer is the bank's, passed back unchanged: /switch/v1/connect/link.

Request body

bank string The bank's id in the trust registry, such as bank:sbi.
account_id string One of the short-lived ids the bank answered with when asked for the person's accounts.
pin string The person's PIN, encrypted on their device to the bank's key (compact JWE).

Response

bank string The bank's id in the trust registry, such as bank:sbi.
bank_name string The bank that holds the account.
country string ISO 3166 two-letter country code.
account string The account reference the bank gave this payment app. Only that app can use it.
assurance string How strongly the holder's identity was checked: low, substantial or high.
address ? string The address this bank itself issued for the account.
kind string The kind of account, such as savings.
masked string The account number with all but the last four digits hidden.
currency string ISO 4217 code.
holder_name string The account holder's name.
pin_key object The bank's public key (a JWK). The person's device encrypts the PIN to it.
POST /v1/connect/unlink

Disconnect an account

Payment apps only. Ends the app's permission on the account.

The answer is the bank's, passed back unchanged: /switch/v1/connect/unlink.

Request body

bank string The bank's id in the trust registry, such as bank:sbi.
account string The account reference the bank gave this payment app. Only that app can use it.

Response

account string The account reference the bank gave this payment app. Only that app can use it.
status string ended
changed boolean False when it had already ended.
POST /v1/balance

Read a balance

Payment apps only. The balance of a connected account, straight from the bank. The app shows it and does not keep it.

The answer is the bank's, passed back unchanged: /switch/v1/balance.

Request body

bank string The bank's id in the trust registry, such as bank:sbi.
account string The account reference the bank gave this payment app. Only that app can use it.

Response

balance object Everything in the account.
available object What is free to spend: the balance less any holds.
kind string The kind of account, such as savings.
masked string The account number with all but the last four digits hidden.
currency string ISO 4217 code.
holder_name string The account holder's name.

A bank

Called by: The switch of the bank's own country

What a bank answers so it can take part. A bank trusts only its own country's switch: every call here carries that switch's signature. Accounts, balances and PINs stay inside the bank; these calls are the only way in.

POST /switch/v1/lookup

Whose address is this?

For an address this bank issued: the holder's name and how strongly they were identified.

Request body

address string A payment address, such as asha@wren or priya@sbi. The part after @ names who issued it.

Response

address string A payment address, such as asha@wren or priya@sbi. The part after @ names who issued it.
name string The holder's name.
verified boolean Whether the name comes from a checked identity.
bank_name string The bank that holds the account.
country string ISO 3166 two-letter country code.
assurance string How strongly the holder's identity was checked: low, substantial or high.
cross_border boolean True when payer and payee are in different countries, so a quote is needed.
POST /switch/v1/debit

Hold the payer's money

Check the PIN and set the amount aside. Nothing leaves the account yet. A wrong PIN or too little money is answered with status failed and a reason, not an HTTP error.

Request body

payment object The payment, as the switch describes it to this party.
↳ id uuid The caller's id for this payment or request (a UUID). The same id is used by every party.
↳ account string The account reference the bank gave this payment app. Only that app can use it.
↳ provider string The payment app's id in the trust registry, such as provider:wren. Filled in by the switch.
↳ from_address string The payer's payment address.
↳ to_address string The payee's payment address.
↳ to_name ? string The payee's name, shown to the payer before they confirm.
↳ to_country string The payee's country.
↳ amount object The amount, in the payer's currency unless said otherwise.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
↳ fee ? object What the payer is charged on top.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
↳ fx ? object For a cross-border payment: the rate and both sides' amounts, as quoted.
↳ note ? string Free text from the payer, at most 140 characters.
pin ? string The person's PIN, encrypted on their device to the bank's key (compact JWE).

Response

id string The caller's id for this payment or request (a UUID). The same id is used by every party.
status string Where it stands: the status after this call.
failure_reason ? string Why it failed, such as wrong_pin or insufficient_funds.
POST /switch/v1/debit/{payment_id}/capture

Take the held money

The payee was credited, so the hold becomes a debit.

Request body

No body.

Response

id string The caller's id for this payment or request (a UUID). The same id is used by every party.
status string Where it stands: the status after this call.
failure_reason ? string Why it failed, such as wrong_pin or insufficient_funds.
POST /switch/v1/debit/{payment_id}/release

Release the held money

The payee could not be credited, so the hold is dropped and the money is free again.

Request body

reason string Why the hold is being released.

Response

id string The caller's id for this payment or request (a UUID). The same id is used by every party.
status string Where it stands: the status after this call.
failure_reason ? string Why it failed, such as wrong_pin or insufficient_funds.
POST /switch/v1/credit

Credit the payee

Add the money to the account behind the address, or behind the account reference when a payment app issued the address. The same payment id credits once, however many times it is asked.

Request body

payment object The payment, as the switch describes it to this party.
↳ id string The caller's id for this payment or request (a UUID). The same id is used by every party.
↳ from_address string The payer's payment address.
↳ from_name ? string The payer's name, as their bank or app holds it.
↳ from_country ? string The payer's country.
↳ to_address string The payee's payment address.
↳ to_account ? string The account reference a payment app gave for its address. Absent when the address is the bank's own.
↳ amount object The amount, in the payer's currency unless said otherwise.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
↳ note ? string Free text from the payer, at most 140 characters.
↳ collect_request_id ? uuid The request this payment answers, when it pays one.
↳ fx ? object For a cross-border payment: the rate and both sides' amounts, as quoted.
↳ created_at date-time When it was made (ISO 8601, UTC).

Response

status string Where it stands: the status after this call.
id string The caller's id for this payment or request (a UUID). The same id is used by every party.
POST /switch/v1/collect-requests

Deliver a request to the payer

A request for money addressed to one of this bank's own addresses.

Request body

request object The request, as the switch describes it to this party.
↳ id uuid The caller's id for this payment or request (a UUID). The same id is used by every party.
↳ payee_address string The address asking for the money.
↳ payee_name string The name of whoever is asking.
↳ payee_assurance ? string How strongly the payee's identity was checked: low, substantial or high. One of: low, substantial, high.
↳ payee_country string The country the request comes from.
↳ payer_address string The address being asked to pay.
↳ amount object The amount, in the payer's currency unless said otherwise.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
↳ note ? string Free text from the payer, at most 140 characters.
↳ expires_at date-time When the request stops being payable.
↳ created_at date-time When it was made (ISO 8601, UTC).

Response

id string The caller's id for this payment or request (a UUID). The same id is used by every party.
status string Where it stands: the status after this call.
POST /switch/v1/collect-requests/{request_id}/status

A request changed

Tells the bank a request it made or received was approved, declined, paid, cancelled or expired.

Request body

status string Where it stands: the status after this call. One of: approved, declined, expired, cancelled, paid.
report ? boolean True when the payer declines and reports the request as unwanted.
side ? string "payer" when the request was answered at the bank itself, so the copy waiting here is done too.

Response

id string The caller's id for this payment or request (a UUID). The same id is used by every party.
status string Where it stands: the status after this call.
POST /switch/v1/connect/accounts

Which accounts does this person hold?

The bank asks the identity that issued the token for the person's verified phone number, and lists the accounts under it. It answers with short-lived ids, never account numbers.

Request body

provider string The payment app's id in the trust registry, such as provider:wren. Filled in by the switch.
identity_token string The person's OCI-ID access token. The bank asks the identity that issued it who this is.

Response

bank string The bank's id in the trust registry, such as bank:sbi.
bank_name string The bank that holds the account.
country string ISO 3166 two-letter country code.
accounts array One entry per account.
↳ id string A short-lived id for this account, good for ten minutes.
↳ kind string The kind of account, such as savings.
↳ masked string The account number with all but the last four digits hidden.
↳ currency string ISO 4217 code.
↳ holder_name string The account holder's name.
↳ linked boolean Whether this app already has this account connected.
pin_key object The bank's public key (a JWK). The person's device encrypts the PIN to it.
POST /switch/v1/connect/link

Allow a payment app on an account

The bank checks the PIN, records that the person allowed this app, and returns the reference the app uses from then on.

Request body

provider string The payment app's id in the trust registry, such as provider:wren. Filled in by the switch.
account_id string One of the short-lived ids the bank answered with when asked for the person's accounts.
pin string The person's PIN, encrypted on their device to the bank's key (compact JWE).

Response

bank string The bank's id in the trust registry, such as bank:sbi.
bank_name string The bank that holds the account.
country string ISO 3166 two-letter country code.
account string The account reference the bank gave this payment app. Only that app can use it.
assurance string How strongly the holder's identity was checked: low, substantial or high.
address ? string The address this bank itself issued for the account.
kind string The kind of account, such as savings.
masked string The account number with all but the last four digits hidden.
currency string ISO 4217 code.
holder_name string The account holder's name.
pin_key object The bank's public key (a JWK). The person's device encrypts the PIN to it.
POST /switch/v1/connect/unlink

End a payment app's permission

The reference stops working.

Request body

provider string The payment app's id in the trust registry, such as provider:wren. Filled in by the switch.
account string The account reference the bank gave this payment app. Only that app can use it.

Response

account string The account reference the bank gave this payment app. Only that app can use it.
status string ended
changed boolean False when it had already ended.
POST /switch/v1/balance

Balance of a connected account

Answered only for a reference that is still active for this app.

Request body

provider string The payment app's id in the trust registry, such as provider:wren. Filled in by the switch.
account string The account reference the bank gave this payment app. Only that app can use it.

Response

balance object Everything in the account.
available object What is free to spend: the balance less any holds.
kind string The kind of account, such as savings.
masked string The account number with all but the last four digits hidden.
currency string ISO 4217 code.
holder_name string The account holder's name.

A payment app

Called by: A switch

What a payment app answers so it can issue its own addresses. The app holds no money: an address such as asha@wren points at a bank account the person connected, and these calls let a switch find that account and tell the app what happened.

POST /switch/v1/resolve

Whose address is this?

For an address this app issued: the holder's name, the bank behind it, and the account reference that bank gave the app.

Request body

address string A payment address, such as asha@wren or priya@sbi. The part after @ names who issued it.

Response

address string A payment address, such as asha@wren or priya@sbi. The part after @ names who issued it.
name string The account holder's name.
assurance string How strongly the holder's identity was checked: low, substantial or high.
bank string The bank's id in the trust registry, such as bank:sbi.
account string The account reference the bank gave this payment app. Only that app can use it.
POST /switch/v1/collect-requests

Deliver a request to the payer

A request for money addressed to one of this app's addresses. The app shows it to the person.

Request body

request object The request, as the switch describes it to this party.
↳ id uuid The caller's id for this payment or request (a UUID). The same id is used by every party.
↳ payee_address string The address asking for the money.
↳ payee_name ? string The name of whoever is asking.
↳ payee_assurance ? string How strongly the payee's identity was checked: low, substantial or high.
↳ payee_country string The country the request comes from.
↳ payer_address string The address being asked to pay.
↳ amount object The amount, in the payer's currency unless said otherwise.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
↳ note ? string Free text from the payer, at most 140 characters.
↳ expires_at date-time When the request stops being payable.
↳ created_at date-time When it was made (ISO 8601, UTC).

Response

id string The caller's id for this payment or request (a UUID). The same id is used by every party.
status string pending
POST /switch/v1/collect-requests/{request_id}/status

A request changed

Tells the app a request it made or received was approved, declined, paid, cancelled or expired.

Request body

status string Where it stands: the status after this call. One of: approved, declined, expired, cancelled, paid.
report ? boolean True when the payer declines and reports the request as unwanted.
side ? string "payer" when the request was answered at the bank itself, so the copy waiting here is done too.

Response

id string The caller's id for this payment or request (a UUID). The same id is used by every party.
status string Where it stands: the status after this call.
POST /switch/v1/payments/received

Money arrived

Tells the app a payment reached one of its addresses, so the person sees it. The bank already has the money whether or not this is heard.

Request body

payment object The payment, as the switch describes it to this party.
↳ id uuid The caller's id for this payment or request (a UUID). The same id is used by every party.
↳ to_address string The payee's payment address.
↳ from_address string The payer's payment address.
↳ from_name ? string The payer's name, as their bank or app holds it.
↳ from_country string The payer's country.
↳ amount object The amount, in the payer's currency unless said otherwise.
↳ value string A decimal string, such as "250.00". Never a float.
↳ currency string ISO 4217 code, such as INR or USD.
↳ note ? string Free text from the payer, at most 140 characters.
↳ collect_request_id ? uuid The request this payment answers, when it pays one.
↳ completed_at ? date-time When it finished, once it has.

Response

ok boolean Always true.
known boolean False when the address no longer exists at the app.

A field marked ? may be left out. Field names and types are generated from the reference implementation (ocipay-api@f11aca3, ocipay-bank-api@ffaf6da, wren-api@e94b91e); the reference is a draft and will change as OCI-PAY is specified.