> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gr4vy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# dLocal - Pix

> Configure Pix via dLocal as a payment method in Gr4vy.

**dLocal**

dLocal is a global payments platform that helps you accept local payment methods and cards across emerging markets.

Pix is Brazil's instant payment system, created by the Central Bank of Brazil, enabling real-time transfers and payments 24/7.

## Setup

Please follow the [common dLocal instructions](https://docs.gr4vy.com/connections/payments/dlocal.md) to get set up with Pix.

Next, make sure to enable Pix as a payment method on your configured account.

## Capabilities

This list is for guidance only. It doesn't guarantee availability or
create any rights, and the provider may need to enable some features for
your account.

## Supported countries

## Supported currencies

## Integration

For Pix, the default integration is through a redirect to a hosted payments page.

Start by creating a new transaction with the following required fields.

```csharp C# theme={"system"}
var transaction = await client.Transactions.CreateAsync(
    transactionCreate: new TransactionCreate()
    {
        Amount = 1299,
        Currency = "BRL",
        Country = "BR",
        PaymentMethod =
            TransactionCreatePaymentMethod.CreateRedirectPaymentMethodCreate(
                new RedirectPaymentMethodCreate()
                {
                    Method = "pix",
                    Country = "BR",
                    Currency = "BRL",
                    RedirectUrl = "https://example.com/callback",
                }
            ),
    }
);
```

```go Go theme={"system"}
amount := int64(1299)
currency := "BRL"
country := "BR"
method := components.RedirectPaymentMethodCreateMethodPix
redirectUrl := "https://example.com/callback"

redirectPaymentMethodCreate := components.RedirectPaymentMethodCreate{
    Method: method,
    Country: country,
    Currency: currency,
    RedirectURL: redirectUrl,
}
paymentMethod := components.CreateTransactionCreatePaymentMethodRedirectPaymentMethodCreate(redirectPaymentMethodCreate)

transactionCreate := components.TransactionCreate{
    Amount:        amount,
    Currency:      currency,
    Country:       &country,
    PaymentMethod: &paymentMethod,
}

transaction, err := client.Transactions.Create(ctx, transactionCreate, nil, nil, nil)
```

```java Java theme={"system"}
CreateTransactionResponse transactionResponse = gr4vyClient.transactions().create()
    .transactionCreate(TransactionCreate.builder()
        .amount(1299L)
        .currency("BRL")
        .country("BR")
        .paymentMethod(TransactionCreatePaymentMethod.of(RedirectPaymentMethodCreate.builder()
            .method(RedirectPaymentMethodCreateMethod.PIX)
            .country("BR")
            .currency("BRL")
            .redirectUrl("https://example.com/callback")
            .build()))
        .build())
    .call();

Transaction transaction = transactionResponse.transaction().orElse(null);
```

```php PHP theme={"system"}
$transactionCreate = new TransactionCreate(
    amount: 1299,
    currency: 'BRL',
    country: 'BR',
    paymentMethod: new RedirectPaymentMethodCreate(
        method: 'pix',
        country: 'BR',
        currency: 'BRL',
        redirectUrl: 'https://example.com/callback'
    )
);
$response = self::$sdk->transactions->create($transactionCreate);
$transaction = $response->transaction;
```

```python Python theme={"system"}
transaction: models.Transaction = client.transactions.create(
    amount=1299,
    currency="BRL",
    country="BR",
    payment_method={
        "method": "pix",
        "country": "BR",
        "currency": "BRL",
        "redirect_url": "https://example.com/callback",
    }
)
```

```ts TypeScript theme={"system"}
const transaction = await gr4vy.transactions.create({
    amount: 1299,
    currency: "BRL",
    country: "BR",
    paymentMethod: {
        method: "pix",
        country: "BR",
        currency: "BRL",
        redirectUrl: "https://example.com/callback"
    }
})
```

After the transaction is created, the API response includes `payment_method.approval_url` and the status is set to `buyer_approval_pending`.

Redirect the buyer to the `approval_url` so they can complete the payment. After approval the buyer is redirected to the `redirect_url` you provided when creating the transaction. Do not rely solely on the redirect - either poll the transaction or (recommended) rely on webhooks to detect the final status (for example `capture_succeeded` or failure states).

## Recurring transactions

### Enrollment

To enroll a buyer in Pix Automático, create an initial payment with tokenization enabled and pass `dlocal-pix` connection options.

* Set `store` to `true` to save the payment method.
* Pass `connection_options.dlocal-pix.subscription` with the recurring enrollment details.

Use one of the following SDK requests:

```csharp C# theme={"system"}
var transaction = await client.Transactions.CreateAsync(
    transactionCreate: new TransactionCreate()
    {
        Amount = 1299,
        Currency = "BRL",
        Country = "BR",
        PaymentMethod =
            TransactionCreatePaymentMethod.CreateRedirectPaymentMethodCreate(
                new RedirectPaymentMethodCreate()
                {
                    Method = "pix",
                    Country = "BR",
                    Currency = "BRL",
                    RedirectUrl = "https://example.com/callback",
                }
            ),
        Store = true,
        ConnectionOptions = new Dictionary<string, object>()
        {
            ["dlocal-pix"] = new Dictionary<string, object>()
            {
                ["subscription"] = new Dictionary<string, object>()
                {
                    ["frequency"] = "MONTHLY",
                    ["amount"] = new Dictionary<string, string>()
                    {
                        ["type"] = "FIXED",
                        ["value"] = "10.00"
                    },
                    ["start_date"] = "2026-03-01",
                    ["end_date"] = "2027-03-01"
                }
            }
        }
    }
);
```

```go Go theme={"system"}
amount := int64(1299)
currency := "BRL"
country := "BR"
method := components.RedirectPaymentMethodCreateMethodPix
redirectUrl := "https://example.com/callback"
store := true

redirectPaymentMethodCreate := components.RedirectPaymentMethodCreate{
    Method: method,
    Country: country,
    Currency: currency,
    RedirectURL: redirectUrl,
}
paymentMethod := components.CreateTransactionCreatePaymentMethodRedirectPaymentMethodCreate(redirectPaymentMethodCreate)

transactionCreate := components.TransactionCreate{
    Amount:        amount,
    Currency:      currency,
    Country:       &country,
    PaymentMethod: &paymentMethod,
    Store:         &store,
    ConnectionOptions: map[string]any{
        "dlocal-pix": map[string]any{
            "subscription": map[string]any{
                "frequency": "MONTHLY",
                "amount": map[string]string{
                    "type":  "FIXED",
                    "value": "10.00",
                },
                "start_date": "2026-03-01",
                "end_date": "2027-03-01",
            },
        },
    },
}

transaction, err := client.Transactions.Create(ctx, transactionCreate, nil, nil, nil)
```

```java Java theme={"system"}
Map<String, String> amountOptions = new HashMap<>();
amountOptions.put("type", "FIXED");
amountOptions.put("value", "10.00");

Map<String, Object> subscriptionOptions = new HashMap<>();
subscriptionOptions.put("frequency", "MONTHLY");
subscriptionOptions.put("amount", amountOptions);
subscriptionOptions.put("start_date", "2026-03-01");
subscriptionOptions.put("end_date", "2027-03-01");

Map<String, Object> pixOptions = new HashMap<>();
pixOptions.put("subscription", subscriptionOptions);

Map<String, Object> connectionOptions = new HashMap<>();
connectionOptions.put("dlocal-pix", pixOptions);

CreateTransactionResponse transactionResponse = gr4vyClient.transactions().create()
    .transactionCreate(TransactionCreate.builder()
        .amount(1299L)
        .currency("BRL")
        .country("BR")
        .paymentMethod(TransactionCreatePaymentMethod.of(RedirectPaymentMethodCreate.builder()
            .method(RedirectPaymentMethodCreateMethod.PIX)
            .country("BR")
            .currency("BRL")
            .redirectUrl("https://example.com/callback")
            .build()))
        .store(true)
        .connectionOptions(connectionOptions)
        .build())
    .call();

Transaction transaction = transactionResponse.transaction().orElse(null);
```

```php PHP theme={"system"}
$transactionCreate = new TransactionCreate(
    amount: 1299,
    currency: 'BRL',
    country: 'BR',
    paymentMethod: new RedirectPaymentMethodCreate(
        method: 'pix',
        country: 'BR',
        currency: 'BRL',
        redirectUrl: 'https://example.com/callback'
    ),
    store: true,
    connectionOptions: [
        'dlocal-pix' => [
            'subscription' => [
                'frequency' => 'MONTHLY',
                'amount' => [
                    'type' => 'FIXED',
                    'value' => '10.00'
                ],
                'start_date' => '2026-03-01',
                'end_date' => '2027-03-01'
            ]
        ]
    ]
);
$response = self::$sdk->transactions->create($transactionCreate);
$transaction = $response->transaction;
```

```python Python theme={"system"}
transaction: models.Transaction = client.transactions.create(
    amount=1299,
    currency="BRL",
    country="BR",
    payment_method={
        "method": "pix",
        "country": "BR",
        "currency": "BRL",
        "redirect_url": "https://example.com/callback",
    },
    store=True,
    connection_options={
        "dlocal-pix": {
            "subscription": {
                "frequency": "MONTHLY",
                "amount": {
                    "type": "FIXED",
                    "value": "10.00"
                },
                "start_date": "2026-03-01",
                "end_date": "2027-03-01"
            }
        }
    }
)
```

```ts TypeScript theme={"system"}
const transaction = await gr4vy.transactions.create({
    amount: 1299,
    currency: "BRL",
    country: "BR",
    paymentMethod: {
        method: "pix",
        country: "BR",
        currency: "BRL",
        redirectUrl: "https://example.com/callback"
    },
    store: true,
    connectionOptions: {
        "dlocal-pix": {
            subscription: {
                frequency: "MONTHLY",
                amount: {
                    type: "FIXED",
                    value: "10.00"
                },
                start_date: "2026-03-01",
                end_date: "2027-03-01"
            }
        }
    }
})
```

After you create the enrollment transaction, redirect the buyer to the `approval_url` to complete the Pix Automático enrollment. Once the buyer approves it, the payment method is saved and available for subsequent recurring charges.

### Subsequent payment

After enrollment succeeds, create subsequent charges with the saved payment method ID.

* Set `payment_method.method` to `id` and pass the saved payment method ID.
* Set `payment_source` to `recurring`.
* Set `merchant_initiated` and `is_subsequent_payment` to `true`.
* Optionally set `connection_options.dlocal-pix.scheduled_date` in `YYYY-MM-DD` format.

```csharp C# theme={"system"}
var transaction = await client.Transactions.CreateAsync(
    transactionCreate: new TransactionCreate()
    {
        Amount = 1299,
        Currency = "BRL",
        Country = "BR",
        PaymentMethod = TransactionCreatePaymentMethod.CreateTokenPaymentMethodCreate(
            new TokenPaymentMethodCreate()
            {
                Id = "f758d736-9a81-4bd0-85a9-2d3ee361b863"
            }
        ),
        IsSubsequentPayment = true,
        MerchantInitiated = true,
        PaymentSource = "recurring",
        ConnectionOptions = new Dictionary<string, object>()
        {
            ["dlocal-pix"] = new Dictionary<string, string>()
            {
                ["scheduled_date"] = "2026-03-05"
            }
        }
    }
);
```

```go Go theme={"system"}
amount := int64(1299)
currency := "BRL"
country := "BR"
paymentSource := components.TransactionPaymentSourceRecurring

tokenPaymentMethodCreate := components.TokenPaymentMethodCreate{
    ID:     "f758d736-9a81-4bd0-85a9-2d3ee361b863",
}
paymentMethod := components.CreateTransactionCreatePaymentMethodTokenPaymentMethodCreate(tokenPaymentMethodCreate)

transactionCreate := components.TransactionCreate{
    Amount:              amount,
    Currency:            currency,
    Country:             &country,
    PaymentMethod:       &paymentMethod,
    IsSubsequentPayment: gr4vy.Bool(true),
    MerchantInitiated:   gr4vy.Bool(true),
    PaymentSource:       &paymentSource,
    ConnectionOptions: map[string]any{
        "dlocal-pix": map[string]string{
            "scheduled_date": "2026-03-05",
        },
    },
}

transaction, err := client.Transactions.Create(ctx, transactionCreate, nil, nil, nil)
```

```java Java theme={"system"}
CreateTransactionResponse transactionResponse = gr4vyClient.transactions().create()
    .transactionCreate(TransactionCreate.builder()
        .amount(1299L)
        .currency("BRL")
        .country("BR")
        .paymentMethod(TransactionCreatePaymentMethod.of(TokenPaymentMethodCreate.builder()
            .id("f758d736-9a81-4bd0-85a9-2d3ee361b863")
            .build()))
        .isSubsequentPayment(true)
        .merchantInitiated(true)
        .paymentSource(TransactionPaymentSource.RECURRING)
        .connectionOptions(Map.of(
            "dlocal-pix", Map.of(
                "scheduled_date", "2026-03-05"
            )
        ))
        .build())
    .call();

Transaction transaction = transactionResponse.transaction().orElse(null);
```

```php PHP theme={"system"}
$transactionCreate = new TransactionCreate(
    amount: 1299,
    currency: 'BRL',
    country: 'BR',
    paymentMethod: new TokenPaymentMethodCreate(
        id: 'f758d736-9a81-4bd0-85a9-2d3ee361b863'
    ),
    isSubsequentPayment: true,
    merchantInitiated: true,
    paymentSource: 'recurring',
    connectionOptions: [
        'dlocal-pix' => [
            'scheduled_date' => '2026-03-05'
        ]
    ]
);
$response = self::$sdk->transactions->create($transactionCreate);
$transaction = $response->transaction;
```

```python Python theme={"system"}
transaction: models.Transaction = client.transactions.create(
    amount=1299,
    currency="BRL",
    country="BR",
    payment_method=models.TokenPaymentMethodCreate(
        id="f758d736-9a81-4bd0-85a9-2d3ee361b863"
    ),
    is_subsequent_payment=True,
    merchant_initiated=True,
    payment_source="recurring",
    connection_options={
        "dlocal-pix": {
            "scheduled_date": "2026-03-05"
        }
    }
)
```

```ts TypeScript theme={"system"}
const transaction = await gr4vy.transactions.create({
    amount: 1299,
    currency: "BRL",
    country: "BR",
    paymentMethod: {
        method: "id",
        id: "f758d736-9a81-4bd0-85a9-2d3ee361b863"
    },
    isSubsequentPayment: true,
    merchantInitiated: true,
    paymentSource: "recurring",
    connectionOptions: {
        "dlocal-pix": {
            scheduled_date: "2026-03-05"
        }
    }
})
```

### Connection options

* `subscription.frequency` - Recurrence interval. Supported values are `WEEKLY`, `MONTHLY`, `QUARTERLY`, `SEMI_ANNUAL`, and `ANNUAL`.
* `subscription.amount.type` - Amount model. Use `FIXED` for a fixed amount or `VARIABLE` for a variable amount.
* `subscription.amount.value` - Fixed amount in local currency. Use this when `subscription.amount.type` is `FIXED`.
* `subscription.amount.min_value` - Minimum enrollment limit in local currency. Use this when `subscription.amount.type` is `VARIABLE`.
* `subscription.start_date` - Subscription start date in `YYYY-MM-DD` format.
* `subscription.end_date` - Subscription end date in `YYYY-MM-DD` format.

For subsequent recurring charges, you can pass `connection_options.dlocal-pix.scheduled_date` in `YYYY-MM-DD` format. If you omit it, dLocal defaults to 2 days in the future.

## Sandbox testing

In production, Gr4vy passes `merchant_reference` to dLocal as the payment description.

In sandbox, Gr4vy sends `100:approved` as the payment description so dLocal can return an approved transaction.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.