### Example: Populating Installment Options
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/transparent-checkout
An example of how to use the onInstallmentsChange callback to populate a UI element with available installment options.
```javascript
dlocalGo.onInstallmentsChange((installments) => {
installmentsSelect.innerHTML =
'';
if (installments && installments.length > 1) {
installmentsContainer.style.display = "block";
installments.forEach((installment) => {
const option = document.createElement("option");
option.value = installment.id;
option.textContent = `${installment.installments} Installments of ${installment.currency} ${installment.installment_amount} = ${installment.currency} ${installment.total_amount}`;
installmentsSelect.appendChild(option);
});
} else {
installmentsContainer.style.display = "none";
}
});
```
--------------------------------
### Querying Documentation
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-a-single-plan
This example shows how to query the documentation dynamically by appending an 'ask' query parameter to the GET request URL.
```http
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-a-single-plan.md?ask=
```
--------------------------------
### Querying Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payouts-integration
Example of how to perform an HTTP GET request to ask a question about the documentation.
```http
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payouts-integration.md?ask=
```
--------------------------------
### HTTP GET Request to Query Documentation
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-all-the-executions-for-a-subscription
Example of an HTTP GET request to query the documentation dynamically using the 'ask' query parameter.
```http
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-all-the-executions-for-a-subscription.md?ask=
```
--------------------------------
### Query Documentation Example
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/errors
Example of an HTTP GET request to query the documentation dynamically using the 'ask' query parameter.
```http
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/errors.md?ask=
```
--------------------------------
### Querying Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payouts-integration/country-requirements/mexico
Example of how to perform an HTTP GET request to query the documentation dynamically with the `ask` query parameter.
```HTTP
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payouts-integration/country-requirements/mexico.md?ask=
```
--------------------------------
### 200: OK Example response
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-all-plans
An example of a successful response when retrieving all subscription plans.
```json
{
"data": [
{
"id": 1555,
"merchant_id": 590,
"name": "Test Plan 1",
"description": "Testing plans 1",
"country": "UY",
"currency": "UYU",
"amount": 1000.00,
"frequency_type": "WEEKLY",
"frequency_value": 2,
"active": true,
"free_trial_days": 0,
"plan_token": "zTutFN3UYJUFwnDscjPzeeb77DzXGfYq",
"created_at": "2024-05-03T21:59:34",
"updated_at": "2024-06-07T20:24:15",
"notification_url": "https://webhook.site/e4e9a32a-9009-42b6-ab11-e5d18a68620b",
"subscribe_url": "https://checkout-sbx.dlocalgo.com/validate/subscription/zTutFN3UYJUFwnDscjPzeeb77DzXGfYq",
"back_url": "https://example.com/back",
"success_url": "https://example.com/success",
"error_url": "https://example.com/error"
},
{
"id": 1420,
"merchant_id": 590,
"name": "Test Plan 2",
"description": "Testing plans 2",
"country": "UY",
"currency": "UYU",
"amount": 2000.00,
"frequency_type": "MONTHLY",
"frequency_value": 1,
"active": true,
"free_trial_days": 0,
"plan_token": "MCkOzm4Pri3PU1mxlDgxRDWeZo45p96s",
"created_at": "2024-02-02T17:41:38",
"updated_at": "2024-02-02T17:41:38",
"notification_url": "https://webhook.site/636cfe2b-52fb-47fe-b1c5-f7e33c74d814",
"subscribe_url": "https://checkout-sbx.dlocalgo.com/validate/subscription/MCkOzm4Pri3PU1mxlDgxRDWeZo45p96s",
"back_url": "https://example.com/back",
"success_url": "https://example.com/success",
"error_url": "https://example.com/error"
}
],
"total_elements": 2,
"total_pages": 1,
"page": 0,
"number_of_elements": 2,
"size": 10
}
```
--------------------------------
### Querying Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/recurring-links
An example of how to perform an HTTP GET request to query the documentation dynamically using the 'ask' query parameter.
```HTTP
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/recurring-links.md?ask=
```
--------------------------------
### GET Request Example
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/retrieve-chargebacks
This is an example of a GET request to retrieve chargebacks.
```http
GET https://api.dlocalgo.com/v1/chargebacks
```
--------------------------------
### HTTP GET Request Example
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/retrieve-currency-exchange
Example of how to query the documentation dynamically by asking a question.
```http
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/retrieve-currency-exchange.md?ask=
```
--------------------------------
### Querying Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/errors/refunds-http-errors
Example of how to perform an HTTP GET request to query the documentation dynamically with the 'ask' query parameter.
```HTTP
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/errors/refunds-http-errors.md?ask=
```
--------------------------------
### Querying Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/errors/payment-http-errors
An example of how to perform an HTTP GET request to query the documentation dynamically using the 'ask' query parameter.
```HTTP
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/errors/payment-http-errors.md?ask=
```
--------------------------------
### 200: OK Example response
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-all-subscriptions-by-plan
This is an example of a successful response when retrieving all subscriptions for a given plan.
```json
{
"data": [
{
"@id": "b3f643c4-e86f-481e-991f-1d764d3e3fd3",
"id": 815,
"plan": {
"id": 1403,
"merchant_id": 590,
"name": "Plan with notifications",
"description": "This is a test plan with notifications",
"country": "UY",
"currency": "USD",
"amount": 20.00,
"frequency_type": "DAILY",
"frequency_value": 1,
"active": true,
"free_trial_days": 0,
"plan_token": "2pjYjTUuLjxm9SSCuBsvuvJ8TX0xaoUT",
"created_at": "2024-01-19T19:50:38",
"updated_at": "2024-01-19T19:50:38",
"notification_url": "https://webhook.site/29945c7f-ebff-44f7-9cc6-a2a3984757ca",
"subscribe_url": "https://checkout-sbx.dlocalgo.com/validate/subscription/2pjYjTUuLjxm9SSCuBsvuvJ8TX0xaoUT",
"back_url": "https://example.com/back",
"success_url": "https://example.com/success",
"error_url": "https://example.com/error"
},
"country": "UY",
"subscription_token": "ttl8I64FJT10Irhx0u1mYs6ZpoekCTmi",
"status": "CONFIRMED",
"payment_method_code": "VI",
"client_id": "59068185390406354",
"client_first_name": "Test",
"client_last_name": "Webhook",
"client_document_type": "CI",
"client_document": "44444444",
"client_email": "test@test.com",
"language": "es",
"card_token": "CID-888973a8-6610-4ede-a607-76298a7f24b8",
"dlocal_account_type": "EndUsers",
"scheduled_date": "2024-02-06T19:37:52",
"active": false,
"created_at": "2024-02-02T19:14:39",
"updated_at": "2024-02-05T19:47:53"
}
],
"total_elements": 1,
"total_pages": 1,
"page": 1,
"number_of_elements": 1,
"size": 10
}
```
--------------------------------
### 200: OK Example response
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-all-the-executions-for-a-subscription
This is an example of a successful response when retrieving all executions for a subscription.
```json
{
"data": [
{
"@id": "7a09d27a-4142-4420-95a4-d587e9af9eac",
"id": 48,
"subscription": {
"@id": "548d653d-5f85-400a-b402-704c06f3b300",
"id": 3,
"plan": {
"id": 3,
"merchant_id": 30723,
"name": "Test",
"description": "Test",
"country": "AR",
"currency": "ARS",
"amount": 1000.00,
"frequency_type": "DAILY",
"frequency_value": 1,
"active": true,
"free_trial_days": 0,
"plan_token": "yHP2p3MkmAlVF4toE5KBxzls4v5vKoIl",
"created_at": "2023-05-24T14:01:24",
"updated_at": "2023-05-24T14:01:24"
},
"country": "AR",
"subscription_token": "dZuv6J6iWTnSHEVGikPgFu8qzJe0Sc1Y",
"status": "CONFIRMED",
"payment_method_code": "VI",
"client_id": "3072346033029529084",
"client_first_name": "Lionel",
"client_last_name": "Messi",
"client_document_type": "DNI",
"client_document": "xxxx",
"client_email": "messi@gmail.com",
"language": "es",
"card_token": "CID-508ef2e9-f4c4-4be-8a11-a8149522675e",
"dlocal_account_type": "EndUsers",
"scheduled_date": "2023-05-27T14:16:38",
"active": false,
"created_at": "2023-05-24T14:03:06",
"updated_at": "2023-05-26T18:33:21"
},
"status": "DECLINED",
"order_id": "ST-dZuv6J6iWTnSHEVGikPgFu8qzJe0Sc1Y-2",
"merchant_checkout_id": 1347312,
"currency": "ARS",
"amount_paid": 1000.00,
"amount_received": 64.57,
"checkout_currency": "ARS",
"balance_currency": "UYU",
"created_at": "2023-05-26T14:16:38",
"updated_at": "2023-05-26T17:35:14"
},
{
"@id": "dfe8d38b-b136-4d19-a4c7-77cd00dda6a0",
"id": 16,
"subscription": {
"@id": "e2fb122a-1800-4020-943f-32ab75503126",
"id": 3,
"plan": {
"id": 3,
"merchant_id": 30723,
"name": "Test",
"description": "Test",
"country": "AR",
"currency": "ARS",
"amount": 1000.00,
"frequency_type": "DAILY",
"frequency_value": 1,
"active": true,
"free_trial_days": 0,
"plan_token": "yHP2p3MkmAlVF4toE5KBxzls4v5vKoIl",
"created_at": "2023-05-24T14:01:24",
"updated_at": "2023-05-24T14:01:24"
},
"country": "AR",
"subscription_token": "dZuv6J6iWTnSHEVGikPgFu8qzJe0Sc1Y",
"status": "CONFIRMED",
"payment_method_code": "VI",
"client_id": "3072346033029529084",
"client_first_name": "Lionel",
"client_last_name": "Messi",
"client_document_type": "DNI",
"client_document": "xxxxxxx",
"client_email": "messi@gmail.com",
"language": "es",
"card_token": "CID-508ef2e9-f4c4-4be-8a11-a8149522675e",
"dlocal_account_type": "EndUsers",
"scheduled_date": "2023-05-27T14:16:38",
"active": false,
"created_at": "2023-05-24T14:03:06",
"updated_at": "2023-05-26T18:33:21"
},
"status": "COMPLETED",
"order_id": "ST-dZuv6J6iWTnSHEVGikPgFu8qzJe0Sc1Y-1",
"merchant_checkout_id": 1344506,
"currency": "ARS",
"amount_paid": 1000.00,
"amount_received": 64.57,
"external_transaction_id": "T-30003-a09afcd3-0718-43fb-96b7-636ee71cb8a5",
"checkout_currency": "ARS",
"balance_currency": "UYU",
"created_at": "2023-05-25T14:16:34",
"updated_at": "2023-05-25T14:26:43"
},
{
"@id": "13503f9a-9d4e-4ffb-830b-498a918181b6",
"id": 3,
"subscription": {
"@id": "465d3295-f8bf-47d2-821d-681ab7d17962",
"id": 3,
"plan": {
"id": 3,
"merchant_id": 30723,
"name": "Test",
"description": "Test",
"country": "AR",
"currency": "ARS",
"amount": 1000.00,
"frequency_type": "DAILY",
"frequency_value": 1,
"active": true,
"free_trial_days": 0,
"plan_token": "yHP2p3MkmAlVF4toE5KBxzls4v5vKoIl",
"created_at": "2023-05-24T14:01:24",
"updated_at": "2023-05-24T14:01:24"
}
}
}
]
}
```
--------------------------------
### Querying Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions
Example of how to perform an HTTP GET request to query the documentation dynamically using the 'ask' query parameter.
```http
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions.md?ask=
```
--------------------------------
### Querying Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/rate-limits
Example of how to query the documentation dynamically using the `ask` query parameter in an HTTP GET request.
```HTTP
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/rate-limits.md?ask=
```
--------------------------------
### Example: Using onCardBinChange
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/transparent-checkout
An example demonstrating how to use the onCardBinChange event handler to log detected BIN data.
```javascript
onCardBinChange((binData) => {
console.log("BIN detected:", binData.bin);
console.log("Card brand:", binData.brand);
});
```
--------------------------------
### 200: OK Response example
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/create-a-plan
Example of a successful response when creating a subscription plan.
```json
{
"id": 1584,
"merchant_id": 590,
"name": "Test Plan",
"description": "Testing plans",
"country": "UY",
"currency": "UYU",
"amount": 500,
"frequency_type": "MONTHLY",
"frequency_value": 1,
"active": true,
"free_trial_days": 0,
"plan_token": "8ceWJ0nFvoPYGI3Y3sJqpQD4HE7IlPHi",
"created_at": "2024-06-10T18:09:27.262601811",
"updated_at": "2024-06-10T18:09:27.262609441",
"notification_url": "https://webhook.site/29945c7f-ebff-44f7-9cc6-a2a3984757ca",
"subscribe_url": "https://checkout-sbx.dlocalgo.com/validate/subscription/8ceWJ0nFvoPYGI3Y3sJqpQD4HE7IlPHi",
"back_url": "https://example.com/back",
"success_url": "https://example.com/success",
"error_url": "https://example.com/error"
}
```
--------------------------------
### 200: OK Example response
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-a-single-execution-for-a-subscription
Example JSON response for a successful retrieval of a subscription execution.
```json
{
"@id": "d4b39e98-981a-4020-95b4-dff27af4a791",
"id": 931,
"subscription": {
"@id": "74724e6a-46ad-4104-87a4-52f4bbcb921a",
"id": 309,
"plan": {
"id": 279,
"merchant_id": 1960,
"name": "test subscription with credit cards",
"description": "test subscription with credit cards",
"country": "UY",
"currency": "UYU",
"amount": 1999.00,
"frequency_type": "MONTHLY",
"frequency_value": 1,
"active": true,
"free_trial_days": 0,
"plan_token": "pjGwO7sdTLJalJ8d2GTlkClWEOqhSjCG",
"created_at": "2023-12-20T13:46:30",
"updated_at": "2023-12-20T13:46:30",
"notification_url": null,
"subscribe_url": null,
"back_url": null,
"success_url": null,
"error_url": null
},
"country": "UY",
"subscription_token": "Hqw2bFx6sX25SYz1LkSUPyFpO8u2WMCU",
"status": "CREATED",
"active": false,
"created_at": "2023-12-20T14:01:46",
"updated_at": "2023-12-20T14:01:46"
},
"status": "PENDING",
"order_id": "ST-Hqw2bFx6sX25SYz1LkSUPyFpO8u2WMCU-0",
"merchant_checkout_id": 28112,
"currency": "UYU",
"external_id": 1234,
"created_at": "2023-12-20T14:01:47",
"updated_at": "2023-12-20T14:01:47"
}
```
--------------------------------
### 200: OK Example Response
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/retrieve-chargebacks
An example of a successful response when retrieving chargebacks.
```json
{
"data": [
{
"id": "CBK-16",
"local_amount": 150.00,
"balance_amount": 150.00,
"balance_fee": 0.00,
"currency": "USD",
"balance_currency": "USD",
"country": "UX",
"date": "2024-10-16T15:50:04",
"status": "SUCCESS",
"order_id": "212089344990215059",
"payment_id": "DP-68882"
},
{
"id": "CBK-11",
"local_amount": 50.00,
"balance_amount": 48.08,
"balance_fee": 0.00,
"currency": "USD",
"balance_currency": "USD",
"country": "PA",
"date": "2024-09-24T17:30:04",
"status": "SUCCESS",
"order_id": "ST-jwUMrUlvg4QOejcfrcimMSOAnEoPArRz-5",
"payment_id": "DP-56056"
},
{
"id": "CBK-10",
"local_amount": 430.94,
"balance_amount": 9.35,
"balance_fee": 0.00,
"currency": "UYU",
"balance_currency": "USD",
"country": "UY",
"date": "2024-09-23T17:00:03",
"status": "SUCCESS",
"order_id": "212038208632496758",
"payment_id": "DP-60526"
}
],
"totalElements": 3,
"totalPages": 1,
"page": 0,
"numberOfElements": 3,
"size": 10
}
```
--------------------------------
### 200: OK Example response
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-a-single-plan
This is an example of a successful response when retrieving a single plan, showing the structure of the Plan object.
```json
{
"id": 1555,
"merchant_id": 590,
"name": "Test Plan webhook2",
"description": "Testing webhooks2",
"country": "UY",
"currency": "UYU",
"amount": 1000.00,
"frequency_type": "WEEKLY",
"frequency_value": 2,
"active": true,
"free_trial_days": 0,
"plan_token": "zTutFN3UYJUFwnDscjPzeeb77DzXGfYq",
"created_at": "2024-05-03T21:59:34",
"updated_at": "2024-06-07T20:24:15",
"notification_url": "https://webhook.site/e4e9a32a-9009-42b6-ab11-e5d18a68620b",
"subscribe_url": "https://checkout-sbx.dlocalgo.com/validate/subscription/zTutFN3UYJUFwnDscjPzeeb77DzXGfYq",
"back_url": "https://example.com/back",
"success_url": "https://example.com/success",
"error_url": "https://example.com/error"
}
```
--------------------------------
### 200: OK Example response
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/recurring-links/create-a-recurring-link
This is an example of a successful response when creating a recurring link.
```javascript
{
"url": "https://checkout.dlocalgo.com/validate/recurring/uYAJVXw4pJTc6QyFvkWXvm28pl5NcLW4"
}
```
--------------------------------
### Example OK Response
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/retrieve-a-refund
An example of a successful response when retrieving refund details.
```json
{
"id": "REF-54364",
"amount": 500.00,
"currency": "BRL",
"status": "SUCCESS",
"order_id": "83779"
}
```
--------------------------------
### Querying Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-all-plans
Instructions on how to ask questions about the documentation using an HTTP GET request with the 'ask' query parameter.
```HTTP
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-all-plans.md?ask=
```
--------------------------------
### Agent Instructions: Querying This Documentation
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/create-a-payment
Instructions on how to dynamically query the documentation using an HTTP GET request with the 'ask' query parameter.
```text
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/create-a-payment.md?ask=
The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.
Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
```
--------------------------------
### Querying Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/create-a-refund
Example of how to query the documentation dynamically using the 'ask' query parameter.
```http
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/create-a-refund.md?ask=
```
--------------------------------
### Example Request for Retrieving Payout Status
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payouts-integration/notifications
An example GET request to retrieve the status of a payout with a specific ID.
```http
GET /v1/payouts/63466138405171
```
--------------------------------
### HTTP GET Request for Dynamic Documentation Query
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/cancel-subscription
Example of an HTTP GET request to query the documentation dynamically using the 'ask' query parameter.
```http
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/cancel-subscription.md?ask=
```
--------------------------------
### Query Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/create-a-plan
Perform an HTTP GET request on the current page URL with the `ask` query parameter to ask questions about the documentation.
```HTTP
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/create-a-plan.md?ask=
```
--------------------------------
### Querying Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/retrieve-chargebacks
Instructions on how to query the documentation dynamically using an `ask` query parameter.
```http
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/retrieve-chargebacks.md?ask=
```
--------------------------------
### Confirm Payment with Installments
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/transparent-checkout
Backend example using Node.js and axios to confirm a payment, including the selected installmentsId.
```javascript
app.post('/api/confirm-payment', async (req, res) => {
const {
checkoutToken,
cardToken,
clientFirstName,
clientLastName,
clientDocumentType,
clientDocument,
clientEmail,
installmentsId, // installment id of the selected plan
} = req.body;
const apiKey = process.env.DLOCALGO_API_KEY;
const apiSecret = process.env.DLOCALGO_API_SECRET;
const apiUrl = process.env.DLOCALGO_API_URL || 'https://api-sbx.dlocalgo.com';
const authorizationHeader = `Bearer ${apiKey}:${apiSecret}`;
const requestBody = {
cardToken: cardToken,
clientFirstName: clientFirstName,
clientLastName: clientLastName,
clientDocumentType: clientDocumentType,
clientDocument: clientDocument,
clientEmail: clientEmail,
installmentsId: installmentsId
};
try {
const response = await axios.post(
`${apiUrl}/v1/payments/confirm/${checkoutToken}`, // DGO Confirm Payment Endpoint
requestBody,
{
headers: {
'Content-Type': 'application/json',
'Authorization': authorizationHeader,
},
}
);
return res.json(response.data);
} catch (error) {
return res.status(500).json({ error: 'Payment confirmation failed' });
}
});
```
--------------------------------
### Querying Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-all-subscriptions-by-plan
You can query the documentation dynamically by asking a question using the `ask` query parameter in an HTTP GET request. This is useful when the answer is not explicitly present on the page, or when you need clarification or additional context.
```HTTP
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-all-subscriptions-by-plan.md?ask=
```
--------------------------------
### Querying Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payouts-integration/purpose-codes
Example of how to perform an HTTP GET request to query the documentation dynamically with an 'ask' query parameter.
```http
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payouts-integration/purpose-codes.md?ask=
```
--------------------------------
### Querying Documentation
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/retrieve-a-payment
This example shows how to query the dLocal Go API documentation dynamically by appending an 'ask' query parameter to the URL.
```HTTP
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/retrieve-a-payment.md?ask=
```
--------------------------------
### Querying Documentation Dynamically
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payouts-integration/country-requirements/argentina
Example of how to perform an HTTP GET request to query the documentation dynamically using the `ask` query parameter.
```HTTP
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payouts-integration/country-requirements/argentina.md?ask=
```
--------------------------------
### Querying Documentation via HTTP GET
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payouts-integration/country-requirements/ecuador
Demonstrates how to perform an HTTP GET request to a documentation URL with an 'ask' query parameter to get specific information.
```HTTP
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payouts-integration/country-requirements/ecuador.md?ask=
```
--------------------------------
### Query Documentation via HTTP GET
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/retrieve-payments
Demonstrates how to perform an HTTP GET request to a documentation page with the `ask` query parameter to get dynamic answers.
```HTTP
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/retrieve-payments.md?ask=
```
--------------------------------
### Querying Documentation
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-a-single-execution-for-a-subscription
Perform an HTTP GET request on the current page URL with the `ask` query parameter to dynamically query the documentation.
```http
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/subscriptions/retrieve-a-single-execution-for-a-subscription.md?ask=
```
--------------------------------
### Querying Documentation
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/one-click-upsell
Perform an HTTP GET request on the current page URL with the `ask` query parameter to dynamically query the documentation.
```http
GET https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/one-click-upsell.md?ask=
```
--------------------------------
### Sample API call to create a payment
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payments/create-a-payment
This cURL command demonstrates how to make a POST request to the dLocal Go API to create a new payment.
```sh
curl --location 'https://api-sbx.dlocalgo.com/v1/payments' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer API_KEY:API_SECRET' \
--data '{
"currency": "BRL",
"amount": 500,
"country": "BR",
"order_id": 83778,
"description": "Order 83778 - example.com",
"success_url": "https://example.com/success",
"back_url": "https://example.com/",
"notification_url": "https://example.com/notifications"
}'
```
--------------------------------
### B2C Request Example
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payouts-integration
Example JSON payload for creating a B2C payout request.
```json
{
"transfer_amount": 150.00,
"transfer_country": "BR",
"flow_type": "B2C",
"purpose": "REWARDS",
"beneficiary_first_name": "Maria",
"beneficiary_last_name": "Silva",
"beneficiary_document": "11144477735",
"beneficiary_document_type": "CPF",
"bank_code": "341",
"bank_account": "123456",
"bank_branch": "0001",
"bank_account_type": "CHECKING",
"currency_to_pay": "BRL",
"description": "BR B2C payout test"
}
```
--------------------------------
### B2B Request Example
Source: https://docs.dlocalgo.com/integration-api/welcome-to-dlocal-go-api/payouts-integration
Example JSON payload for creating a B2B payout request.
```json
{
"transfer_amount": 300.20,
"transfer_country": "UY",
"flow_type": "B2B",
"purpose": "REWARDS",
"business_name": "Business B2B Test UY",
"beneficiary_first_name": "Maria",
"beneficiary_last_name": "Silva",
"beneficiary_document": "211003420017",
"beneficiary_document_type": "RUT",
"bank_code": "137",
"bank_account": "000001440080",
"bank_branch": "67",
"bank_account_type": "CHECKING",
"currency_to_pay": "UYU",
"description": "UY B2B test payout"
}
```