Create Payment Consent

POST {{base_url}}/banking/v2/pay/domestic/consents

Create Payment Consent

Before initiating a payment, a payment request must be created and presented to the user for their consent.

Payment request must include the bank details of the payee and the details of the payment (amount, currency and payment type).

Calling this endpoint will generate a payment link (authUrl) that can be sent to the payer. The payer will have to authorise the payment by authenticating with their bank before it can be completed.

On successful authentication, a code, id_token, and state will be returned along with the bankId.

Attributes

FieldTypeDescription
bankIdintegerUnique identifier for the bank
redirectstring (link)URL to redirect to after the bank account is added
creditorJSON objectCreditor information
creditor -> schemeNamestringIBAN or Account and sort code
creditor -> identificationstringCreditor's account details
creditor -> namestringCreditor name
currencystringAccount currency
amountintegerPayment amount
referencestringTransaction reference
typestringPayment type {DOMESTIC}
codestringTemporary code to be exchanged for access token with the bank
id_tokenstringBase64 encoded JSON for verifying state and token’s validity
statestringBase64 encoded JSON containing information about the original request to persist the state throughout the user journey
state->noncestringString value used to associate a client session with an ID Token, and to mitigate replay attacks (for internal use)
state->reRedstringRedirect URL
state->accReqstringtomato pay consentId
state->bIdintegerbankId (Unique identifier for the bank)
state->consentIdstringbank consentId

Response

FieldTypeDescription
signInUrlstringSign in URL for the requested bank
consentIdstringUnique ID for the consent
statusstring
bankIdintegerUnique identifier for the bank

Error Messages

ConditionResponse StatusResponse Body
Invalid bankId403 Forbidden
No request body400 Bad Request{error: "Missing/Invalid redirect”}
Missing/Invalid redirect400 Bad Request{error: "Missing/Invalid redirect”}
No currency in the request body400 Bad Request{error: Missing/invalid currency}
No amount in the request body400 Bad Request{error: Missing/invalid amount}
Reference greater than 35 characters in the request body400 Bad Request{error: The reference field has a maximum of 35 chars}
Invalid type400 Bad Request{error: "Missing/Invalid type. Must be DOMESTIC
No creditor in the request body400 Bad Request{error: Missing/Invalid creditor.name}
Invalid schemeName in request body400 Bad Requesterror: Missing/Invalid creditor.schemeName
Invalid identification in request body400 Bad Requesterror: Missing/Invalid creditor.identification
Bank error502 Bad Gateway{error: “Bank error”}
Server error500 Internal server error

Request Body

{"bankId"=>"6", "redirect"=>"redirect_url", "creditor"=>{"schemeName"=>"UK.OBIE.SortCodeAccountNumber", "identification"=>"Identification", "name"=>"Account name"}, "reference"=>"Reference", "amount"=>"1.00", "currency"=>"GBP", "type"=>"DOMESTIC"}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring
X-Api-Keystring
X-Partner-Idstring
Authorizationstring
X-Company-Idstring

RESPONSES

status: Created

{"signInUrl":"www.bankauthURL","consentId":"consentId1234","status":"AWAITINGAUTHORISATION","bankId":6}