Skip to main content

Payment Request

Overview

Overview

Once you have authenticated, you are able to send further requests in to the API. You will need to:

  1. GET Banks - use the API to return a list of banks available at this time.
  2. Offer Bank List - provide the bank list to the Payer and allow them to choose their bank.
  3. POST createOrder - confirm the bank and other transaction specific details.
  4. Display consent page - a mandatory step fo Open Banking. Can be combined with step 2.
  5. Redirect the payer - send the Payer to the provided bankURL.
  6. Display successful outcome - following a successful payment, ensure the payer is advised.

There are additional steps in the payer process which are completed securely outside of your website. This reduces your PCI compliance liability and provides peace of mind for the buyer.

GET Banks

Request

The request is completed via a GET request to the test URL shown above, and should contain the below header data. The access_token will be the one received in the Authentication Response.

HTTP Header
Field NameStateData TypeDescription
Content-TypeMandatoryStringapplication/json
AuthorizationMandatoryStringBearer access_token

Example

GET https://test-api.dnapayments.com/v1/ecospend/banks
HTTP/1.1

Content-Type: application/json
Authorization: Bearer 6945595921271780
User-Agent: PostmanRuntime/7.26.8
Accept: */*
Host: 192.168.0.75:8080
Accept-Encoding: gzip, deflate, br
Connection: keep-alive

Response

If the request is successful, the method will return a 200 response code. All your merchants will be returned as an array containing the following fields:

GET Banks
Field NameData TypeDescription
dataArrayAn array of objects for each bank available. See the data array for more information.
metaObjectMeta data for the entire response. See the meta Object for more details.

data Array

data Array
Field NameData TypeDescription
bank_idStringThe unique bank ID, derived from the EcoSpend system.
nameStringThe name of the bank.
friendly_nameStringThe friendly name of the bank.
is_sandboxStringIndicates if the record returned is in a sandbox (test) bank environment.
logoStringThe logo URL of the bank.
iconStringThe icon url of the bank.
standardStringWhich open banking standard is implemented by the bank.
Available options are:
obiestetberlingroup
country_iso_codeStringThe country code that the bank operates in.
divisionStringThe division of the bank e.g.
Available options are:
personalbusinesscorporate
groupStringThe group where applicable of the bank e.g Barclays.
orderStringThe preference of the bank. Can be amended to show a given bank before another.
service_statusBooleanIndicates if the bank's services are online currently.
refund_supportedBooleanIndicates if the bank's services are online currently.
abilitiesObjectThe operations supported by the specific bank. See the abilities Object for more information

abilities Object

meta Object
Field NameData TypeDescription
domestic_paymentBooleantrue if the bank supports Domestic Payments.
domestic_scheduled_paymentBooleantrue if the bank supports Domestic Scheduked Payments.
domestic_standing_orderBooleantrue if the bank supports Domestic Standing Orders.
domestic_standing_order_installmentBooleantrue if the bank supports Domestic Standing Order Installments.
domestic_standing_order_yearly_periodBooleantrue if the bank supports yearly intervals for Domestic Standing Order Payments.
international_paymentBooleantrue if the bank supports International Payments.
international_scheduled_paymentBooleantrue if the bank supports International Scheduled Payments.
international_standing_orderBooleantrue if the bank supports International Standing Orders.
bulk_paymentsBooleantrue if the bank supports Bulk Payments.

meta Object

meta Object
Field NameData TypeDescription
total_countIntegerThe total number of Banks returned.
total_pagesIntegerThe total number of pages.
current_pageIntegerCurrent page.

Example


{
"data": [
{
"bank_id": "obie-coutts-sandbox",
"name": "Barclays Personal",
"friendly_name": "Coutts Online Banking Test",
"is_sandbox": true,
"logo": "https://{uri}",
"icon": "https://{uri}",
"standard": "obie",
"country_iso_code": "GB",
"division": "Personal",
"group": "CMA9",
"order": 0,
"service_status": true,
"refund_supported": false,
"abilities": {
"domestic_payment": true,
"domestic_scheduled_payment": true,
"domestic_standing_order": true,
"domestic_standing_order_installment": true,
"domestic_standing_order_yearly_period": true,
"international_payment": true,
"international_scheduled_payment": true,
"international_standing_order": true,
"bulk_payments": true
}
}
],
"meta": {
"total_count": 0,
"total_pages": 0,
"current_page": 0
}
}
tip

Regardless of the various abilities offered by the Banks, the DNA Open Banking API supports domestic_payment only.

Offer Bank List

Having identified the banks, you should present these to the Payer within your own solution. We recommend using the supplied icon and logo URL's to provide payer confidence.

Once the bank has been selected by the Payer, you are ready to initiate the payment request.

POST createOrder

Request

The request is completed by a POST to the above URL's with these headers:

HTTP Header
Field NameStateData TypeDescription
Content-TypeMandatoryStringapplication/json
AuthorizationMandatoryStringBearer access_token

And the createOrder payload as shown here:

POST createOrder
Field NameData TypeStateDescription
bankIdStringMandatoryUnique identification String
amountDecimalMandatoryTotal amount of the order a GBP account will be proThis value must match t the request will be reject
currencyStringMandatoryCurrency of the transactioThis value must match t the request will be reject
invoiceIdStringMandatoryOrder/invoice/transaction/ for this transaction.This value must match t the request will be reject
descriptionStringOptionalMessage from host website to consumer, displayed on the payment form and merchant portal.
accountIdStringOptionalBuyer’s account reference for the store processing the transaction.
emailStringOptionalEmail address provided by consumer as main contact address.
localeStringOptionalConsumer language - used by DNA Payments Checkout to build the payment form eng
terminalIdStringMandatoryProvided to the integrator following the successful creation of a merchant account. This value must match the value provided during authorisation if unique tokens are used or the request will be rejected.
paymentMethodStringMandatoryPayment method ecospend
transactionTypeStringMandatorySALE
returnUrlStringMandatoryAddress where the consumer is to be returned following a successful payment.
callbackUrlStringMandatoryConfirms where DNA Payments is to send the payment/refund notification (payment/refund result callback) in the event of a successful result.
failureCallbackUrlStringOptionalConfirms where DNA Payments is to send the payment/refund notification (payment/refund result callback) in the event of an unsuccessful result.
billingAddressObjectMandatoryAn object containing several mandatory and optional billing address fields.
See billingAddress for more details.

billingAddress

billingAddress
Field NameData TypeStateDescription
firstNameStringMandatoryFirst name of the addressee. If the Merchant does not hold the title and last name separately, the full name is provided here and title, last name and middle names are left bank.
lastNameStringOptionalLast name of addressee.
streetAddress1StringMandatoryAddress Line 1 consumer resides in.
postalCodeStringOptionalPost code for consumer’s given address.
cityStringMandatoryCity consumer resides in.
countryStringMandatoryCountry consumer resides in. ISO 3166-1 (2 or 3 Char.)

Response

If successful, this method returns a 200 OK Response.

createOrder Response
Field NameData TypeDescription
accountIdStringUnique reference for the store processing the transaction, as passed in the request.
amountDecimalTotal amount of the order including decimal places where applicable. ‘Whole’ amounts (e.g. “1”) on a GBP
account represents £1.00.
authDateTimeUtcStringDate and time of when the transaction was authorised with the acquirer.
bankUrlStringA unique and one time use only URL of the debtor's banking system. You will need to redirect a merchant to
this link in order the payment to proceed.
currencyStringCurrency of the transaction GBP
errorCodeIntegerProvides additional detail should an error have occurred with the transaction.
idStringUnique transaction ID. This ID should be stored as it is required for later transaction actions.
invoiceIdStringOrder/invoice/transaction/basket number generated by the host website, as passed in the request.
messageStringMessage confirming the processing result of the request.
paymentMethodStringPayment method ecospend
rrnStringUnique reference allocated by Ecospend.
statusStringEcospend payment status.
successBooleanConfirms whether the transaction has been successful.

Example Request and Response

{
"bankId": "obie-coutts-sandbox",
"amount": 25,
"currency": "GBP",
"invoiceId": "1631161931",
"description": "Car Service",
"accountId": "uuid000001",
"email": "example@merchant.com",
"locale": "eng",
"terminalId": "z553ffcc-7df4-44b1-887b-la4108af9c94",
"paymentMethod": "ecospend",
"transactionType": "SALE",
"returnUrl": "https://test.com",
"callbackUrl": "https://test.com",
"failureCallbackUrl": "https://test.com",
"billingAddress": {
"firstName": "John",
"lastName": "Doe",
"streetAddress1": "Fulham Rd",
"postalCode": "SW6 1HS",
"city": "London",
"country": "GB"
}
}

You are required to display a consent page to the payer before redirecting them to their chosen bank's URL. Ecospend document the mandatory requirements here and they also provide a link to the OBIE Customer Experience Guidelines (OBIE CEG) which provide some best practice around this required step.

tip

Once you have received the payer's consent, you can move on to redirecting them to the Payment Page.

Redirect to Payment Page

After a user consents to continue to their bank, you should redirect the payer to the bankUrl provided as a part of the createOrder Response.

After that, the process continues on between the payer and their online banking system. Despite slight differences between banks, in principle, the payer logs in to their bank's system, sees the payment details and then authorises or cancels the payment. They, of course, can abandon without completing the process.

After completing the authorization process at their bank, the payer will be redirected to Ecospend's redirect URL. In the meantime, Ecospend Gateway will retrieve the status of the payment from the bank. Then Ecospend will send the payer to us. Finally, we return the payer to your returnUrl and we will send a Callback response to your callbackUrl, as per the below specification:

Callback Response

tip

It is us who will send this POST to your callbackUrl, so it is presented as a response. If this POST fails however, we will not be able to retry it and you should utilise our Transaction Management API to determine the outcome of the transaction.

You can do this in response to receiving the redirected payer, if you have not received the callback Response in a timely manner.

callback POST
Field NameData TypeDescription
signaturestringSignature generated for the callback.
idstringUnique transaction ID. This ID should be stored as it is required for later transaction actions.
paymentMethodstringPayment method ecospend
rrnstringUnique reference allocated by Ecospend.
amountdecimalRefund amount.
currencystringCurrency of the transaction GBP
invoiceIdstringOrder/invoice/transaction/basket number generated by the host website, as passed in the request.
accountIdstringUnique reference for the store processing the transaction, as passed in the request.
authDateTimeUtcstringDate and time of when the transaction was authorised with the acquirer.
errorCodeintegerProvides additional detail should an error have occurred with the transaction.
successbooleanConfirms whether the transaction has been successful.
transactionStatestringThe current state of the transaction.
statusstringEcospend payment status

Example Response

{
"signature": "yDlqMP0vM/grI/VCFwM/q5lMBwBDKTr/hTjPze0Ca3Y=",
"id": "374873d1-f69e-44bd-a637-5b5b28734021",
"paymentMethod": "ecospend",
"rrn": "5dc9e424-f878-4114-bc18-3b5e414ac41f",
"amount": 3,
"currency": "GBP",
"invoiceId": "1631891547494",
"accountId": "uuid000001",
"authDateTimeUtc": "2021-09-17T15:12:37.016969534Z",
"errorCode": 0,
"success": true,
"transactionState": "CHARGE",
"status": "Completed"
}

Display Successful Outcome