API Integration
Sandbox: https://api-sbx.dlocalgo.com
Live: https://api.dlocalgo.com
All the requests will be always using HTTPS and authenticated via:
Bearer auth: The key is the concatenation of: <API_KEY> + ":" + <SECRET_KEY>
Basic auth: The user is the API_KEY, and the password the SECRET_KEY.
Credentials can obtained from the dashboard:
Menu > Integrations > Integrations keys
post
https://api.dlocalgo.com/v1/payments
Create a payment
All the required attributes will be asked in the checkout as mandatory if not given in the initial request.
Attribute | Type | Description |
id | string | Payer unique identifier on the merchant side. It will be generated if not present. |
name | string | User's full name. Length: 100. Note: If not given, it will be asked in the checkout. |
email | string | User’s email address. Length: 100. Note: If not given, it will be asked in the checkout. |
phone | string | User’s phone. Note: Mandatory for Wallets in India. If not given will be asked in the checkout for that country. |
document_type | string | Payer's document type. Must be a valid document type for the specified country Note: If not given, it will be asked in the checkout. |
document | string | Payer's document number. Must be a valid document for the specified country and client. Note: If not given, it will be asked in the checkout. |
user_reference | string | Unique user id at the merchant side. |
address | object | User’s address. Required in India and South Africa for fraud prevention. |
All the required attributes will be asked in the checkout as mandatory if not given in the initial request.
Attribute | Type | Description |
state | string | Payer's address state. Required in South Africa. |
city | string | Payer’s address city. Required in India and South Africa. |
zip_code | string | Payer's address zip_code. Required in South Africa. |
full_address | string | Payer’s full address Required in India and South Africa. |
curl -X POST \
https://api-sbx.dlocalgo.com/v1/payments \
-H 'authorization: Bearer [hidden]' \
-H 'content-type: application/json' \
-d '{
"amount": 120,
"currency" : "BRL",
"country": "BR",
"success_url": "https://merchant.com/success",
"back_url": "https://merchant.com/back",
"redirect_url": "https://merchant.com/redirect"
}'
get
https://api.dlocalgo.com/v1/payments
/:payment_id
Retrieve a Payment
curl -X GET \
https://api-sbx.dlocalgo.com/v1/payments/DP-5954 \
-H 'authorization: Bearer [hidden]' \
-H 'content-type: application/json'
Status | Description |
---|---|
PENDING | The payment is pending. |
PAID | The payment was paid. |
REJECTED | The payment was rejected. |
CANCELLED | The payment was cancelled. |
EXPIRED | The payment was expired. |
Attribute | Type | Description |
code | string | Error code. |
message | string | Description of error |
param | string | Invalida parameter |
Example
{
"code": 5003,
"message": "Country not supported"
}
HTTP Status Code | Error Code | Error Message | Param | |
403 (Forbidden) | 3001 | Invalid Credentials. | | |
| 3003 | Merchant has no authorization to use this API. | | |
404 (Not Found) | 4000 | Payment not found | | |
400 (Bad Request) | 5000 | Invalid request. | | |
| 5001 | Invalid Parameter | document_type | |
| | | document | |
| | | currency | |
| 5003 | Country not supported. | | |
| 5007 | Amount exceeded. | | |
| 5009 | Order id is duplicated | | |
| 5010 | Payment Method not available. | | |
| 5016 | Amount too low. | | |
429 (Too many requests) | 6000 | Too many requests to the API. | | |
500 (Internal Server Error) | 7000 | Failed to process the request. | | |
504 Gateway Timeout | 7001 | Request Timeout. | | |
The notifications of a payment or refund status change will be sent as a POST with the ID of the Payment Or Refund in the body to the notification_url specified in the request, so that the merchant can get the information via the GET method.
post
https://api.dlocalgo.com/v1/refunds
Make a Refund
curl -X POST \
https://api-sbx.dlocalgo.com/v1/refunds \
-H 'authorization: Bearer [hidden]' \
-H 'content-type: application/json' \
-d '{
"payment_id": "DP-6012",
"amount": 60
}'
Last modified 2mo ago