Skip to main content

validate.schemaGet

Overview​

validate.schemaGet returns the payout validation schema that Paysend applies to your payouts for one destination corridor. The schema is returned as a JSON Schema draft-07 document, so you can use it to:

  • discover which payout fields are mandatory and which are optional for a corridor;
  • discover the allowed values, formats, lengths and patterns of every field;
  • build or configure your own payout input forms;
  • pre-validate a payout payload before you send it to pay.toAccount.

The rules returned by the operation are the same rules that are applied when the payout itself is processed, and they are resolved for your own configuration - two customers may receive different schemas for the same country and currency if their payout routing differs.

info

The operation covers account-based and wallet-based payouts - payout to a bank account, payout to an e-wallet and payout to a crypto wallet. All of them are submitted with the pay.toAccount task, and the returned schema describes the payload of that task. Card payouts (pay.toCard) are not covered.

note

One request returns the schema of exactly one corridor. The operation does not return a list of supported countries or currencies - contact your Paysend Enterprise Account Manager for the list of corridors enabled for you.

Request​

The task type is validate.schemaGet. The task payload is flat and describes the corridor you want the schema for:

FieldTypeRequiredDescription
destinationCountrystring, 2-char ISO 3166-1 alpha-2 country codeYesDestination country of the payout, e.g. US.
transferCurrencystring, 3-char ISO 4217 currency codeYesCurrency of the transfer, e.g. USD.
accountIdentifierTypeenum: BAN, IBAN, CLABE, EWALLET, CRYPTOWALLETYesType of the destination account identifier - the same value you send in to.destinationTransactionInstrument.identifierType of a pay.toAccount task.
paymentRailenum: Local, SwiftConditionalRequired for accountIdentifierType = BAN, IBAN or CLABE. Not applicable to EWALLET and CRYPTOWALLET.
providerenum: ALIPAY, WECHATPAYConditionalRequired for accountIdentifierType = EWALLET only; it selects the Alipay or the WeChat Pay corridor. Not applicable to the other account identifier types.
warning

bankId is not part of this contract. The corridor is resolved from the fields above only; a bankId value sent in the payload is ignored.

Authentication, idempotency and the request envelope are the same as for every other operation of the Payout API - see Authentication & Idempotency.

Request example - bank account corridor​

{
"header": {
"request": {
"id": "fbaae168-fabb-11ed-be56-0242ac120005",
"date": "2025-01-24T13:34:52Z"
},
"service": {
"sync": false,
"waitTime": "WaitFor2000"
}
},
"payload": {
"partner": {
"identifier": "universal"
},
"tasks": [
{
"type": "validate.schemaGet",
"payload": {
"destinationCountry": "US",
"transferCurrency": "USD",
"accountIdentifierType": "BAN",
"paymentRail": "Local"
}
}
]
}
}

Request example - e-wallet corridor​

{
"type": "validate.schemaGet",
"payload": {
"destinationCountry": "CN",
"transferCurrency": "CNY",
"accountIdentifierType": "EWALLET",
"provider": "ALIPAY"
}
}

Response​

The response uses the standard envelope. The corridor schema is returned in the task result:

FieldTypeDescription
tasks[].result.statusstringTask status, Success for a resolved corridor.
tasks[].result.codeintegerTask result code, 0 for a resolved corridor.
tasks[].result.data.schemastringSerialized JSON object - the payout validation schema of the requested corridor. Returned in case of a successful response.
tasks[].result.commentstringText comment for the status.

Response example​

The value of data.schema is a string that contains the JSON Schema document (truncated here for readability):

{
"header": {
"request": {
"id": "fbaae168-fabb-11ed-be56-0242ac120005",
"date": "0001-01-01T00:00:00+00:00"
},
"response": {
"globalId": "2837dddc-9a60-4326-a8c8-ce39f07199b1",
"id": "25e309c2-3a6d-4c02-881d-3d96cb0d17f7",
"date": "2025-01-24T13:34:53.0004766+00:00",
"statusUri": "http://20.100.176.195/processing/status/2837dddc-9a60-4326-a8c8-ce39f07199b1"
},
"service": {
"sync": true,
"waitTime": "WaitFor2000",
"result": []
}
},
"result": {
"status": "Finished",
"code": 2
},
"payload": {
"partner": {
"identifier": "universal",
"parameters": {}
},
"tasks": [
{
"type": "validate.schemaGet",
"payload": {
"destinationCountry": "US",
"transferCurrency": "USD",
"accountIdentifierType": "BAN",
"paymentRail": "Local"
},
"success": [],
"fail": [],
"always": [],
"result": {
"status": "Success",
"code": 0,
"data": {
"schema": "{\"$schema\":\"http://json-schema.org/draft-07/schema#\",\"type\":\"object\",\"required\":[\"from\",\"to\",\"invoiceId\",\"transferAmount\",\"transferCurrency\"],\"properties\":{ ... },\"definitions\":{ ... }}"
},
"comment": "Success"
},
"expiration": {
"date": "2025-01-24T14:19:53.0004766+00:00"
}
}
]
}
}

The returned schema​

The document is a standard JSON Schema draft-07 document that describes the payload of a pay.toAccount task. Field names and nesting are exactly the ones documented for that task (see the pay.toAccount page in the Endpoints section), for example from.sender.address.addressLine1, from.sender.address.addressLine2 and to.recipient.address.countrySubdivision, so the document can be applied directly to the payload you are about to send.

What the schema tells you:

  • Mandatory fields - the required arrays, at the document root and inside every nested object.
  • Optional fields - every other property present in properties.
  • Allowed values - enum arrays. A single-value enum means the value is fixed for the corridor (for example "transferCurrency": { "enum": ["USD"] }).
  • Formats and constraints - type, minLength, maxLength, minimum, maximum, format and pattern.
  • Human-readable pattern explanations - the non-standard patternError annotation next to a pattern. Show it to your users when the pattern check fails.
  • Conditional (country-specific) rules - if/then blocks inside allOf, for example:
    • a sender or recipient with type = Individual must provide firstName and lastName, while type = LegalEntity must provide name;
    • governmentId.type and governmentId.number require each other - if you send one, you must send the other;
    • address fields that are only required in some countries, for example zip and countrySubdivision for US and CA.

The schema contains client-facing rules only. It never exposes internal information: no payout provider identity, no routing data, no internal-only fields such as from.sourceTransactionInstrument, no UI hints and no pre-filled default values. Fields that are no longer part of the pay.toAccount contract are not returned either - in particular the destination instrument has no currency field, transferCurrency at the root of the payload is the only currency source.

note

patternError is an annotation, not a validation keyword. Standard validators ignore unknown keywords; some validators have to be told to do so (for example Ajv has to be created with strict: false).

Worked example​

1. Ask for the corridor schema​

Request the schema for a payout to a US bank account in USD over the local rail:

{
"type": "validate.schemaGet",
"payload": {
"destinationCountry": "US",
"transferCurrency": "USD",
"accountIdentifierType": "BAN",
"paymentRail": "Local"
}
}

2. Parse the returned schema​

tasks[0].result.data.schema parsed and formatted (truncated - a real document also contains the full ISO country and currency lists, the complete sender definition and all remaining optional fields):

{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": ["from", "to", "invoiceId", "transferAmount", "transferCurrency"],
"properties": {
"invoiceId": { "type": "string", "maxLength": 256 },
"transferAmount": { "type": "number" },
"transferCurrency": { "enum": ["USD"] },
"purposeOfPayment": { "type": "string" },
"comment": { "type": "string", "maxLength": 1024 },
"from": {
"type": "object",
"required": ["sender"],
"properties": { "sender": { "$ref": "#/definitions/sender" } }
},
"to": {
"type": "object",
"required": ["destinationTransactionInstrument", "recipient"],
"properties": {
"destinationTransactionInstrument": { "$ref": "#/definitions/destinationInstrument" },
"recipient": { "$ref": "#/definitions/recipient" }
}
}
},
"definitions": {
"destinationInstrument": {
"type": "object",
"required": ["accountIdentifier", "identifierType", "country", "accountName", "bankCode"],
"properties": {
"accountIdentifier": {
"type": "string",
"pattern": "^[0-9]{1,17}$",
"patternError": "Account ID must be 1-17 digits"
},
"identifierType": { "enum": ["BAN"] },
"country": { "enum": ["US"] },
"accountName": { "type": "string", "maxLength": 35 },
"bankCode": {
"type": "string",
"pattern": "^\\d{9}$",
"patternError": "9-digit ABA routing number required"
},
"bankCodeType": { "enum": ["ABA"] },
"bankName": { "type": "string", "maxLength": 140 },
"bic": { "type": "string", "maxLength": 11 },
"accountType": { "enum": ["Checking", "Saving", "Loan"] }
}
},
"recipient": {
"type": "object",
"required": ["address", "type"],
"properties": {
"type": { "enum": ["Individual", "LegalEntity"] },
"firstName": {
"type": "string",
"maxLength": 35,
"pattern": "^[a-zA-Z '.,\\-]+$",
"patternError": "Must contain only letters, spaces, hyphens, apostrophe, period or comma."
},
"lastName": {
"type": "string",
"maxLength": 35,
"pattern": "^[a-zA-Z '.,\\-]+$",
"patternError": "Must contain only letters, spaces, hyphens, apostrophe, period or comma."
},
"name": { "type": "string", "maxLength": 70 },
"address": {
"type": "object",
"required": ["addressLine1", "country", "city"],
"properties": {
"addressLine1": { "type": "string", "minLength": 1, "maxLength": 200 },
"addressLine2": { "type": "string", "maxLength": 200 },
"city": { "type": "string", "minLength": 2, "maxLength": 50 },
"country": { "enum": ["CA", "GB", "US"] },
"zip": { "type": "string", "minLength": 2, "maxLength": 25 },
"countrySubdivision": { "type": "string", "maxLength": 50 }
},
"allOf": [
{
"if": { "properties": { "country": { "enum": ["US", "CA"] } }, "required": ["country"] },
"then": { "required": ["zip", "countrySubdivision"] }
}
]
},
"governmentId": { "$ref": "#/definitions/governmentId" }
},
"allOf": [
{
"if": { "properties": { "type": { "enum": ["Individual"] } }, "required": ["type"] },
"then": { "required": ["firstName", "lastName"] }
},
{
"if": { "properties": { "type": { "enum": ["LegalEntity"] } }, "required": ["type"] },
"then": { "required": ["name"] }
}
]
},
"governmentId": {
"type": "object",
"properties": {
"type": { "enum": ["NationalPassport", "SocialSecurityNumber", "TaxIdentificationNumber"] },
"number": { "type": "string", "minLength": 3, "maxLength": 35 },
"issuingCountry": { "enum": ["CA", "GB", "US"] },
"issueDate": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"patternError": "Format: YYYY-MM-DD"
}
},
"allOf": [
{
"if": { "properties": { "type": { "pattern": "\\w+" } }, "required": ["type"] },
"then": { "required": ["number"] }
},
{
"if": { "properties": { "number": { "pattern": "\\w+" } }, "required": ["number"] },
"then": { "required": ["type"] }
}
]
},
"sender": { "type": "object", "required": ["address", "type", "senderAccount"] }
}
}

Reading the example above, a payout to this corridor requires invoiceId, transferAmount, transferCurrency (fixed to USD), the destination account (accountIdentifier of up to 17 digits, identifierType = BAN, country = US, accountName and a 9-digit ABA routing number in bankCode, marked as ABA in bankCodeType), and a recipient with an address. bic - the BIC/SWIFT code of up to 11 characters - stays optional on a local-rail US corridor; the routing number belongs in bankCode, never in bic. Because the recipient address country is US, zip and countrySubdivision become mandatory as well; a recipient of type Individual additionally has to provide firstName and lastName.

3. Pre-validate your payout payload​

Compile the returned document with any draft-07 validator and validate the pay.toAccount task payload before you send it. For example, with Ajv in Node.js:

import Ajv from "ajv";

// schemaString = tasks[0].result.data.schema from the validate.schemaGet response
const ajv = new Ajv({ allErrors: true, strict: false }); // strict: false keeps the patternError annotation
const validate = ajv.compile(JSON.parse(schemaString));

const payout = {
invoiceId: "97604836-aea4-4169-be1c-4af92747f047",
transferAmount: 100,
transferCurrency: "USD",
from: {
sender: {
type: "Individual",
firstName: "John",
lastName: "Doe",
address: {
addressLine1: "251 Little Falls Drive",
city: "Wilmington",
country: "US",
countrySubdivision: "DE",
zip: "19808"
},
senderAccount: {
identifierType: "BAN",
accountIdentifier: "12345678901",
country: "US",
currency: "USD"
}
}
},
to: {
destinationTransactionInstrument: {
identifierType: "BAN",
accountIdentifier: "12345698765432",
country: "US",
accountName: "Jane Roe",
bankCode: "026009593",
bankCodeType: "ABA"
},
recipient: {
type: "Individual",
firstName: "Jane",
lastName: "Roe",
address: {
addressLine1: "1 Market Street",
city: "San Francisco",
country: "US",
countrySubdivision: "CA",
zip: "94105"
}
}
}
};

if (!validate(payout)) {
console.log(validate.errors); // fix the payload before calling pay.toAccount
}

If the payload above is missing to.recipient.address.zip, the validator reports the missing property before the request is sent, instead of the payout being rejected by Paysend. When validation passes, submit the very same object as the payload of a pay.toAccount task.

tip

Cache the schema per corridor and refresh it periodically. Country Guidance rules change over time, and validate.schemaGet always returns the currently active rules.

Error responses​

CaseResponse
Malformed request - a mandatory field is missing, or a value is outside the allowed enumHTTP 400 Bad request with an Error object.
Incorrect signature or other partner informationHTTP 401 Unauthorized.
The system cannot accept the request at the momentHTTP 404 Not found with the body Sorry. Can't accept your request now.. Repeat the request after a few seconds; if the code persists, contact the Support team.
The requested country and currency combination cannot be routed for your configurationHTTP 200 OK envelope with the task result in status Error and the comment Selected country and currency combination is not available.

The last case is how an unsupported corridor is distinguished from a malformed request or an authentication problem: the request itself is valid and accepted, but no payout route - and therefore no schema - exists for the requested combination.

"result": {
"status": "Error",
"code": 1000,
"comment": "Selected country and currency combination is not available"
}

The case is identified by the comment text, which is fixed: the result code is the generic processing code 1000, which the operation shares with other processing errors.

A full list of processing error codes is available on the Processing error codes page.