Guides

How to integrate dLocal: a step-by-step guide for managers, with real API examples

Guide · For managers · · 18 min read

You do not need to be an engineer to understand a payment integration. This guide follows one payment from start to finish, using dLocal's real API, and explains each step in plain language: what happens, who does it, what it costs and what can go wrong.

For
Managers and non-technical teams
Provider
dLocal (Payins API, version 2.1)
Example market
Colombia

Summary

  • A dLocal integration has three phases: prepare (contract and keys), build (the API work) and launch (testing, going live and monitoring).
  • Technically, it comes down to a few conversations between your server and dLocal: sign the request, create the payment, read the answer, listen for updates, and refund when needed.
  • The biggest decision is how customers enter their card details. It decides your security obligations (PCI DSS), your control over the checkout and the effort.
  • Costs come from three places: dLocal's fees, compliance, and your team's time.
  • Most problems after launch come from the details: currency, document numbers, notifications and reconciliation.

The whole process on one page

Before the details, here is the full picture. The integration has three phases and twelve steps. Different people own different phases.

  1. Phase 1: Prepare Business, finance, legal
    1. Agree the contract and complete onboarding
    2. Get your API keys
  2. Phase 2: Build Engineering, product
    1. Sign every request
    2. Choose how customers enter card details
    3. Ask which payment methods are available
    4. Create a payment
    5. Read the answer
    6. Receive notifications
    7. Handle refunds
  3. Phase 3: Launch Engineering, operations, finance
    1. Test in the sandbox
    2. Go live
    3. Monitor and reconcile

The steps use some technical words. Eight of them are enough to follow the rest of this guide.

Eight words you need

API
A way for two computer systems to talk. Your website sends a message to dLocal, and dLocal answers.
Endpoint
A specific address for one task, like a specific counter in a bank: one for payments, another for refunds.
Request and response
The message you send (the request) and the answer you get back (the response).
JSON
The text format of the messages: a list of labels and values, such as "currency": "COP".
Sandbox
A practice copy of dLocal where nothing is real. You can test without moving real money.
Webhook (notification)
A message that dLocal sends to you when something changes, for example when a payment is completed.
Token
A temporary code that replaces the card number, so your systems never see the real card.
PCI DSS
The card industry's security rules. The more card data you handle, the more of these rules apply to you.

With these words, we can start where every integration starts: the contract.

Phase 1

Prepare

Step 1 Agree the contract and complete onboarding

dLocal works with businesses under a contract. Before any live payment, you agree on the countries, the payment methods, the fees and the currency in which dLocal pays you (the settlement currency). dLocal also checks your business, a process called KYC ("know your customer"). dLocal's documentation is clear: production access is only available after the agreement is signed, KYC is approved and the integration has been tested in the sandbox.

Who: business, finance and legal. Tip: start this early. It runs in parallel with the technical work and is often the slowest part.

While the contract is being finalised, engineers can already start with test keys.

Step 2 Get your API keys

Your team creates API credentials in dLocal's Merchant Dashboard, separately for the sandbox and for live payments. Each set has three keys:

  • x-login identifies your account, like a username.
  • x-trans-key works with x-login to prove that it is you, like a password.
  • Secret key is used to sign every request, like a personal seal. It must never be shared or put in a website's code.

If you use Smart Fields (see step 4), there is a fourth key for the browser: the Smart Fields key.

With the keys in place, engineering can build. The first thing to build is the signature.

Phase 2

Build

Step 3 Sign every request

Every message to dLocal carries a few headers: labels on the envelope. They say who you are, when you sent it and which version of the API you use. The last one, Authorization, is the seal.

What the envelope looks like
POST https://sandbox.dlocal.com/payments

X-Date: 2026-10-30T10:00:00.000Z
X-Login: your_x_login
X-Trans-Key: your_x_trans_key
X-Version: 2.1
Content-Type: application/json
Authorization: V2-HMAC-SHA256, Signature: 3b1f7c…e9a2

The seal is a calculation called HMAC-SHA256. Your server combines your x-login, the date and the exact text of the message, and calculates a code with your secret key. dLocal does the same calculation. If both codes match, dLocal knows that the message comes from you and that nobody changed it on the way.

The signature in code (Node.js, simplified)
import crypto from "node:crypto";

// The signature proves the request comes from you, unchanged.
// requestBody must be the exact JSON text that you send.
function signRequest(xLogin, xDate, requestBody, secretKey) {
  const data = xLogin + xDate + requestBody;
  const signature = crypto
    .createHmac("sha256", secretKey)
    .update(data)
    .digest("hex");
  return `V2-HMAC-SHA256, Signature: ${signature}`;
}

For managers: this is a small piece of code, but if it is wrong, nothing works. A common mistake is to sign one version of the message and send a slightly different one.

Once requests are signed, the team makes its most important decision: how the customer enters card details.

Step 4 Choose how customers enter card details

Card numbers are sensitive. The more your own systems touch them, the more security rules (PCI DSS) apply to you. dLocal offers three options.

Three integration options
Option How it works Security level (PCI DSS) Control of the design Effort (my estimate)
Redirect The customer goes to a payment page hosted by dLocal, then comes back. Usually the lightest level (SAQ A) Low: dLocal's page 1–3 weeks
Smart Fields Secure card fields from dLocal appear inside your own checkout page. SAQ A, according to dLocal High: your page, dLocal's fields 3–6 weeks
Full API Your systems collect the card data and send it to dLocal. Full PCI DSS compliance required Total 2–4 months, including PCI work

For most businesses, Smart Fields is the best balance. The card fields look like part of your page, but they are secure frames hosted by dLocal. When the customer clicks "Pay", dLocal turns the card into a token that your server can use once, within 10 minutes.

Smart Fields in the browser (simplified)
// In the customer's browser (simplified)
const dlocalInstance = dlocal("YOUR_SMART_FIELDS_KEY");
const fields = dlocalInstance.fields({ locale: "es", country: "CO" });

// One secure field for the card number, expiry date and CVV
const card = fields.create("card");
card.mount(document.getElementById("card-field"));

// When the customer clicks "Pay":
const result = await dlocalInstance.createToken(card, { name: "Laura Gómez" });
// Send result.token to your server.
// The token expires after 10 minutes or after one use.

Now the checkout can collect a card safely. But cards are only one way to pay, so the next step is to ask what else is available.

Step 5 Ask which payment methods are available

Each country has its own payment methods: cards everywhere, but also cash, bank transfers and wallets. Your server can ask dLocal which methods are available for a country.

Request
GET https://sandbox.dlocal.com/payments-methods?country=CO
Answer (simplified)
[
  {
    "id": "CARD",
    "type": "CARD",
    "name": "Credit and debit cards",
    "allowed_flows": ["DIRECT", "REDIRECT"]
  },
  {
    "id": "EY",
    "type": "TICKET",
    "name": "Efecty",
    "allowed_flows": ["DIRECT", "REDIRECT"]
  }
]

Each method has an ID (for example CARD or EY for Efecty cash payments), a type and the flows it supports. Your checkout can use this list to show only the methods that work for the customer's country.

Now everything is ready for the main event: the payment itself.

Step 6 Create a payment

Your server sends one message to dLocal with everything it needs to know. Here is a card payment from a customer in Colombia, paying COP 189,900 with a Smart Fields token:

Create a payment
POST https://sandbox.dlocal.com/payments

{
  "amount": 189900,
  "currency": "COP",
  "country": "CO",
  "payment_method_id": "CARD",
  "payment_method_flow": "DIRECT",
  "payer": {
    "name": "Laura Gómez",
    "email": "laura@example.com",
    "document": "1023456789"
  },
  "card": {
    "token": "CV-124c18a5-874d-4982-89d7-b9c256e647b5"
  },
  "order_id": "ORDER-2026-000123",
  "notification_url": "https://www.example.com/dlocal/notifications"
}
What each field means
FieldMeaning
amount How much to charge. For COP, a whole number: dLocal lists 0 decimals for Colombia.
currency The currency of the amount, as a three-letter code. For local payments in Colombia: COP.
country The country where the payment is processed, as a two-letter code: CO for Colombia.
payment_method_id Which payment method: CARD for cards, or the ID of a local method.
payment_method_flow DIRECT (the payment happens on your page) or REDIRECT (the customer goes to a dLocal page).
payer The customer: name, email and document number. The document is required in Colombia (CC or NIT).
card.token The temporary card code created by Smart Fields. Your server never sees the card number.
order_id Your own order number. It connects dLocal's payment to your order.
notification_url The address where dLocal sends updates about this payment.

Two details cause many problems. First, the currency must be one that dLocal accepts for the country; for Colombia that is COP. I explain what happens otherwise in my case study on currency rejections. Second, the document number is required in Colombia. Without it, the payment fails.

A second after the message is sent, dLocal answers. The answer tells you what to do next.

Step 7 Read the answer

dLocal's answer (simplified)
{
  "id": "D-4-cf8eef6b-52d5-4320-b5ea-f5e0bbe4343f",
  "amount": 189900,
  "currency": "COP",
  "country": "CO",
  "payment_method_id": "CARD",
  "status": "PAID",
  "status_code": "200",
  "status_detail": "The payment was paid.",
  "order_id": "ORDER-2026-000123"
}

Three fields matter most. id is dLocal's reference for the payment; save it with your order. status says what happened, and status_code gives the precise reason.

The main payment statuses
StatusCodeWhat it means for you
PAID 200 The money was collected. You can deliver the product.
PENDING 100 Not finished yet. For example, the customer must pay cash at a store or complete 3D Secure (code 101).
REJECTED 300 to 344 Declined. The code says why: 301 rejected by the bank, 302 insufficient amount, 342 invalid document.
CANCELLED 400 The payment was cancelled, for example an unpaid cash payment.
AUTHORIZED 600 The card amount is reserved but not yet collected (used when you capture later).

Some payments need an extra check by the customer's bank, called 3D Secure. In that case, the status is PENDING (code 101) and the answer includes an address where the customer confirms the payment with their bank. After that, the customer returns to your site.

PENDING is the important word here. Many payments finish later, so your system needs a way to hear about it.

Step 8 Receive notifications

Every time a payment changes status, dLocal sends a message to the notification_url from step 6. The message contains the full payment, so your system can update the order: for example, from "waiting for cash payment" to "paid". If your server does not confirm that it received the message, dLocal tries again, up to 12 times.

A good notification handler does four things:

  1. Checks the signature, to be sure the message really comes from dLocal.
  2. Processes each status change only once, even if the same message arrives twice.
  3. Updates the order and triggers the next action: confirm, deliver or cancel.
  4. Answers dLocal quickly that the message was received.

For managers: notifications are invisible to customers, but they decide whether paid orders are delivered. Ask who monitors them, and what happens when they stop arriving.

Payments go in one direction. Sometimes the money must go back.

Step 9 Handle refunds

A refund is a new request that refers to the original payment. You can refund all or part of the amount.

Create a refund
POST https://sandbox.dlocal.com/refunds

{
  "payment_id": "D-4-cf8eef6b-52d5-4320-b5ea-f5e0bbe4343f",
  "amount": 189900,
  "currency": "COP",
  "notification_url": "https://www.example.com/dlocal/refunds"
}

For cards, the money goes back to the card. For other methods, such as cash or bank transfers, dLocal makes a bank transfer to the customer, and may ask the customer by email for their bank details. That is why many refunds are not immediate: they start as PENDING, and the result arrives as a notification. dLocal notes that a refund fee may apply.

The building is done. Before real customers use it, everything must be tested.

Phase 3

Launch

Step 10 Test in the sandbox

The sandbox works like the real dLocal, at a different address (sandbox.dlocal.com), but no money moves. A useful trick: in the sandbox, the description field decides the result. This lets your team test every situation on purpose, including failures.

Simulating a rejected payment
{
  "amount": 189900,
  "currency": "COP",
  "country": "CO",
  "payment_method_id": "CARD",
  "description": "300",
  "...": "the other fields as usual"
}
// In the sandbox, "description": "300" simulates a REJECTED payment,
// and "200" simulates a PAID payment.

For cash payments and refunds, dLocal provides sandbox tools to change the status by hand, for example to simulate a cash payment that is paid or expires. Test each country, each payment method, and at least one success, one rejection and one refund for each.

When the tests pass and the contract is signed, you can switch to real payments.

Step 11 Go live

dLocal activates production when three things are true: the agreement is signed, KYC is approved and the sandbox tests are successful. Then your team replaces the test keys with live keys, changes the address from sandbox.dlocal.com to api.dlocal.com, and checks the approved IP addresses and URLs. A good practice is to start with a small share of traffic or one country, and watch the results closely for the first days.

Going live is not the end. It is the moment the real work of payments starts.

Step 12 Monitor and reconcile

After launch, three numbers tell you whether the integration is healthy:

  • Approval rate: the share of payments that are PAID, by country and payment method. A sudden drop usually means a technical or configuration problem.
  • Errors before processing: requests that dLocal refused, for example for a wrong currency or a missing document. These should be close to zero.
  • Reconciliation: every day, compare your orders, dLocal's payments and the money received. Differences point to missed notifications or unexpected fees.

These numbers also show the costs. The next section explains where they come from.

What it costs

The total cost has three parts: dLocal's fees, compliance and your team's time.

1. dLocal's fees

For larger businesses, dLocal's prices are agreed in the contract. dLocal Go, the self-service version for smaller businesses, publishes a price list, which gives a useful idea of the structure:

dLocal Go published prices, per paid transaction (examples)
CountryCardsOther methods
Colombia USD 0.20 + 1.99% Cash and bank transfer: USD 0.20 + 1.99%
Brazil 2.99% Pix: 0.99%; Boleto: USD 0.50
Mexico USD 0.20 + 2.49% Cash: USD 0.20 + 2.99%
Chile 2.99% Cash and bank transfer: 2.99%
Peru 2.99% Cash: USD 0.99 + 2.99%

The same price list also shows the costs that are easy to forget:

  • Local taxes on the fee: for example 19% in Colombia, applied to the processing fee.
  • Refunds and chargebacks: USD 1 per refund and USD 5 per chargeback.
  • Waiting time: money from cards can be withdrawn after 7 days, and from bank transfers and cash after 3 days. This affects your cash flow.
  • Exchange rate: customers pay in local currency and you are paid in another currency. If your price is in USD, the customer carries the conversion cost; if it is in local currency, you do.

2. Compliance

With the redirect option or Smart Fields, your PCI DSS work is usually limited to a yearly self-assessment questionnaire. With the full API, your systems handle card numbers, so you need full PCI DSS compliance, including audits and security controls. For most businesses, that is a reason to choose Smart Fields.

3. Your team's time

The effort estimates in step 4 cover the first country. Each additional country adds work: its document rules, currency rules, payment methods and tests. After launch, plan ongoing time for monitoring, reconciliation and support. In my experience, this ongoing work is the part that teams underestimate most.

Time depends on people. The next section shows who is involved.

Who you need

RoleMain tasks
Product or project manager Scope, countries, payment methods, timeline and launch decisions.
Backend engineer Signing requests, creating payments, notifications, refunds, logs.
Frontend engineer Checkout page, Smart Fields, error messages, 3D Secure redirects.
Finance Contract, settlement currency, reconciliation, fees and taxes.
Legal and compliance Contract review, onboarding documents (KYC), PCI DSS.
Customer support Payment questions, refunds, failed payments.

The technical skills are standard for a backend team: working with a REST API and JSON, creating signatures, receiving webhooks, and processing each event only once. The harder skill is the knowledge of each market: which documents, currencies and payment methods each country needs.

Before the project starts, a few questions save weeks later.

Seven questions to ask before you start

  1. Which countries and payment methods are in the contract, and which are enabled on our account?

  2. Which currencies can we send for each country, including USD?

  3. In which currency, and how often, will dLocal pay us (settlement), and at what exchange rate?

  4. What are the fees per payment, per refund and per chargeback, and are local taxes added?

  5. Which integration option will we use, and what PCI DSS level does that mean for us?

  6. How do we test each country and payment method in the sandbox?

  7. Who in our team checks notifications, failed payments and reconciliation after launch?

A dLocal integration is a sequence of simple steps: sign, create, read, listen, refund, test and monitor. The difficulty is not in any single step, but in the details of each market and in what happens after launch.

Frequently asked questions

How long does a dLocal integration take?

It depends on the integration option and the number of countries. As an indication, a redirect integration can take one to three weeks, Smart Fields three to six weeks, and a full API integration two to four months including PCI DSS work. Each additional country adds time for its documents, payment methods and testing. The commercial onboarding with dLocal runs in parallel.

How much does dLocal cost?

dLocal's prices for larger businesses are agreed in the contract. dLocal Go, the self-service version, publishes a price list: for example, cards in Colombia at USD 0.20 + 1.99% per paid transaction, a USD 1 refund fee and a USD 5 chargeback fee, with local taxes applied to the fee. Also count the exchange rate, your team's time and PCI DSS compliance.

Do I need to be PCI DSS compliant to use dLocal?

Every business that accepts cards has some PCI DSS obligations. With dLocal's Smart Fields, card details are collected in secure fields hosted by dLocal, which dLocal says makes you eligible for the lightest level, SAQ A. If your own systems handle card numbers (the full API option), you need full PCI DSS compliance.

What is a webhook, and why does dLocal need one?

A webhook is an address on your server where dLocal sends a message when a payment changes status. It is needed because many payments do not finish immediately, for example cash payments or payments that need 3D Secure. dLocal retries a notification up to 12 times, and you should verify its signature before you trust it.

Can I test dLocal without real money?

Yes. dLocal's sandbox is a test environment that works like production but without real payments. You can simulate results by sending a status code in the description field, for example 200 for a paid payment and 300 for a rejected one.

Topics

  • dLocal
  • dLocal API
  • Payment integration
  • Payins
  • Smart Fields
  • Webhooks
  • HMAC signature
  • PCI DSS
  • Sandbox
  • Refunds
  • Payment costs
  • Latin America

Planning a dLocal integration, or improving one that is already live? I can help your team plan it, review it or find what is not working.

Sources

  1. dLocal Docs — Get your API credentials
  2. dLocal Docs — Generate a signature
  3. dLocal Docs — Payins security
  4. dLocal Docs — Smart Fields
  5. dLocal Docs — The dLocal object (createToken)
  6. dLocal Docs — Full API and PCI DSS
  7. dLocal Docs — The Card object
  8. dLocal Docs — The Payment Method object
  9. dLocal Docs — Create payment
  10. dLocal Docs — Card payments
  11. dLocal Docs — 3D Secure authentication
  12. dLocal Docs — Payment status codes
  13. dLocal Docs — Receive notifications
  14. dLocal Docs — Refunds
  15. dLocal Docs — Make a test payment (sandbox)
  16. dLocal Docs — Enable Live mode
  17. dLocal Docs — Country reference
  18. dLocal Go — Price list (PDF)
  19. dLocal Go Help Center — Exchange rates and who pays them
← All case studies and guides