← Specifications

OCI-PAY-2 Payments Switch

Version 0.1.0 · 2026-11-28 · Draft Changes
StatusDraft.
Version0.1.0, 2026-11-28
Profile ofJWS (RFC 7515) compact serialization with detached content (Appendix F), signed with EdDSA over Ed25519 (RFC 8037). Otherwise none: an OCI protocol
Depends onOCI-0 Core, OCI-1 Trust Registry, OCI-PAY-1 Payment Addressing
Used byOCI-PAY-3 Payment Apps, OCI-PAY-4 Switch Link
Reference implementationocipay-api (the switch), ocipay-bank-api (a bank’s connector)

1. Purpose

OCI-Pay is an instant payment rail. Each country has one payments switch, run by its national payments operator. The banks of that country connect to it. The switch finds who an address belongs to, moves a payment from the payer’s bank to the payee’s bank, carries requests for money, and keeps the positions the banks settle later.

OCI-PAY-2 is the protocol between a bank and its switch. It also defines what every machine-to-machine call on the rail shares: the participant registry, the OCI-Signature header, idempotency, money and errors. OCI-PAY-3 (payment apps) and OCI-PAY-4 (the link between two switches) cite those clauses and do not repeat them.

OCI-PAY-2 does not define:

  • address syntax, who owns a handle, or how an address issued by a payment app is resolved (OCI-PAY-1);
  • what a payment app calls on the switch, the home-switch rule, /v1/relay, or what the switch calls on a payment app (OCI-PAY-3);
  • the /link/v1/* calls, cross-border pricing and foreign exchange (OCI-PAY-4);
  • a bank’s own customer channel, PIN storage or core banking. They sit behind the connector and are not on the rail.

2. Roles

RoleRegistry kindDoes
SwitchswitchOne per country. Routes payments and requests for money between the country’s banks, keeps positions, runs settlement cycles. Linked to the other country’s switch (OCI-PAY-4).
BankbankHolds accounts. Runs a connector that serves the calls in §8 and makes the calls in §7. Talks only to its own country’s switch.
ProviderproviderA payment app. Holds no accounts. Uses the switch under OCI-PAY-3.
Identity provideridpListed in the registry. Not called on the rail.
Trust registrynoneLists the participants and where their keys are (§3).

3. Participants and trust

The rail trusts the participant list of the trust registry service (ocitrust, GET /v1/participants). It does not resolve OCI-1 entity statements or trust marks. See §18.

  • SW-3.1 Each participant record MUST carry id, kind, country, display_name, address_suffix, base_url, jwks_url and status, and MAY carry acts_for (OCI-PAY-3). kind is one of bank, switch, provider, idp. status is active or suspended. country is an ISO 3166-1 alpha-2 code in upper case. An idp may have none.
  • SW-3.2 Participant ids are compared as exact strings. A bank’s id is bank:<code>, a provider’s provider:<code>, and a switch’s MUST be switch:<CC> where <CC> is its country: switches read a peer’s country from its id.
  • SW-3.3 Each country MUST have exactly one participant of kind switch. A bank’s country names the one switch it uses.
  • SW-3.4 address_suffix is the handle of the addresses a bank or provider issues (OCI-PAY-1). Readers MUST lower-case it and strip a leading @. No two participants may share one.
  • SW-3.5 base_url is where the participant serves its rail endpoints, without a trailing path. Callers MUST build request URLs from it, and receivers MUST check htu against it (SW-4.7). A switch MAY be configured with a different URL for its peer.
  • SW-3.6 jwks_url is the participant’s JWK Set of signing keys. Every bank and switch serves its own at /.well-known/jwks.json, without authentication. A registry used for tests or offline running MAY carry the keys inline as jwks.
  • SW-3.7 A participant whose status is not active MUST NOT be accepted as the sender of a call (SW-4.9), and the switch MUST NOT route a payment or a request for money to a handle it owns.
  • SW-3.8 Readers MAY cache the participant list for up to 60 seconds. If the registry cannot be reached, the switch MAY keep using the last list it fetched. With no list at all, the call fails (SW-4.15).

4. OCI-Signature

Every call between participants is signed by the sender. The signature covers the method, the URL and the exact body bytes.

  • SW-4.1 Every request between participants (bank to switch, switch to bank, provider to switch, switch to provider, switch to switch) MUST carry an OCI-Signature header. Only /.well-known/jwks.json and /health are served without one.
  • SW-4.2 The header value MUST be a compact JWS with detached content (RFC 7515 Appendix F): <b64url(protected header)>..<b64url(signature)>, with an empty middle part. A value with three non-empty parts (an attached payload) MUST be rejected. The RFC 7797 unencoded-payload variant is not used.
  • SW-4.3 The signing input MUST be b64url(protected header) + "." + b64url(body), where body is the exact request body bytes as sent, and is empty for a GET. b64url is base64url without padding.
  • SW-4.4 alg MUST be EdDSA, with an Ed25519 key (RFC 8037: kty OKP, crv Ed25519). Verifiers MUST reject every other alg, including none, and every other key type. This is an exception to CORE-5.1 and CORE-5.2 (§18).
  • SW-4.5 The protected header MUST carry exactly these members: alg, kid (string), iss (string), iat (integer NumericDate), htm (string), htu (string). Verifiers MUST reject a header that lacks one or gives it the wrong JSON type. The header carries no typ. This is an exception to CORE-5.4 (§18).
  • SW-4.6 iss MUST be the sender’s participant id (SW-3.2).
  • SW-4.7 htm MUST equal the request method. htu MUST equal the receiver’s base URL followed by the request path, with no query string. Verifiers MUST compare htu as an exact string with their own base URL plus the path they received, and reject a mismatch.
  • SW-4.8 Verifiers MUST reject a signature whose iat is more than 120 seconds before or after their clock (SIGNATURE_EXPIRED). There is no jti and no replay cache. Repeats of state-changing calls are handled by idempotency (§5).
  • SW-4.9 Verifiers MUST look iss up in the registry and reject it unless it is an active participant (UNKNOWN_PARTICIPANT).
  • SW-4.10 Verifiers MUST then check that this kind of participant may call this endpoint, and answer 403 if not:
    • the switch’s /v1/* calls: a bank or provider whose country is the switch’s own;
    • the switch’s /link/v1/* calls: the switch of another country (OCI-PAY-4);
    • a bank’s /switch/v1/* calls: only switch:<CC> of the bank’s own country, of kind switch.
  • SW-4.11 Verifiers MUST take the sender’s keys only from its registry record (jwks_url, or inline jwks). They MUST NOT use a key or key URL carried in the request. The signature is valid when a key whose kid equals the header’s kid verifies it.
  • SW-4.12 Verifiers MAY cache a sender’s JWK Set. The reference caches it for 300 seconds. When no cached key verifies the signature, the verifier MUST fetch the JWK Set again, once, bypassing the cache, before it rejects the call. This is how a rotated key is picked up. A verifier MAY refuse to refetch more often than once every 30 seconds per sender.
  • SW-4.13 A sender MUST publish a key at its jwks_url before it signs with it.
  • SW-4.14 The switch MUST verify the signature before it parses the body, and a signature error MUST be returned in preference to a body validation error.
  • SW-4.15 If the registry or the sender’s JWK Set cannot be fetched, the verifier MUST refuse the call with a 5xx error, never accept it.
  • SW-4.16 Responses are not signed. A caller relies on TLS to the base_url it took from the registry for the authenticity of the answer.

5. Idempotency

The switch makes state-changing calls repeat-safe with an Idempotency-Key header. A bank’s connector makes the calls it serves repeat-safe on the payment or request id instead.

  • SW-5.1 The switch MUST require an Idempotency-Key header on POST /v1/payments, POST /v1/collect-requests and POST /v1/settlement/cycles, and answer 400 IDEMPOTENCY_KEY_REQUIRED without one. It MUST accept, and MAY be sent, a key on POST /v1/quotes and POST /v1/collect-requests/{id}/status. Lookups and reads take none.
  • SW-5.2 A key MUST be at most 200 characters (400 IDEMPOTENCY_KEY_INVALID). A bank’s connector uses the payment id, or the request id, as the key.
  • SW-5.3 A key is scoped to the caller’s participant id and the request path. The same key from another caller, or on another path, is a different key.
  • SW-5.4 The switch MUST store, with the key, the SHA-256 of the exact body bytes. A repeat whose body differs MUST be refused with 422 IDEMPOTENCY_KEY_REUSED. Senders MUST therefore send the same bytes when they repeat a call.
  • SW-5.5 A repeat that arrives while the first call is still running MUST be refused with 409 REQUEST_IN_PROGRESS. A claim left with no result for 120 seconds is treated as abandoned, and the next repeat runs the call again.
  • SW-5.6 A repeat of a call that succeeded MUST return the first result. One exception: when the stored result is a payment whose state is received or credited, the switch MUST try to move that payment forward (§9) and return its current record instead.
  • SW-5.7 If a call fails with an error, the switch MUST NOT keep the key. A repeat runs the call again. Errors are not replayed.
  • SW-5.8 The switch sends Idempotency-Key, set to the payment id, on POST /switch/v1/credit. A bank’s connector MUST credit a payment id at most once whether or not the header is present, and MUST hold, capture or release a payment id at most once (§8).
  • SW-5.9 Answers that mean “I already have this” are not refusals: 409 REQUEST_IN_PROGRESS, 409 PAYMENT_ID_TAKEN and 422 IDEMPOTENCY_KEY_REUSED. A caller MUST treat them as an unknown outcome (§10), not as a failure.

6. Money and identifiers

  • SW-6.1 Money is a JSON object { "value": "<decimal string>", "currency": "<code>" }. value MUST be a string, never a JSON number.
  • SW-6.2 The currencies are INR and USD, each with two minor digits. Each switch has one currency, its country’s: IN uses INR and US uses USD. A switch MUST refuse any other code with 422 UNKNOWN_CURRENCY. A bank’s connector refuses a body it cannot read as SW-13.2 says (422 VALIDATION_ERROR).
  • SW-6.3 An amount sent to the switch MUST match ^\d{1,12}(\.\d{1,2})?$ and be greater than zero (422 INVALID_AMOUNT). A bank’s connector accepts at most 10 integer digits and at most 10,000,000.00 per amount.
  • SW-6.4 Amounts the switch sends always have exactly two decimals. Only settlement nets (§12) may be negative, with a leading -.
  • SW-6.5 Implementations MUST hold amounts as integer minor units. Where an amount is converted (OCI-PAY-4) it is rounded half-even to minor units.
  • SW-6.6 Payment ids, request-for-money ids and quote ids are UUIDs in their textual form. A bank MAY choose the id of a payment or request it starts. Otherwise the switch chooses one.
  • SW-6.7 Times in bodies (created_at, expires_at, completed_at) are RFC 3339 date-times with an offset. Only the signature’s iat is a NumericDate.
  • SW-6.8 The switch lower-cases every address it receives and rejects one that is not name@handle, is longer than 200 characters or contains white space. OCI-PAY-1 owns the syntax.
  • SW-6.9 A note MUST be at most 140 characters.
  • SW-6.10 Bodies are UTF-8 JSON (Content-Type: application/json). Receivers MUST ignore members they do not know.

7. The switch API for banks

All calls in this section are signed by the bank (§4). A successful call answers 200. A payment that ends failed is a 200 too: the failure is in the body.

The switch knows which addresses a caller may speak for: those under its own address_suffix. OCI-PAY-3 adds the addresses a payment app may speak for.

7.1 Look up an address

POST /v1/lookup with { "address": "<address>" }.

  • SW-7.1 The switch MUST route the address by its handle (OCI-PAY-1). For an address held at a bank in its own country it MUST ask that bank (POST /switch/v1/lookup, SW-8.1). For an address in the other country it asks the peer switch (OCI-PAY-4). For an address a provider issued, OCI-PAY-1 and OCI-PAY-3 apply.
  • SW-7.2 The answer MUST be { address, name, verified, bank_name, country, assurance, cross_border }. cross_border is true when the account is in the other country. bank_name falls back to the bank’s registry display_name. name and assurance are never null: a bank’s (or the peer switch’s) answer without them is not an answer (SW-7.3).
  • SW-7.3 An address with no account MUST answer 404 ADDRESS_NOT_FOUND. If the bank did not answer, the switch MUST answer 503 BANK_UNAVAILABLE, and 503 PEER_UNAVAILABLE for the peer switch. Any other non-success reply from the bank is reported as 404 ADDRESS_NOT_FOUND.
POST /v1/lookup Look up an address · served by the switch

Returns who holds an address, so the payer can confirm the name before paying. Called by a bank of the switch's country. Defined in SW-7.1, SW-7.2, SW-7.3.

RequestTypeRequiredMeaningClause
addressstringyesThe address to look up, as name@handle. (at most 200 characters)SW-6.8
ResponseTypeRequiredMeaningClause
addressstringyesThe address looked up, lower-cased. (at most 200 characters)SW-6.8
namestringyesThe account holder's name.
verifiedbooleanyesWhether the name comes from a checked identity.
bank_namestringyesThe bank that holds the account; the switch falls back to its registry display_name.SW-7.2
countrystringyesThe ISO 3166-1 alpha-2 country of the account. (pattern ^[A-Z]{2}$)
assurance"low" | "substantial" | "high"yesHow strongly the holder's identity was checked (CORE-4).SW-8.1
cross_borderbooleanyesTrue when the account is in the other country.SW-7.2

Errors

7.2 Quote a cross-border payment

POST /v1/quotes with { from_address?, to_address, amount }.

  • SW-7.4 Quotes are only for an address in the other country. A domestic to_address MUST answer 422 NOT_CROSS_BORDER. A from_address, when given, MUST be one the caller speaks for (403 ADDRESS_NOT_OWNED).
  • SW-7.5 The answer MUST be { quote_id, send, receive, rate, fee, total_debit, expires_at }. send is in the switch’s currency, receive in the other country’s. fee is the switch’s fixed link fee in its own currency: INR 20.00 at IN, USD 1.62 at US. total_debit is send + fee. rate is a string with two decimals. Pricing is OCI-PAY-4.
  • SW-7.6 A quote MUST be held for 600 seconds, MUST be usable by one payment only, and only by the participant that asked for it.
POST /v1/quotes Quote a cross-border payment · served by the switch

Prices a payment to an address in the other country and holds that price for 600 seconds. Called by a bank of the switch's country. Defined in SW-7.4, SW-7.5, SW-7.6.

RequestTypeRequiredMeaningClause
from_addressstringThe payer's address; when given, it must be one the caller speaks for. (at most 200 characters)SW-7.4
to_addressstringyesThe payee's address, in the other country. (at most 200 characters)SW-7.4
amountobjectyesWhat the payer sends, in the switch's currency.SW-6.1
amount.valuestringyesA decimal string greater than zero, such as "250.00". Never a JSON number. (pattern ^\d{1,12}(\.\d{1,2})?$)SW-6.3
amount.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
ResponseTypeRequiredMeaningClause
quote_idstring, uuidyesThe quote's id, to send with the payment.SW-6.6
sendobjectyesWhat the payer's side sends, in the switch's currency.SW-7.5
send.valuestringyesA decimal string with exactly two decimals, such as "250.00". Never a JSON number. (pattern ^\d+\.\d{2}$)SW-6.4
send.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
receiveobjectyesWhat the payee receives, in the other country's currency.SW-7.5
receive.valuestringyesA decimal string with exactly two decimals, such as "250.00". Never a JSON number. (pattern ^\d+\.\d{2}$)SW-6.4
receive.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
ratestringyesThe exchange rate, as a string with two decimals. (pattern ^\d+\.\d{2}$)SW-7.5
feeobjectyesThe switch's fixed link fee, in its own currency.SW-7.5
fee.valuestringyesA decimal string with exactly two decimals, such as "250.00". Never a JSON number. (pattern ^\d+\.\d{2}$)SW-6.4
fee.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
total_debitobjectyesWhat leaves the payer's account: send plus fee.SW-7.5
total_debit.valuestringyesA decimal string with exactly two decimals, such as "250.00". Never a JSON number. (pattern ^\d+\.\d{2}$)SW-6.4
total_debit.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
expires_atstring, date-timeyesWhen the quote stops being usable, 600 seconds after it was made.SW-7.6

Errors

  • 422 NOT_CROSS_BORDER (SW-7.4)
  • 403 ADDRESS_NOT_OWNED (SW-7.4)
  • 422 UNKNOWN_CURRENCY (SW-6.2)
  • 422 INVALID_AMOUNT (SW-6.3)
  • 400 IDEMPOTENCY_KEY_INVALID (SW-5.2)
  • 422 IDEMPOTENCY_KEY_REUSED (SW-5.4)
  • 409 REQUEST_IN_PROGRESS (SW-5.5)

7.3 Send a payment

POST /v1/payments with Idempotency-Key and { id?, from_address, from_name?, to_address, amount, note?, quote_id?, collect_request_id? }. The members payer and credential are for providers only (OCI-PAY-3).

When a bank sends a payment, the bank has already checked its customer’s PIN and set the money aside. The switch only credits the payee.

  • SW-7.7 from_address MUST be one the caller speaks for (403 ADDRESS_NOT_OWNED). to_address MUST differ from it (422 SELF_PAYMENT). amount MUST be in the switch’s currency (422 CURRENCY_MISMATCH) and is the principal, without the fee.
  • SW-7.8 A bank’s payment MUST NOT carry payer or credential (422 PAYER_NOT_ALLOWED). The switch does not call /switch/v1/debit for it.
  • SW-7.9 A domestic payment MUST NOT carry a quote_id (422 QUOTE_NOT_ALLOWED). A cross-border payment MUST carry one (422 QUOTE_REQUIRED). The quote MUST exist and belong to the caller (404 QUOTE_NOT_FOUND), be unused (409 QUOTE_USED) and unexpired (410 QUOTE_EXPIRED). The payment’s amount MUST equal the quote’s send, its to_address the quote’s, and its from_address the quote’s when the quote named one (422 QUOTE_MISMATCH). The bank sets aside the quote’s total_debit.
  • SW-7.10 A payment with collect_request_id pays that request (§11). The request MUST name the caller’s side as payer (404 REQUEST_NOT_FOUND), the same two addresses and the same amount in the payee’s currency (422 REQUEST_MISMATCH), be pending or approved with no payment attached (409 REQUEST_NOT_PAYABLE), and be unexpired (410 REQUEST_EXPIRED).
  • SW-7.11 An id the switch already holds for another payment MUST be refused with 409 PAYMENT_ID_TAKEN.
  • SW-7.12 The switch MUST record the payment, claim the quote and the request, and then run it (§9) before it answers. The answer is the payment record (SW-7.13), with status completed, failed or pending.
  • SW-7.13 A payment record is { id, status, state, failure_reason, direction, from_address, to_address, to_name, amount, receive, fee, rate, note, collect_request_id, created_at, completed_at }. status is what a bank acts on: pending (state received or credited), completed, failed or reversed. state is the switch’s state (§9). direction is domestic, outbound or inbound. receive, fee and rate are set for cross-border payments only.
POST /v1/payments Send a payment · served by the switch

Records a payment the bank has already set the money aside for, credits the payee and answers the payment record. Called by a bank of the switch's country. Defined in SW-5.1, SW-7.7, SW-7.8, SW-7.9, SW-7.10, SW-7.11, SW-7.12, SW-7.13.

RequestTypeRequiredMeaningClause
idstring, uuidThe payment id the bank chose; the switch chooses one when absent.SW-6.6
from_addressstringyesThe payer's address; it must be one the caller speaks for. (at most 200 characters)SW-7.7
from_namestringThe payer's name, as the bank holds it.
to_addressstringyesThe payee's address; it must differ from from_address. (at most 200 characters)SW-7.7
amountobjectyesThe principal, in the switch's currency, without the fee.SW-7.7
amount.valuestringyesA decimal string greater than zero, such as "250.00". Never a JSON number. (pattern ^\d{1,12}(\.\d{1,2})?$)SW-6.3
amount.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
notestringFree text from the payer, at most 140 characters. (at most 140 characters)SW-6.9
quote_idstring, uuidThe quote this payment uses: required for a cross-border payment, refused for a domestic one.SW-7.9
collect_request_idstring, uuidThe request for money this payment pays.SW-7.10
payerobjectFor providers only (OCI-PAY-3): the account the money leaves. A bank must not send it.SW-7.8, PSP-11.1, PSP-11.2
payer.bankstringyesThe registry id of the bank that holds the account, such as bank:sbi.
payer.accountstringyesThe account reference that bank gave the provider.
credentialstringFor providers only (OCI-PAY-3): the PIN as a JWE to the bank's key. A bank must not send it. A new PIN message for this payment (PSP-8.6); payment apps only. (at most 4000 characters)SW-7.8, PSP-11.1, PSP-8.6
ResponseTypeRequiredMeaningClause
idstring, uuidyesThe payment id.SW-6.6
status"pending" | "completed" | "failed" | "reversed"yesWhat a bank acts on: pending while the state is received or credited.SW-7.13
state"received" | "credited" | "completed" | "failed" | "reversed"yesThe switch's own state of the payment.SW-9.1
failure_reasonstring, nullyesWhy the payment failed: the refusal's code, or one the switch sets.SW-9.3
direction"domestic" | "outbound" | "inbound"yesWhether the payment stays in the country, leaves it, or came from the other country.SW-7.13
from_addressstringyesThe payer's address. (at most 200 characters)SW-6.8
to_addressstringyesThe payee's address. (at most 200 characters)SW-6.8
to_namestring, nullyesThe payee's name, when the payee's side gave one.
amountobjectyesThe principal, in the switch's currency, without the fee.SW-7.7
amount.valuestringyesA decimal string with exactly two decimals, such as "250.00". Never a JSON number. (pattern ^\d+\.\d{2}$)SW-6.4
amount.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
receiveobject, nullyesWhat the payee receives, in the other country's currency; set for cross-border payments only.SW-7.13
feeobject, nullyesThe link fee in the switch's currency; set for cross-border payments only.SW-7.13
ratestring, nullyesThe exchange rate with two decimals; set for cross-border payments only.SW-7.13
notestring, nullyesFree text from the payer, at most 140 characters. (at most 140 characters)SW-6.9
collect_request_idstring, null, uuidyesThe request for money this payment pays, if any.SW-7.10
created_atstring, date-timeyesWhen the switch recorded the payment.SW-6.7
completed_atstring, null, date-timeyesWhen the payment completed, once it has.SW-6.7

Errors

7.4 Read a payment

GET /v1/payments/{id}, signed over the empty body.

  • SW-7.14 The switch MUST return the record of a payment only to a participant that is its payer bank, its payee participant, or the provider that started it. Anyone else MUST get 404 PAYMENT_NOT_FOUND, the same answer as for an unknown id.
  • SW-7.15 A read MUST NOT move the payment forward. To move it forward the bank repeats the POST (SW-5.6, SW-10.5).
GET /v1/payments/{payment_id} Read a payment · served by the switch

Returns the current record of a payment the caller is a party to, without moving it forward. Called by a bank of the switch's country. Defined in SW-7.14, SW-7.15, SW-10.4.

Request: no body.

ResponseTypeRequiredMeaningClause
idstring, uuidyesThe payment id.SW-6.6
status"pending" | "completed" | "failed" | "reversed"yesWhat a bank acts on: pending while the state is received or credited.SW-7.13
state"received" | "credited" | "completed" | "failed" | "reversed"yesThe switch's own state of the payment.SW-9.1
failure_reasonstring, nullyesWhy the payment failed: the refusal's code, or one the switch sets.SW-9.3
direction"domestic" | "outbound" | "inbound"yesWhether the payment stays in the country, leaves it, or came from the other country.SW-7.13
from_addressstringyesThe payer's address. (at most 200 characters)SW-6.8
to_addressstringyesThe payee's address. (at most 200 characters)SW-6.8
to_namestring, nullyesThe payee's name, when the payee's side gave one.
amountobjectyesThe principal, in the switch's currency, without the fee.SW-7.7
amount.valuestringyesA decimal string with exactly two decimals, such as "250.00". Never a JSON number. (pattern ^\d+\.\d{2}$)SW-6.4
amount.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
receiveobject, nullyesWhat the payee receives, in the other country's currency; set for cross-border payments only.SW-7.13
feeobject, nullyesThe link fee in the switch's currency; set for cross-border payments only.SW-7.13
ratestring, nullyesThe exchange rate with two decimals; set for cross-border payments only.SW-7.13
notestring, nullyesFree text from the payer, at most 140 characters. (at most 140 characters)SW-6.9
collect_request_idstring, null, uuidyesThe request for money this payment pays, if any.SW-7.10
created_atstring, date-timeyesWhen the switch recorded the payment.SW-6.7
completed_atstring, null, date-timeyesWhen the payment completed, once it has.SW-6.7

Errors

7.5 Ask for money

POST /v1/collect-requests with Idempotency-Key and { id?, payee_address, payee_name?, payee_assurance?, payer_address, amount, note?, expires_at? }. The caller is the payee’s side.

  • SW-7.16 payee_address MUST be one the caller speaks for (403 ADDRESS_NOT_OWNED) and differ from payer_address (422 SELF_REQUEST). amount MUST be in the switch’s currency (422 CURRENCY_MISMATCH).
  • SW-7.17 expires_at defaults to 24 hours after the request is made. It MUST be in the future and no more than 30 days ahead (422 INVALID_EXPIRY). An id already in use MUST be refused with 409 REQUEST_ID_TAKEN.
  • SW-7.18 The switch MUST deliver the request before it answers: to the payer’s bank (SW-8.7), to the peer switch when the payer is in the other country (OCI-PAY-4), or to the provider that issued the payer’s address (OCI-PAY-3). If the payer’s bank has its own app (OCI-PAY-3), the app gets a copy too.
  • SW-7.19 If delivery fails, the switch MUST delete the request and answer: 503 DELIVERY_FAILED when the other side did not answer, 404 PAYER_NOT_FOUND when it answered 404, 422 REQUEST_REJECTED for any other refusal.
  • SW-7.20 The answer is { id, status, payee_address, payer_address, amount, expires_at }, with status pending.
POST /v1/collect-requests Ask for money · served by the switch

Records a request for money and delivers it to the payer's side before answering; no money moves. Called by the payee's bank. Defined in SW-5.1, SW-7.16, SW-7.17, SW-7.18, SW-7.19, SW-7.20.

RequestTypeRequiredMeaningClause
idstring, uuidThe request id the bank chose; the switch chooses one when absent.SW-7.17
payee_addressstringyesThe address asking for money; it must be one the caller speaks for. (at most 200 characters)SW-7.16
payee_namestringThe payee's name, passed to the payer as sent.
payee_assurance"low" | "substantial" | "high"How strongly the payee's identity was checked, passed to the payer as sent.
payer_addressstringyesThe address asked to pay; it must differ from payee_address. (at most 200 characters)SW-7.16
amountobjectyesThe amount asked for, in the switch's currency.SW-7.16
amount.valuestringyesA decimal string greater than zero, such as "250.00". Never a JSON number. (pattern ^\d{1,12}(\.\d{1,2})?$)SW-6.3
amount.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
notestringFree text from the payee, at most 140 characters. (at most 140 characters)SW-6.9
expires_atstring, date-timeWhen the request stops being payable: in the future, at most 30 days ahead, 24 hours by default.SW-7.17
ResponseTypeRequiredMeaningClause
idstring, uuidyesThe request id.SW-6.6
status"pending"yesAlways pending: the request was delivered and not yet answered.SW-7.20
payee_addressstringyesThe address asking for money. (at most 200 characters)SW-6.8
payer_addressstringyesThe address asked to pay. (at most 200 characters)SW-6.8
amountobjectyesThe amount asked for, in the switch's currency.SW-6.1
amount.valuestringyesA decimal string with exactly two decimals, such as "250.00". Never a JSON number. (pattern ^\d+\.\d{2}$)SW-6.4
amount.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
expires_atstring, date-timeyesWhen the request stops being payable.SW-7.17

Errors

7.6 Answer or withdraw a request

POST /v1/collect-requests/{id}/status with { status, report? }.

  • SW-7.21 status MUST be approved, declined, cancelled or expired (422 INVALID_STATUS). Only the switch sets paid (SW-11.4). report is kept only with declined: the payer reports the request as unwanted.
  • SW-7.22 The caller MUST be a party to the request (404 REQUEST_NOT_FOUND). The payer’s side MAY move pending to approved, and pending or approved to declined. The payee’s side MAY move pending or approved to cancelled. Either side MAY set expired once expires_at has passed. When one participant is on both sides, cancelled is taken as the payee speaking and any other status as the payer.
  • SW-7.23 Setting the status the request already has MUST succeed and change nothing, with relayed: false.
  • SW-7.24 A refused change answers 409: REQUEST_BEING_PAID for declined, cancelled or expired while a payment is attached, REQUEST_CLOSED when the request is already closed, NOT_ALLOWED otherwise. approved after expires_at answers 410 REQUEST_EXPIRED.
  • SW-7.25 The switch MUST pass the new status to the other party (SW-8.8) and answer { id, status, relayed }. relayed says whether the other party accepted it. A failed relay does not undo the change.
  • SW-7.26 Approving a request does not pay it. The payer’s bank pays it with a payment that names it (SW-7.10).
POST /v1/collect-requests/{request_id}/status Answer or withdraw a request · served by the switch

The payer's side approves or declines a request, the payee's side cancels it, and either marks it expired. Called by the payer's or the payee's bank. Defined in SW-7.21, SW-7.22, SW-7.23, SW-7.24, SW-7.25, SW-7.26.

RequestTypeRequiredMeaningClause
status"approved" | "declined" | "cancelled" | "expired"yesThe new status; only the switch sets paid.SW-7.21
reportbooleanWith declined only: the payer reports the request as unwanted.SW-7.21
ResponseTypeRequiredMeaningClause
idstring, uuidyesThe request id.SW-6.6
status"approved" | "declined" | "cancelled" | "expired"yesThe status the request now has.
relayedbooleanyesWhether the other party accepted the new status; false when nothing changed.SW-7.25

Errors

8. Calls the switch makes on a bank

A bank’s connector serves these under /switch/v1 at its base_url. All are POST, signed by the switch (§4), and answer 200 on success.

  • SW-8.1 POST /switch/v1/lookup with { address }. The bank MUST answer { address, name, verified, bank_name, country, assurance, cross_border } for one of its own accounts, or 404 ADDRESS_NOT_FOUND. assurance is low, substantial or high (CORE-4). The bank MUST NOT answer for its internal accounts.
POST /switch/v1/lookup Look up one of the bank's addresses · served by a bank

Returns the holder of one of the bank's own customer addresses, never an internal account. Called by the switch of the bank's own country. Defined in SW-8.1, SW-7.1.

RequestTypeRequiredMeaningClause
addressstringyesThe address to look up. (at most 200 characters)SW-6.8
ResponseTypeRequiredMeaningClause
addressstringyesThe address looked up, lower-cased. (at most 200 characters)SW-6.8
namestringyesThe account holder's name.
verifiedbooleanyesWhether the name comes from a checked identity.
bank_namestringyesThe bank that holds the account; the switch falls back to its registry display_name.SW-7.2
countrystringyesThe ISO 3166-1 alpha-2 country of the account. (pattern ^[A-Z]{2}$)
assurance"low" | "substantial" | "high"yesHow strongly the holder's identity was checked (CORE-4).SW-8.1
cross_borderbooleanyesTrue when the account is in the other country.SW-7.2

Errors

  • 404 ADDRESS_NOT_FOUND (SW-8.1)
  • SW-8.2 POST /switch/v1/credit with Idempotency-Key and { "payment": { id, from_address, from_name, to_address, amount, fx, note, collect_request_id, created_at, to_account?, from_country? } }. amount is in the payee’s currency. fx is null for a domestic payment, else { rate, send, receive }. to_account is set when a provider issued to_address: it is the reference the bank gave that provider (OCI-PAY-3). from_country is set for a payment from the other country.
  • SW-8.3 The bank MUST credit the account and answer { "status": "credited", "id": "<payment id>" }, or refuse with a 4xx error: 404 ADDRESS_NOT_FOUND, or 422 CURRENCY_MISMATCH when the account is in another currency. The bank MUST credit a payment id at most once and MUST answer a repeat as it answered the first. The switch also accepts a 2xx whose status is failed or rejected as a refusal, with an optional failure_reason, and an optional payee_name with a credit.
POST /switch/v1/credit Credit the payee · served by a bank

Credits the account behind the payee's address, at most once per payment id. Called by the switch of the bank's own country. Defined in SW-8.2, SW-8.3, SW-5.8.

RequestTypeRequiredMeaningClause
paymentobjectyesThe payment as the switch describes it to the payee's bank.
payment.idstring, uuidyesThe payment id; the bank credits it at most once.SW-5.8
payment.from_addressstringyesThe payer's address. (at most 200 characters)SW-6.8
payment.from_namestring, nullyesThe payer's name, as the payer's side gave it.
payment.to_addressstringyesThe payee's address. (at most 200 characters)SW-6.8
payment.amountobjectyesThe amount to credit, in the payee's currency.SW-8.2
payment.amount.valuestringyesA decimal string with exactly two decimals, such as "250.00". Never a JSON number. (pattern ^\d+\.\d{2}$)SW-6.4
payment.amount.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
payment.fxobject, nullyesNull for a domestic payment, else the rate and both sides' amounts.SW-8.2
payment.notestring, nullyesFree text from the payer, at most 140 characters. (at most 140 characters)SW-6.9
payment.collect_request_idstring, null, uuidyesThe request for money this payment pays, if any.SW-6.6
payment.created_atstring, date-timeyesWhen the switch recorded the payment.SW-6.7
payment.to_accountstringSet when a provider issued to_address: the reference the bank gave that provider.SW-8.2
payment.from_countrystringSet for a payment from the other country: the payer's country. (pattern ^[A-Z]{2}$)SW-8.2
ResponseTypeRequiredMeaningClause
status"credited" | "failed" | "rejected"yescredited when the bank credited the account; the switch also takes failed or rejected as a refusal.SW-8.3
idstring, uuidyesThe payment id.SW-6.6
failure_reasonstringOptional, with failed or rejected: why the credit was refused.SW-8.3
payee_namestringOptional, with a credit: the payee's name.SW-8.3

Errors

  • 404 ADDRESS_NOT_FOUND (SW-8.3)
  • 422 CURRENCY_MISMATCH (SW-8.3)
  • SW-8.4 POST /switch/v1/debit with { "payment": { id, account, provider, from_address, to_address, to_name, to_country, amount, fee, fx, note }, "pin": "<JWE>" | null }. The switch sends it only for a payment a provider started (OCI-PAY-3). The bank MUST check that provider may use the account account names (403 PROVIDER_NOT_ALLOWED), check the PIN, and set aside amount plus fee. It answers { id, status, failure_reason } with status held.
  • SW-8.5 The debit is repeat-safe on the payment id. A repeat MUST answer what the bank already did, whether or not it carries a PIN: held, captured or released. The same id for another account MUST answer 409 PAYMENT_ID_TAKEN. A call with no PIN for an id the bank never held MUST answer 404 DEBIT_NOT_FOUND. Refusals: 422 CURRENCY_MISMATCH, 422 INSUFFICIENT_FUNDS, and the PIN errors of §13.
POST /switch/v1/debit Hold the payer's money · served by a bank

For a payment a provider started, checks the provider and the PIN and sets amount plus fee aside. Called by the switch of the bank's own country. Defined in SW-8.4, SW-8.5, SW-9.6, SW-9.8.

RequestTypeRequiredMeaningClause
paymentobjectyesThe payment as the switch describes it to the payer's bank.
payment.idstring, uuidyesThe payment id; the debit is repeat-safe on it.SW-8.5
payment.accountstringyesThe account reference the bank gave the provider.SW-8.4
payment.providerstringyesThe registry id of the provider that started the payment.SW-8.4
payment.from_addressstringyesThe payer's address at the provider. (at most 200 characters)SW-6.8
payment.to_addressstringyesThe payee's address. (at most 200 characters)SW-6.8
payment.to_namestring, nullyesThe payee's name, when known.
payment.to_countrystringyesThe payee's country. (pattern ^[A-Z]{2}$)
payment.amountobjectyesThe principal, in the payer's currency.SW-6.1
payment.amount.valuestringyesA decimal string with exactly two decimals, such as "250.00". Never a JSON number. (pattern ^\d+\.\d{2}$)SW-6.4
payment.amount.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
payment.feeobject, nullyesThe link fee for a cross-border payment, else null.SW-6.1
payment.fxobject, nullyesNull for a domestic payment, else the rate and both sides' amounts.
payment.notestring, nullyesFree text from the payer, at most 140 characters. (at most 140 characters)SW-6.9
pinstring, nullyesThe PIN as a compact JWE to the bank's PIN key, sent on the first debit only; null on a later attempt.SW-9.8
ResponseTypeRequiredMeaningClause
idstring, uuidyesThe payment id.SW-6.6
status"held" | "captured" | "released"yesWhat the bank has done with the money for this payment id.SW-8.5
failure_reasonstring, nullyesWhy the money was released, when it was.

Errors

  • SW-8.6 POST /switch/v1/debit/{id}/capture with {} takes the held money. POST /switch/v1/debit/{id}/release with { reason } gives it back. Both answer { id, status, failure_reason }, and 404 DEBIT_NOT_FOUND when the bank holds nothing for that id. The first of the two to arrive wins. A later call of either kind answers the outcome that stands.
POST /switch/v1/debit/{payment_id}/capture Take the held money · served by a bank

Once the payment completed, turns the hold into a debit; the first of capture and release wins. Called by the switch of the bank's own country. Defined in SW-8.6, SW-9.7.

RequestTypeRequiredMeaningClause
ResponseTypeRequiredMeaningClause
idstring, uuidyesThe payment id.SW-6.6
status"held" | "captured" | "released"yesWhat the bank has done with the money for this payment id.SW-8.5
failure_reasonstring, nullyesWhy the money was released, when it was.

Errors

POST /switch/v1/debit/{payment_id}/release Give the held money back · served by a bank

Once the payment failed, drops the hold so the money is free again; the first of capture and release wins. Called by the switch of the bank's own country. Defined in SW-8.6, SW-9.7.

RequestTypeRequiredMeaningClause
reasonstringyesWhy the payment failed: its failure_reason.SW-8.6
ResponseTypeRequiredMeaningClause
idstring, uuidyesThe payment id.SW-6.6
status"held" | "captured" | "released"yesWhat the bank has done with the money for this payment id.SW-8.5
failure_reasonstring, nullyesWhy the money was released, when it was.

Errors

  • SW-8.7 POST /switch/v1/collect-requests with { "request": { id, payee_address, payee_name, payee_assurance, payee_country, payer_address, amount, note, expires_at, created_at } } delivers a request for money to the payer’s bank. amount is in the payee’s currency. The bank MUST answer { id, status }, 404 ADDRESS_NOT_FOUND for an unknown payer, or 422 REQUEST_EXPIRED if expires_at has passed. A repeat of the same id MUST NOT create a second request.
POST /switch/v1/collect-requests Deliver a request for money · served by a bank

Delivers a request for money to the payer's bank, which keeps one copy per request id. Called by the switch of the bank's own country. Defined in SW-8.7.

RequestTypeRequiredMeaningClause
requestobjectyesThe request as the switch describes it to the payer's bank.
request.idstring, uuidyesThe request id; a repeat must not create a second request.SW-8.7
request.payee_addressstringyesThe address asking for money. (at most 200 characters)SW-6.8
request.payee_namestring, nullyesThe payee's name, as the payee's side sent it.
request.payee_assurance"low" | "substantial" | "high" | "null"yesHow strongly the payee's identity was checked, as the payee's side sent it.
request.payee_countrystringyesThe payee's country. (pattern ^[A-Z]{2}$)
request.payer_addressstringyesThe bank's address asked to pay. (at most 200 characters)SW-6.8
request.amountobjectyesThe amount asked for, in the payee's currency.SW-8.7
request.amount.valuestringyesA decimal string with exactly two decimals, such as "250.00". Never a JSON number. (pattern ^\d+\.\d{2}$)SW-6.4
request.amount.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
request.notestring, nullyesFree text from the payee, at most 140 characters. (at most 140 characters)SW-6.9
request.expires_atstring, date-timeyesWhen the request stops being payable.SW-6.7
request.created_atstring, date-timeyesWhen the switch recorded the request.SW-6.7
ResponseTypeRequiredMeaningClause
idstring, uuidyesThe request id.SW-6.6
status"pending" | "approved" | "declined" | "cancelled" | "expired" | "paid"yesThe status of the bank's copy of the request.

Errors

  • SW-8.8 POST /switch/v1/collect-requests/{id}/status with { status, report?, side? } tells a bank how a request moved. status is approved, declined, cancelled, expired or paid. The switch sends it to the other party of a status change (SW-7.25), sends paid to the payee’s side when a payment for the request completes, and sends side: "payer" to the payer’s bank when the bank’s own app answered the request (OCI-PAY-3). The bank answers { id, status }, or 404 REQUEST_NOT_FOUND.
POST /switch/v1/collect-requests/{request_id}/status A request for money moved · served by a bank

Tells a bank the new status of a request it made or received. Called by the switch of the bank's own country. Defined in SW-8.8, SW-7.25, SW-9.5.

RequestTypeRequiredMeaningClause
status"approved" | "declined" | "cancelled" | "expired" | "paid"yesThe request's new status.SW-8.8
reportbooleanPassed on with declined: the payer reported the request as unwanted.SW-7.21
side"payer"Sent to the payer's bank when the bank's own app answered the request (OCI-PAY-3).SW-8.8
ResponseTypeRequiredMeaningClause
idstring, uuidyesThe request id.SW-6.6
status"pending" | "approved" | "declined" | "cancelled" | "expired" | "paid"yesThe status of the bank's copy of the request.

Errors

  • 404 REQUEST_NOT_FOUND (SW-8.8)
  • SW-8.9 A bank’s connector also serves /switch/v1/connect/accounts, /switch/v1/connect/link, /switch/v1/connect/unlink and /switch/v1/balance, which the switch calls for a provider. OCI-PAY-3 defines them.

9. Payment states

A payment at the switch has a state and, if a provider started it, a debit_state.

stateMeaning
receivedRecorded. The payee has not been credited.
creditedThe payee’s bank, or the peer switch, has accepted the credit.
completedFinal. Positions are written.
failedFinal. Nobody was credited.
reversedReserved. Nothing produces it in this version.
  • SW-9.1 A payment starts received. It MAY move received to credited or failed, and credited to completed. No other move is allowed. completed and failed are final.
  • SW-9.2 The switch MUST move received to credited only when the credit was accepted: a 2xx from the payee’s bank that is not a refusal (SW-8.3), or for a cross-border payment a link answer of completed (OCI-PAY-4).
  • SW-9.3 The switch MUST move received to failed only on a definite refusal (SW-10.2). The failure_reason is the refusal’s error code or failure_reason. On failure the switch MUST free the quote (it may be used again) and the request for money (it may be paid again).
  • SW-9.4 The switch MUST move credited to completed and write the payment’s positions (§12) in one transaction. It MUST NOT complete a payment whose positions do not sum to zero in each currency.
  • SW-9.5 After a domestic or inbound payment completes, the switch tells the provider behind the payee’s address, if there is one (OCI-PAY-3). After any payment for a request completes, it marks the request paid and, when the payee’s side is in its own country, tells it (SW-8.8). Across the link the peer switch tells its own side (OCI-PAY-4). Both are best effort and do not change the payment.
  • SW-9.6 For a payment a provider started, debit_state starts empty. The switch MUST ask the payer’s bank to hold the money (SW-8.4) before it credits anyone, and MUST set debit_state to held before it moves on. A refused debit fails the payment.
  • SW-9.7 Once such a payment is completed the switch MUST capture the held money, and once it is failed it MUST release it (SW-8.6). debit_state becomes captured or released only when the bank answers 2xx. Until then it stays held and the next attempt (SW-10.5) sends it again.
  • SW-9.8 The switch MUST NOT keep the PIN of a provider’s payment. It is passed to the bank in the first debit and dropped. A later attempt sends no PIN and the bank answers only what it already did (SW-8.5).

10. Timeouts, retries and unknown outcomes

  • SW-10.1 The switch waits at most 4 seconds for a bank or a provider and 7 seconds for the peer switch. A bank’s connector waits at most 10 seconds for the switch.
  • SW-10.2 The switch MUST sort every reply to a money-moving call into one of three kinds. Ok: a 2xx. Refused: a 4xx, except the three answers of SW-5.9. Unknown: a timeout, a transport error, a 5xx, or one of the answers of SW-5.9. Only a refusal may fail a payment. An unknown outcome MUST leave the payment where it is.
  • SW-10.3 A bank’s connector MUST treat the switch’s answer the same way, and in addition MUST treat every 409, a 408 and a 429 as unknown. On completed it takes the money it set aside, on failed (or reversed) it gives it back, and on anything else it keeps it set aside.
  • SW-10.4 On an unknown answer that says the switch already has the payment, the connector SHOULD read the payment (GET /v1/payments/{id}) and act on its status.
  • SW-10.5 The switch has no timer of its own. A payment stuck in received or credited, or with a debit_state of held after it ended, moves forward only when: the bank repeats the POST /v1/payments with the same key and body (SW-5.6), the peer switch repeats a link payment (OCI-PAY-4), or an operator calls POST /v1/payments/{id}/retry.
  • SW-10.6 A bank’s connector MUST keep checking each payment it sent that is still pending. The reference checks every 5 seconds: it reads the payment, and if the switch has no record (404) or still says pending, it repeats the POST with the same body and key, at most once every 30 seconds per payment and not before the payment is 30 seconds old. It MUST NOT post a payment a provider started; it only reads it.
  • SW-10.7 A repeat of a credit, debit, capture or release with the same payment id MUST NOT move money twice (SW-5.8).

11. Requests for money

statusMeaning
pendingDelivered, not answered.
approvedThe payer’s side said yes. Not yet paid.
declinedThe payer’s side said no. Final.
cancelledThe payee’s side withdrew it. Final.
expiredPast expires_at, and a party said so. Final.
paidA payment for it completed. Final.
  • SW-11.1 A request keeps the same id at every participant that holds a copy, on both switches.
  • SW-11.2 At most one payment can be attached to a request at a time. A failed payment frees it (SW-9.3).
  • SW-11.3 The switch does not expire requests on its own. expired is set by a party (SW-7.22). A payment for a request past expires_at is refused (SW-7.10).
  • SW-11.4 The switch MUST set paid when a payment that names the request completes, in the same transaction as the positions.
  • SW-11.5 A request is never needed to receive money.

12. Positions and settlement

Each switch records what it owes each participant and what each owes it. Settlement nets these. Moving the money itself (for example over a central bank’s settlement system) is outside OCI-PAY-2.

  • SW-12.1 The switch MUST write one position row per movement when a payment completes. A position is a participant, a currency and a signed amount in minor units. Positive means the switch owes the participant.
  • SW-12.2 The rows for one payment MUST sum to zero in each currency. They are, for an amount x and fee f:
    • domestic: payer’s bank -x, payee’s bank +x;
    • outbound: payer’s bank -x and -f, link:<peer country> +x, fees:<own country> +f;
    • inbound: payee’s bank +y (the amount received), link:<peer country> -y.
  • SW-12.3 For a payment a provider started, the payer is the bank that holds the account. Providers hold no positions.
  • SW-12.4 A settlement cycle MUST take every open position row, mark it settled by that cycle, and return the net per participant and currency, in one transaction. It answers { id, status, created_at, payments_settled, banks, link, fees, balanced }, where each entry is { participant, net, direction } and link also carries peer and equivalent (the net in the peer’s currency at the fixed rate). direction is switch_pays_bank, bank_pays_switch, switch_owes_peer, peer_owes_switch, fee_income, fee_reversal or flat. balanced is true when the nets sum to zero in each currency.
  • SW-12.5 A cycle with no open positions MUST answer 409 NOTHING_TO_SETTLE. A position row belongs to exactly one cycle.
  • SW-12.6 Cycles are started by an operator (POST /v1/settlement/cycles, with Idempotency-Key). Open positions are read with GET /v1/settlement/positions and past cycles with GET /v1/settlement/cycles. These operator calls take a bearer admin token or a signed-in operator’s OCI-ID token, not an OCI-Signature. No bank calls them.
POST /v1/settlement/cycles Run a settlement cycle · served by the switch

Settles every open position row in one transaction and returns the net per participant and currency. Called by an operator, with a bearer admin token or an OCI-ID sign-in. Defined in SW-12.4, SW-12.5, SW-12.6, SW-5.1.

Request: no body.

ResponseTypeRequiredMeaningClause
idstring, uuidyesThe cycle id.SW-6.6
status"settled"yesThe cycle's status.
created_atstring, date-timeyesWhen the cycle ran.SW-6.7
payments_settledintegeryesHow many payments' positions the cycle settled.
banksarray of objectyesThe net for each bank.SW-12.4
banks[].participantstringyesThe participant id, or link:<CC> or fees:<CC>.
banks[].netobjectyesThe participant's net; positive means the switch owes it.SW-6.4
banks[].net.valuestringyesA decimal string with exactly two decimals; settlement nets may be negative. (pattern ^-?\d+\.\d{2}$)SW-6.4
banks[].net.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
banks[].direction"switch_pays_bank" | "bank_pays_switch" | "switch_owes_peer" | "peer_owes_switch" | "fee_income" | "fee_reversal" | "flat"yesWhich way the net is owed.SW-12.4
linkobject, nullyesThe net with the peer switch, or null when there is none.
feesarray of objectyesThe switch's fee income, per currency.SW-12.4
fees[].participantstringyesThe participant id, or link:<CC> or fees:<CC>.
fees[].netobjectyesThe participant's net; positive means the switch owes it.SW-6.4
fees[].net.valuestringyesA decimal string with exactly two decimals; settlement nets may be negative. (pattern ^-?\d+\.\d{2}$)SW-6.4
fees[].net.currency"INR" | "USD"yesThe ISO 4217 code: INR or USD.SW-6.2
fees[].direction"switch_pays_bank" | "bank_pays_switch" | "switch_owes_peer" | "peer_owes_switch" | "fee_income" | "fee_reversal" | "flat"yesWhich way the net is owed.SW-12.4
balancedbooleanyesTrue when the nets sum to zero in each currency.SW-12.4

Errors

  • 409 NOTHING_TO_SETTLE (SW-12.5)
  • 400 IDEMPOTENCY_KEY_REQUIRED (SW-5.1)
  • 400 IDEMPOTENCY_KEY_INVALID (SW-5.2)
  • 422 IDEMPOTENCY_KEY_REUSED (SW-5.4)
  • 409 REQUEST_IN_PROGRESS (SW-5.5)

13. Errors

  • SW-13.1 Every error body MUST be { "error": { "code": "<CODE>", "message": "<one plain sentence>" } } with the matching HTTP status. code is upper-case SNAKE_CASE, and callers branch on it. This differs from CORE-9.1 (§18).
  • SW-13.2 A malformed body MUST answer 422 VALIDATION_ERROR, after the signature check (SW-4.14).
  • SW-13.3 Messages MUST NOT contain a PIN, a token, or another person’s data.

Codes the switch answers to banks:

StatusCodes
400IDEMPOTENCY_KEY_REQUIRED, IDEMPOTENCY_KEY_INVALID
401SIGNATURE_REQUIRED, SIGNATURE_INVALID, SIGNATURE_EXPIRED, UNKNOWN_PARTICIPANT
403FORBIDDEN, ADDRESS_NOT_OWNED
404ADDRESS_NOT_FOUND, PAYMENT_NOT_FOUND, QUOTE_NOT_FOUND, REQUEST_NOT_FOUND, PAYER_NOT_FOUND
409REQUEST_IN_PROGRESS, PAYMENT_ID_TAKEN, REQUEST_ID_TAKEN, QUOTE_USED, REQUEST_NOT_PAYABLE, REQUEST_BEING_PAID, REQUEST_CLOSED, NOT_ALLOWED, NOTHING_TO_SETTLE
410QUOTE_EXPIRED, REQUEST_EXPIRED
422VALIDATION_ERROR, INVALID_ADDRESS, UNKNOWN_CURRENCY, INVALID_AMOUNT, AMOUNT_TOO_SMALL, CURRENCY_MISMATCH, SELF_PAYMENT, SELF_REQUEST, NOT_CROSS_BORDER, QUOTE_REQUIRED, QUOTE_NOT_ALLOWED, QUOTE_MISMATCH, REQUEST_MISMATCH, IDEMPOTENCY_KEY_REUSED, INVALID_EXPIRY, INVALID_STATUS, REQUEST_REJECTED, PAYER_NOT_ALLOWED
502PEER_REJECTED
503TRUST_UNAVAILABLE, BANK_UNAVAILABLE, PEER_UNAVAILABLE, PROVIDER_UNAVAILABLE, DELIVERY_FAILED, PARTICIPANT_UNKNOWN

Codes a bank’s connector answers to the switch:

StatusCodes
400PIN_INVALID, PIN_EXPIRED, PIN_REPLAYED
401SIGNATURE_MISSING, SIGNATURE_INVALID, SIGNATURE_EXPIRED, UNKNOWN_PARTICIPANT
403FORBIDDEN_PARTICIPANT, PROVIDER_NOT_ALLOWED, WRONG_PIN
404ADDRESS_NOT_FOUND, DEBIT_NOT_FOUND, REQUEST_NOT_FOUND
409PAYMENT_ID_TAKEN
422VALIDATION_ERROR, CURRENCY_MISMATCH, INSUFFICIENT_FUNDS, REQUEST_EXPIRED
423PIN_LOCKED
502TRUST_REGISTRY_UNAVAILABLE, CORE_UNAVAILABLE

A failed payment’s failure_reason is the code of the refusal that failed it (either table), a failure_reason from a 2xx refusal, or one the switch sets: CREDIT_REJECTED, PEER_FAILED, PAYEE_PARTICIPANT_UNKNOWN, PAYER_BANK_UNKNOWN, DEBIT_CLOSED, FAILED.

14. Worked example

Asha (asha@kestrel, at bank:kestrel) pays Ravi (ravi@heron, at bank:heron) INR 500.00 in country IN. The switch is switch:IN at https://switch.in.example, Heron’s connector is at https://pay.heron.example. Signatures are shortened.

Registry entries used:

[
  { "id": "bank:kestrel", "kind": "bank", "country": "IN", "display_name": "Kestrel Bank", "address_suffix": "kestrel",
    "base_url": "https://pay.kestrel.example", "jwks_url": "https://pay.kestrel.example/.well-known/jwks.json", "status": "active", "acts_for": null },
  { "id": "bank:heron", "kind": "bank", "country": "IN", "display_name": "Heron Bank", "address_suffix": "heron",
    "base_url": "https://pay.heron.example", "jwks_url": "https://pay.heron.example/.well-known/jwks.json", "status": "active", "acts_for": null },
  { "id": "switch:IN", "kind": "switch", "country": "IN", "display_name": "India Switch", "address_suffix": null,
    "base_url": "https://switch.in.example", "jwks_url": "https://switch.in.example/.well-known/jwks.json", "status": "active", "acts_for": null }
]

1. Kestrel looks the payee up. POST https://switch.in.example/v1/lookup, body {"address":"ravi@heron"}. The switch asks Heron with POST https://pay.heron.example/switch/v1/lookup and the same body, signed as switch:IN. Heron answers, and the switch passes it on:

{ "address": "ravi@heron", "name": "Ravi Menon", "verified": true, "bank_name": "Heron Bank",
  "country": "IN", "assurance": "high", "cross_border": false }

2. Kestrel checks Asha’s PIN, sets INR 500.00 aside, and sends the payment. Protected header of its signature, decoded:

{ "alg": "EdDSA", "kid": "q7Hc2LkVx0RmT9aB", "iss": "bank:kestrel", "iat": 1795860000, "htm": "POST",
  "htu": "https://switch.in.example/v1/payments" }
POST /v1/payments
OCI-Signature: eyJhbGciOiJFZERTQSIsImtpZCI6InE3SGMyTGtWeDBSbVQ5YUIi...In0..mF3k...Q2Bg
Idempotency-Key: 3f0b6c1e-8a4d-4c2b-9e71-5d2a8f6b0c94
Content-Type: application/json
{ "id": "3f0b6c1e-8a4d-4c2b-9e71-5d2a8f6b0c94", "from_address": "asha@kestrel", "from_name": "Asha Rao",
  "from_country": "IN", "to_address": "ravi@heron", "amount": { "value": "500.00", "currency": "INR" },
  "note": "Dinner", "quote_id": null, "collect_request_id": null }

The switch ignores from_country (SW-6.10). It records the payment as received.

3. The switch credits Heron. POST https://pay.heron.example/switch/v1/credit, signed as switch:IN, with Idempotency-Key: 3f0b6c1e-8a4d-4c2b-9e71-5d2a8f6b0c94:

{ "payment": { "id": "3f0b6c1e-8a4d-4c2b-9e71-5d2a8f6b0c94", "from_address": "asha@kestrel", "from_name": "Asha Rao",
  "to_address": "ravi@heron", "amount": { "value": "500.00", "currency": "INR" }, "fx": null, "note": "Dinner",
  "collect_request_id": null, "created_at": "2026-11-28T10:00:00.412000+00:00" } }

Heron credits Ravi and answers {"status":"credited","id":"3f0b6c1e-8a4d-4c2b-9e71-5d2a8f6b0c94"}. The switch moves the payment to credited, then to completed, and writes two positions: bank:kestrel -50000 INR and bank:heron +50000 INR.

4. The switch answers Kestrel.

{ "id": "3f0b6c1e-8a4d-4c2b-9e71-5d2a8f6b0c94", "status": "completed", "state": "completed", "failure_reason": null,
  "direction": "domestic", "from_address": "asha@kestrel", "to_address": "ravi@heron", "to_name": null,
  "amount": { "value": "500.00", "currency": "INR" }, "receive": null, "fee": null, "rate": null, "note": "Dinner",
  "collect_request_id": null, "created_at": "2026-11-28T10:00:00.412000Z", "completed_at": "2026-11-28T10:00:00.655000Z" }

Kestrel takes the money it set aside. If the switch had not answered within 10 seconds, Kestrel would keep the money aside, read the payment, and repeat step 2 with the same key and body (SW-10.6).

5. Settlement. An operator runs a cycle with this one payment open:

{ "id": "a41f2d9c-6b0e-4f6a-8d3c-1e2b7c9f0a55", "status": "settled", "created_at": "2026-11-28T18:00:00.000000Z",
  "payments_settled": 1,
  "banks": [
    { "participant": "bank:heron", "net": { "value": "500.00", "currency": "INR" }, "direction": "switch_pays_bank" },
    { "participant": "bank:kestrel", "net": { "value": "-500.00", "currency": "INR" }, "direction": "bank_pays_switch" }
  ],
  "link": null, "fees": [], "balanced": true }

15. Security considerations

  • Who may call what. Each endpoint family accepts one kind of participant from one country (SW-4.10). A bank’s connector accepts only its own switch. A bank cannot pay from, ask for money for, or quote for an address it does not speak for (SW-7.7, SW-7.16, SW-7.4).
  • Replay. A signature stays valid for 120 seconds, and there is no jti (SW-4.8). A replayed state-changing call within that window hits its idempotency key, as long as the original carried one (SW-5.1). Quote and status calls may be sent without a key. A replayed signed read returns the same record to the same party.
  • What the signature does not cover. It covers method, URL path and body. It does not cover the query string, the Idempotency-Key header or any other header. Nothing on the rail uses a query string today.
  • Unsigned responses. A caller trusts an answer because it came over TLS from the registry’s base_url (SW-4.16). A compromised TLS endpoint or registry could forge answers, including completed.
  • Key compromise. A bank’s or switch’s signing key lets the holder act as that participant within the endpoint rules. Removing the key from the JWK Set ends it once caches expire (300 seconds in the reference). Suspending the participant in the registry ends it once the participant list cache expires (60 seconds).
  • Unknown outcomes. Treating a timeout as failure could release money the payee was already credited with. SW-10.2 and SW-10.3 keep it pending until an answer is certain.
  • The PIN in a provider’s payment. The PIN message (OCI-PAY-3) is encrypted to the bank and carries a nonce and an iat. It is not bound to the payment’s amount or payee, so the bank relies on the switch for those.
  • Registry outage. Verifiers fail closed (SW-4.15). The switch’s stale list (SW-3.8) means a suspension made during an outage is not seen until the registry is back.

16. Privacy considerations

  • The PIN. For a payment a bank starts, the PIN goes from the customer to the bank and never reaches the switch. For a payment a provider starts, the switch carries the PIN as a JWE encrypted to the bank’s PIN key (ECDH-ES on P-256, A256GCM, as in CORE-5.8). The switch cannot read it, does not store it, and sends it on once (SW-9.8). Only the hash of the request body is kept with the idempotency key.
  • Lookups. A lookup returns the holder’s name and assurance level to any bank of the country, for any address. The switch does not rate-limit lookups. This allows enumeration of names by address (OCI-PAY-1).
  • What the switch keeps. Each payment record keeps both addresses, the payer’s name, the note and the amounts. Each request for money keeps both addresses, the payee’s name and assurance level, and the note. OCI-PAY-2 sets no retention period.
  • What each party sees. A bank sees only payments it is a party to (SW-7.14). The payee’s bank learns the payer’s address and name. Settlement output carries participant ids and nets only.
  • Logs. Implementations follow CORE-7.3. The reference does not log PINs, tokens or bodies.

17. Conformance

A conforming switch serves §7 and the operator calls of §12, makes the calls of §8 as described, keeps the states of §9 and §11, sorts replies as in §10, writes positions as in §12, and answers errors as in §13. It signs and verifies as in §4 and applies §5.

A conforming bank connector serves §8, verifies as in §4, makes the calls of §7, is repeat-safe on payment and request ids (SW-5.8, SW-8.5, SW-8.7), and treats the switch’s answers as in SW-10.3 and SW-10.6.

The reference tests do not cite SW clauses yet. They cover:

ClausesTests
SW-4.1 to 4.12, 4.14, 4.15ocipay-api/tests/test_switch.py (unsigned, badly signed, wrong participant, registry outage, suspended), test_units.py (signature round trip, tamper, malformed); ocipay-bank-api/tests/test_switch.py (bad and malformed signatures, attached payload, alg: none, registry down, inactive participant)
SW-5ocipay-api/tests/test_switch.py (repeat pays once, repeat of a pending payment moves it forward, settlement cycle repeat); ocipay-bank-api/tests/test_switch.py (in-flight duplicate, key scope)
SW-6ocipay-api/tests/test_units.py (money, rounding, addresses)
SW-7, SW-11ocipay-api/tests/test_switch.py (lookup, quotes, payments, input validation, collect requests and status roles, expiry)
SW-8ocipay-bank-api/tests/test_switch.py (lookup, credit once per id, debit, capture, release, request delivery and status)
SW-9, SW-10ocipay-api/tests/test_switch.py and test_providers.py (credit refused, bank timeout then retry, “already have it” answers stay pending, held debit released, capture resent); ocipay-bank-api/tests/test_wren.py (timeout, transport error and 5xx stay pending, 4xx releases)
SW-12ocipay-api/tests/test_switch.py (positions balance, cycles)

No conformance harness runs these against a deployed switch or bank yet. SW-3, SW-4.13, SW-4.16 and SW-10.6 are deployment or behaviour rules that need one.

18. Open questions

Conflicts with OCI-0 and OCI-1.

  • EdDSA and no typ. CORE-5.1 and CORE-5.2 allow only ES256 and PS256, and CORE-5.4 requires typ. The rail uses EdDSA with no typ (SW-4.4, SW-4.5). Either CORE-5 gains a stated exception for OCI-Signature, or the rail moves to ES256 and adds a typ such as oci-signature+jws.
  • Error format. CORE-9.1 says { "error", "error_description" }. The rail uses { "error": { "code", "message" } } (SW-13.1). Pick one, or state the exception in CORE-9.
  • The registry is not OCI-1. OCI-1 is built on OpenID Federation entity statements and trust marks. The rail reads a flat participant list from ocitrust (§3), with no signed statements, no trust marks for bank, switch or provider, and no recognition caps applied. Decide whether to profile the participant list in OCI-1 or move the rail onto entity statements.
  • Country codes. CORE-3.2 says test and fictional countries use XA to XZ. The reference switch accepts only IN and US and uses real currency codes on mock money.
  • Key rotation. CORE-5.6 asks for a new key to be published 24 hours before use and an old key kept until its statements expire. The rail has no rotation procedure beyond SW-4.12 and SW-4.13, and the reference loads one key per participant.

Places the code is silent or looks accidental.

  • Different codes on each side for the same signature failure. The switch answers SIGNATURE_REQUIRED, 403 FORBIDDEN and 503 TRUST_UNAVAILABLE. A bank’s connector answers SIGNATURE_MISSING, 403 FORBIDDEN_PARTICIPANT and 502 TRUST_REGISTRY_UNAVAILABLE. One set should be chosen.
  • A participant with no status. The switch treats it as active, the connector as inactive.
  • Forced key refresh. The switch refetches on every failed verification with no limit. The connector refetches only on an unknown kid and at most every 30 seconds. An attacker can make the switch fetch a JWK Set on every bad request.
  • Ambiguity rules differ. The switch treats 408, 429 and any 409 other than the two in SW-5.9 as refusals. The connector treats them as unknown (SW-10.3). The switch could fail a payment on a 429 from a bank that later credits it.
  • An error after a payment is recorded drops the key. If POST /v1/payments records the payment and then fails (for example the registry is unreachable mid-run), the key is released (SW-5.7). A repeat without an id in the body makes a second payment. With an id it gets 409 PAYMENT_ID_TAKEN, which the connector handles by reading the payment. Should an id be required, or the key kept?
  • A refreshed repeat is not stored. SW-5.6 returns the current record but leaves the stored result as it was, so every later repeat runs the payment again.
  • Debit state can stay held. A bank’s connector captures or releases on its own when it reads a final status (SW-10.3). The switch does not learn of it and keeps debit_state held until something runs the payment again.
  • A debit answered captured fails the payment. If the bank’s answer to a debit is captured or released, the switch fails the payment with DEBIT_CLOSED, even for captured.
  • No switch timer. Nothing moves a stuck payment forward on a schedule (SW-10.5). A provider’s payment stuck after a bank timeout depends on the provider repeating it.
  • The payee is not re-checked at routing. _forward looks the payee participant up without checking it is still active, so a payment recorded before a suspension is still credited.
  • payee_name is optional at the switch but required by the connector. A request for money with no payee_name is refused by the payer’s bank as 422 REQUEST_REJECTED.
  • The connector reports approved after the switch has set paid. After a payment for a request completes, the payer’s connector sends status approved. The switch has already set paid and refuses with 409 REQUEST_CLOSED. The connector logs it and moves on.
  • Ignored members. The connector sends from_country and, for a cross-border payment, fee in POST /v1/payments. The switch ignores both. to_name in the payment record stays null for a bank’s address, because the connector’s credit answer carries no name.
  • Amount limits differ. The switch accepts up to 12 integer digits, the connector 10, capped at 10,000,000.00.
  • Two switches only. The switch finds its peer as “the switch of another country”, and positions name one link. More than two countries needs a rule.
  • Settlement is a record only. Cycles are run by hand. Nothing says when, or how the nets are paid.
  • The link fee is a fixed figure per currency (INR 20.00, USD 1.62), not converted at the rate. OCI-PAY-4 should confirm.
  • Lookup rate limits. The OCI-9 proposal (now OCI-PAY-1) required rate limits and no enumeration. The switch has neither.

Where the existing drafts disagree with the code. docs/api/oci-9-payments.yaml, oci-9-payments-switch.yaml, docs/api/schemas/payments-*.json, docs/api/GAPS.md and plan 003 were written before the build changed. Each point below follows the code.

  • Countries and money. The drafts use Tavora (XT, TVD) and Corvane (XC, CVK) and banks commons, salt, northmere. The code uses IN/INR and US/USD.
  • Money syntax. payments-money.json requires exactly two decimals and no leading zero. The code accepts 0 to 2 decimals and leading zeros on input (SW-6.3), and always sends two.
  • Ids. The drafts use ids such as pay_8c2d41aa, qt_7f3k29xq, rq_4d19b2e7. The code uses UUIDs (SW-6.6).
  • Payment body. The draft wraps the bank’s payment as { "payment": { ... } } with status, credit_amount and updated_at. The code takes a flat body (SW-7.3). The credit call does use { "payment": ... }, but with amount (not credit_amount) and fx.
  • Payment record. payments-payment.json puts the internal state in status and has credit_amount, from_name, to_name required, and updated_at. The code returns status as pending, completed, failed or reversed, the state in state, plus direction, receive and completed_at, and no updated_at (SW-7.13).
  • Quote. The draft answers 201 without total_debit. The code answers 200 with total_debit (SW-7.5). The draft and plan 003 §11 say the originating switch issues quote_id and the peer holds the same id. In the code the peer holds no quote: the link quote returns a price only (OCI-PAY-4).
  • Status codes. The drafts use 201 for created quotes and requests. The code answers 200 everywhere.
  • Validation errors. The drafts give 400 INVALID_REQUEST. The code answers 422 VALIDATION_ERROR.
  • Error codes. payments-error.json lists SIGNATURE_STALE, PARTICIPANT_UNKNOWN, PIN_INCORRECT, AMOUNT_INVALID, RATE_LIMITED, UPSTREAM_UNAVAILABLE, REQUEST_NOT_PENDING. The code uses SIGNATURE_EXPIRED, UNKNOWN_PARTICIPANT, WRONG_PIN, INVALID_AMOUNT, no rate limiting, and specific *_UNAVAILABLE codes (§13).
  • Signature header schema. payments-signature-header.json fixes htm to POST and limits iss to bank: and switch:. The code signs GET /v1/payments/{id} and accepts provider: senders.
  • Collect request at the switch. The draft says the switch replaces payee_name and payee_assurance with its own lookup. The code passes the payee’s values through as sent. The draft says same-country payers only. The code supports both directions over the link. The draft has the payer’s bank report paid with a payment_id. In the code only the switch sets paid (SW-7.21) and banks send approved, declined, cancelled or expired. The draft’s status enum lacks approved and cancelled. The draft and GAPS.md say the switch expires requests itself and tells both banks. It does not (SW-11.3). The draft answers status changes with the full request. The code answers { id, status, relayed }.
  • Bank’s credit answer. The draft answers { payment_id, status } with failed as a possible 200. The connector answers { status: "credited", id } and refuses with a 4xx. The switch accepts both (SW-8.3).
  • Timeouts. The drafts say the bank releases the money after 10 seconds without an answer and reports failed with TIMEOUT, and a 502 means no decision. In the code a timeout or 5xx keeps the payment pending and the money aside (SW-10.3), and plan 003 §11 agrees.
  • PIN digits. payments-pin-claims.json and GAPS.md allow 4 to 8 digits. The connector accepts 4 to 6.
  • Settlement cycle. payments-settlement-cycle.json has country and closed_at. The code returns status and created_at, and direction on each entry (SW-12.4).
  • Admin authentication. The drafts mark admin routes unauthenticated, and plan 003 §11 says 503 ADMIN_DISABLED when no token is set. The code takes the admin token or an operator’s OCI-ID sign-in, and answers 401 otherwise (SW-12.6).
  • Endpoints missing from the drafts. /switch/v1/debit, its capture and release, GET /v1/payments (operator list), GET /v1/settlement/cycles, POST /v1/payments/{id}/retry and the provider calls (OCI-PAY-3) are not in the drafts.
  • Trust registry. Plan 003 §5 lists kinds bank, switch, idp. The registry now also has provider and acts_for.

Changes

VersionDateWhat changed
0.1.02026-11-28First version, extracted from the reference implementation. Numbered OCI-PAY-2 in the payments family (first drafted as OCI-13). SW-6.2 names the switch as the party that answers UNKNOWN_CURRENCY. Message tables for each call.