Introduction
This document describes the Interbank transactions API. This API offers a REST service for:
- Get available banks
- Create transactions
- Get transaction information
- Get transactions history
We also can configure a webhook to notify the API clients when a transaction status has changed. See the Webhook section for details.
Environments
We have two independent environments for development and production applications.
- Staging:
https://staging.banking-gateway.tpaga.co/api/coopcentral/v1/interbanks/
- Production:
https://production.banking-gateway.tpaga.co/api/coopcentral/v1/interbanks/
Quick Start Guide
Once you have an active access_token you can start to use our API to make interbank transactions.
Here is the detail of each service offered by the API:
Authentication
An example of a valid request sending the authorization token:
curl -X GET 'https://staging.banking-gateway.tpaga.co/api/coopcentral/v1/interbanks/banks' \
--header 'Authorization: Token <<access_token>>'
Requests are authenticated using token-based HTTP Authentication scheme. The token is granted by the operations team of Tpaga. Check an example of a valid request sending the authorization token on the right column.
Get available banks
Endpoint: /banks
HTTP Method: GET
Description: This service allows to consult the list of available banks that can be used to create transactions.
Example request:
curl -X GET 'https://staging.banking-gateway.tpaga.co/api/coopcentral/v1/interbanks/banks' \
--header 'Authorization: Token <<access_token>>'
Example response:
{
"banks": [
{
"name": "BBVA",
"slug": "bbva"
},
{
"name": "BANCO CAJA SOCIAL",
"slug": "banco-caja-social"
}
]
}
Request parameters
This endpoint does not need extra parameters to be sent in the request.
Response parameters
Field | Description | Type | Nullable |
---|---|---|---|
banks | List of available banks | List | no |
banks -> name | Human-readable name for the bank | String | no |
banks -> slug | Slug ID of bank | String | no |
HTTP responses
Code | Description |
---|---|
200 | The list of available banks was queried successfully |
401 | Invalid authorization token provided |
403 | You do not have enough permissions to perform this action, please contact the support team |
5XX | Internal sever error, it's safe to retry the request |
Create transaction
Endpoint: /transactions/create
HTTP Method: POST
Description: This service allows to create an interbank transaction
Example request:
curl -X POST 'https://staging.banking-gateway.tpaga.co/api/coopcentral/v1/interbanks/transactions/create' \
--header 'Authorization: <<access_token>>' \
--header 'Content-Type: application/json' \
--data-raw '{
"dest_account_owner_full_name": "Jovita Ducuara Prieto",
"dest_account_owner_identification_type": "CC",
"dest_account_owner_identification_number": "11111158",
"dest_account_type": "saving_account",
"dest_account_number": "68653284571",
"amount": 5211470,
"dest_bank": "bbva",
"origin_account": "<origin-account-token>",
"idempotency_token": "some-random-and-unique-token8765",
"description": "Some descriptive text"
}'
Example response:
{
"dest_account_owner_full_name": "Jovita Ducuara Prieto",
"dest_account_owner_identification_type": "CC",
"dest_account_owner_identification_number": "11111158",
"dest_account_type": "saving_account",
"dest_account_number": "68653284571",
"amount": 5211470,
"status": "pending",
"fee_amount": 0,
"dest_bank": "bbva",
"origin_account_number": "891000845",
"origin_account_type": "electronic_deposit",
"origin_account_owner_identification_number": "589632154",
"idempotency_token": "some-random-and-unique-token8765",
"result_message": null,
"description": "Transaction description",
"created_at": "2024-03-13T18:37:52.000000Z"
}
Request parameters
Field | Description | Type | Required |
---|---|---|---|
dest_account_owner_full_name | Full name of the destination account owner | String | yes |
dest_account_owner_identification_type | Identification type of the destination account owner. Accepted values: CC, CE, PA and NIT |
String | yes |
dest_account_owner_identification_number | Identification number of the destination account owner | String | yes |
dest_account_type | Destination account type. Accepted values: saving_account, checking_account and electronic_deposit |
String | yes |
dest_account_number | Destination account number | String | yes |
amount | Amount of the transaction | String | yes |
dest_bank | Slug of the destination bank. Must be present in the response of the Get available banks service | String | yes |
idempotency_token | A unique identifier for the transaction. Use this token to retry transactions safely | String | yes |
description | Any description for the transaction | String | no |
origin_account | Origin account token. This value should be sent if the origin account is an electronic deposit | String | no |
Response parameters
Field | Description | Type | Nullable |
---|---|---|---|
dest_account_owner_full_name | Full name of the destination account owner | String | no |
dest_account_owner_identification_type | Identification type of the destination account owner | String | no |
dest_account_owner_identification_number | Identification number of the destination account owner | String | no |
dest_account_type | Destination account type | String | no |
dest_account_number | Destination account number | String | no |
amount | Amount of the transaction | String | no |
status | Status of the transaction. See Transaction statuses for details | String | no |
fee_amount | Fee for this transaction | String | no |
dest_bank | Slug of the destination bank | String | no |
origin_account_number | Number of the origin account | String | no |
origin_account_type | Type of the origin account saving_account, checking_account or electronic_deposit |
String | no |
origin_account_owner_identification_number | Identification number of the origin account owner | String | no |
idempotency_token | The token received in idempotency_token field from the client. Use this token to retry transactions safely | String | no |
result_message | Detailed message related to the transaction result | String | yes |
error_code | Internal code to identify the error | String | yes |
error_message | Detailed message related to returned error code | String | yes |
description | Transaction description | String | yes |
field | Name of the field that presents errors in the give request body | String | yes |
Transaction statuses
- pending: The transaction was created within the Tpaga system and will be processed soon.
- in_progress: The transaction is being processed by the bank.
- approved: The transaction was successful.
- rejected: The transaction was rejected by the bank. Check the result_message field for details.
- unknown: There was an error, please retry the request with the same idempotency_token to get an updated status.
- created: There was an error, please contact Tpaga's support team.
HTTP responses
Code | Description |
---|---|
201 | The transaction was created successfully and and will be processed soon |
208 | There is already a transaction with the same idempotency_token. It's data will be returned and no new transactions were created |
401 | Invalid authorization token provided |
403 | You do not have enough permissions to perform this action, please contact the support team |
409 | Transaction failed, it's safe to retry the transaction with a new idempotency_token |
422 | You did not provide valid data for this operation, please check response body for details |
5XX | Internal sever error, it's safe to retry the request using the same idempotency_token |
Get transaction information
Endpoint: /transactions/idempotency_token
HTTP Method: GET
Description: This service allows to consult the information of a transaction given its idempotency token
.
Example request:
curl -X GET 'https://staging.banking-gateway.tpaga.co/api/coopcentral/v1/interbanks/transactions/some-random-and-unique-token8765' \
--header 'Authorization: <<access_token>>'
Example response:
{
"dest_account_owner_full_name": "Jovita Ducuara Prieto",
"dest_account_owner_identification_type": "CC",
"dest_account_owner_identification_number": "11111158",
"dest_account_type": "saving_account",
"dest_account_number": "68653284571",
"amount": 5211470,
"status": "pending",
"fee_amount": 0,
"dest_bank": "bbva",
"origin_account_number": "891000845",
"origin_account_type": "electronic_deposit",
"origin_account_owner_identification_number": "34568987",
"idempotency_token": "some-random-and-unique-token8765",
"result_message": null,
"description": "transaction-description",
"created_at": "2024-03-13T18:37:52.000000Z"
}
Request parameters
Field | Description | Type | Required |
---|---|---|---|
idempotency_token | The idempotency token used to create the transaction | String | yes |
Response parameters
Field | Description | Type | Nullable |
---|---|---|---|
dest_account_owner_full_name | Full name of the destination account owner | String | no |
dest_account_owner_identification_type | Identification type of the destination account owner | String | no |
dest_account_owner_identification_number | Identification number of the destination account owner | String | no |
dest_account_type | Destination account type | String | no |
dest_account_number | Destination account number | String | no |
amount | Amount of the transaction | String | no |
status | Status of the transaction. See Transaction statuses for details | String | no |
fee_amount | Fee for this transaction | String | no |
dest_bank | Slug of the destination bank | String | no |
origin_account_number | Number of the origin account | String | no |
origin_account_type | Type of the origin account saving_account, checking_account or electronic_deposit |
String | no |
origin_account_owner_identification_number | Identification number of the origin account owner | String | no |
idempotency_token | Unique token to identify the transaction | String | no |
result_message | Detailed message related to the transaction result | String | yes |
error_code | Internal code to identify the error | String | yes |
error_message | Detailed message related to returned error code | String | yes |
description | Transaction description | String | yes |
field | Name of the field that presents errors in the give request body | String | yes |
Transaction statuses
- pending: The transaction was created within the Tpaga system and will be processed soon.
- in_progress: The transaction is being processed by the bank.
- approved: The transaction was successful.
- rejected: The transaction was rejected by the bank. Check the result_message field for details.
- unknown: There was an error, please retry the request with the same idempotency_token to get an updated status.
- created: There was an error, please contact Tpaga's support team.
HTTP responses
Code | Description |
---|---|
200 | The transaction information was queried successfully |
401 | Invalid authorization token provided |
403 | You do not have enough permissions to perform this action, please contact the support team |
422 | You did not provide valid data for this operation, please check response body for details |
5XX | Internal sever error, it's safe to retry the request using the same idempotency_token |
Get transactions history
Endpoint: /transactions
HTTP Method: GET
Description: This service is intended to know your transactions history. For performance reasons, this endpoint only will return the last 20 transactions sorted by creation date.
Example request:
curl -X GET 'https://staging.banking-gateway.tpaga.co/api/coopcentral/v1/interbanks/transactions' \
--header 'Authorization: <<access_token>>'
Example response:
{
"transactions": [
{
"dest_account_owner_full_name": "Jovita Ducuara Prieto",
"dest_account_owner_identification_type": "CC",
"dest_account_owner_identification_number": "11111158",
"dest_account_type": "saving_account",
"dest_account_number": "68653284571",
"amount": 5211470,
"status": "pending",
"fee_amount": 0,
"dest_bank": "bbva",
"origin_account_number": "891000845",
"origin_account_type": "electronic_deposit",
"origin_account_owner_identification_number": "32568987",
"idempotency_token": "some-random-and-unique-token8765",
"result_message": null,
"description": "transaction-description",
"created_at": "2024-03-13T18:37:52.000000Z"
},
{
"dest_account_owner_full_name": "Jovita Ducuara Prieto",
"dest_account_owner_identification_type": "CC",
"dest_account_owner_identification_number": "11111158",
"dest_account_type": "saving_account",
"dest_account_number": "68653284571",
"amount": 5211470,
"status": "pending",
"fee_amount": 0,
"dest_bank": "bbva",
"origin_account_number": "891000845",
"origin_account_type": "electronic_deposit",
"origin_account_owner_identification_number": "589546687",
"idempotency_token": "another-random-and-unique-token8765",
"result_message": null,
"description": "another-transaction-description",
"created_at": "2024-03-13T18:37:52.000000Z"
}
]
}
Request parameters
Field | Description | Type | Required |
---|---|---|---|
origin_account_token | Origin account token. This value should be sent only if the origin account is an electronic deposit | String | no |
page | Use this field to get older transactions | Integer | no |
Response parameters
Field | Description | Type | Nullable |
---|---|---|---|
transactions | List of transactions | List | no |
dest_account_owner_full_name | Full name of the destination account owner | String | no |
dest_account_owner_identification_type | Identification type of the destination account owner | String | no |
dest_account_owner_identification_number | Identification number of the destination account owner | String | no |
dest_account_type | Destination account type | String | no |
dest_account_number | Destination account number | String | no |
amount | Amount of the transaction | String | no |
status | Status of the transaction | String | no |
fee_amount | Fee for this transaction | String | no |
dest_bank | Slug of the destination bank | String | no |
origin_account_number | Number of the origin account | String | no |
origin_account_type | Type of the origin account saving_account, checking_account or electronic_deposit |
String | no |
origin_account_owner_identification_number | Identification number of the origin account owner | String | no |
idempotency_token | Unique token to identify the transaction | String | no |
result_message | Detailed message related to the transaction result | String | yes |
error_code | Internal code to identify the error | String | yes |
error_message | Detailed message related to returned error code | String | yes |
description | Transaction description | String | yes |
field | Name of the field that presents errors in the give request body | String | yes |
HTTP responses
Code | Description |
---|---|
200 | The transactions history was queried successfully |
401 | Invalid authorization token provided |
403 | You do not have enough permissions to perform this action, please contact the support team |
422 | You did not provide valid data for this operation, please check response body for details |
5XX | Internal sever error, it's safe to retry the request |
Webhook
This service allows the client API to receive notifications via HTTP requests when a transaction status has changed.
This is an example of the request that we will send to the configured API client endpoint:
curl -X POST 'https://clienthost.com/some/defined/endpoint' \
--header 'Content-Type: application/json' \
--data-raw '{
"transaction_token": "some-random-and-unique-token8765"
}'
How it works
When a transaction reaches a final status (approved or rejected) an HTTP POST request will be sent to a (previously configured) client endpoint. That request will have the following body:
Field | Description | Type |
---|---|---|
transaction_token | idempotency_token given by the API client to create the transaction | String |
When a webhook notification is sent, the API client should use the received idempotency_token along with the Get transaction information
endpoint to get the complete information related to the transaction.
Help for implementers of this API.
In this section we are going to expose information that will help you to implement this API.
For example, if we want to simulate an approved or rejected transaction, we would only need to include a keyword in the description
field.
Remember that it will only work in the staging environment, not in production
In case of sending a description that is not within the list below, the API will work normally as it would in production. That is, the transaction will be sent to the bank and you will receive the webhook notification when the bank finish the transaction processing.
description field | Description | HTTP response code |
---|---|---|
transaction-approved | Generates a transaction with approved state and sends a notification via webhook. | 201 |
transaction-rejected | Generates a transaction with rejected state and sends a notification via webhook. | 201 |
After receiving the webhook, you can check the status of the transaction on the endpoint Get transactions history