> This page is for BaaS.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://en.docs.api.corpx.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://en.docs.api.corpx.com/_mcp/server.

# Pay a boleto

POST https://tenant.api.corpx.com/v1/accounts/{accountId}/boleto/pay
Content-Type: application/json

Initiates payment of a boleto, utility bill, or tax.

`amount` is required and must be the amount the settlement bank expects
**today** — the `totalUpdated` from `POST /boleto/preview`, not the face
value in the barcode. Sending the face value for an overdue slip fails with
`boleto_amount_mismatch` (422), and the error message carries the amount the
settlement bank expects. Because interest accrues daily, run the preview on
the same day you pay.

Returns a canonical `paymentId` (`bol_` + UUID). **This is the single id to
keep**: it is echoed by the status endpoint and arrives as `transactionId`
(and `paymentId`) in the `boleto.paid` / `boleto.failed` webhooks. The legacy
`boletoId` field carries the same value.
Requires feature flag `boleto_payment` to be enabled for the tenant.


Reference: https://en.docs.api.corpx.com/baas/referencia/boleto-pay/pay-boleto

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `accountId` (string, required) — Account identifier.

### Headers

- `X-Acting-Document` (string, optional) — CPF of the human performing the operation. Required on cashout routes when the credential enforces a transaction PIN. On a company P2P profile contact, this CPF is the holder who signs; it is not taken from the body.
- `X-Transaction-Pin` (string, optional) — Transaction PIN of the operator in `X-Acting-Document`. Required on cashout routes when the credential enforces a PIN (`428 pin_required`).
- `X-Acting-Ip` (string, optional) — Real IP of the end user, for integrator credentials calling on their behalf. This is the IP evaluated against `cashoutSourceIps` — without it the check would see your server's IP. Ignored for delegated credentials, where the connection IP is already the right one.
- `X-Acting-User-Agent` (string, optional) — Optional user-agent of the end user's browser or app, for integrator credentials calling on their behalf. Feeds risk analysis only: an invalid or oversized value is dropped and the payment still proceeds. Ignored for delegated credentials.
- `X-Acting-Device-Id` (string, optional) — Optional device fingerprint or identifier from the integrator's own system. Risk analysis only; never required and never a reason to reject the payment. Ignored for delegated credentials.
- `X-Acting-Session-Id` (string, optional) — Optional session id of the end user in the integrator's system. Risk analysis only; never required and never a reason to reject the payment. Ignored for delegated credentials.
- `X-Acting-Geo` (string, optional) — Optional `latitude,longitude` in decimal degrees. Out of range or malformed values are dropped. Risk analysis only. Ignored for delegated credentials.
- `X-Tenant-Id` (string, required) — Tenant context used for authorization and routing.
- `Idempotency-Key` (string, optional) — Optional client-generated idempotency token (recommended for safe retries).

### Body (application/json)

This endpoint expects an object.

- `barcode` (string, required) — Barcode or linha digitável (alias of `line`)
- `amount` (double, required) — Amount to pay, greater than zero. Use `totalUpdated` from the preview.
- `line` (string, optional) — Linha digitável — canonical field; `barcode` is the alias
- `taxId` (string, optional) — Payer's CPF/CNPJ
- `scheduled` (date, optional) — Schedule date, when supported by the settlement bank
- `description` (string, optional) — Optional payment description

## Response

### 202

Payment accepted (asynchronous). The endpoint returns immediately — it does **not** block waiting for settlement. Poll the status endpoint with `paymentId` (see the `Location` header), or wait for the `boleto.paid` / `boleto.failed` webhook. Idempotency: send an `Idempotency-Key` header. Retries with the same key return the same `paymentId` and reuse the same run (no duplicate debit).

- `paymentId` (string, optional) — Canonical payment id (`bol_` + UUID). Same value as `boletoId` and as `transactionId` in webhooks.
- `boletoId` (string, optional) — Deprecated alias of `paymentId` (same value).
- `workflowId` (string, optional)
- `runId` (string, optional) — Run id of the payment workflow.
- `idempotencyKey` (string, optional)
- `amount` (double, optional)
- `status` (enum, optional) — Always `PROCESSING` at acceptance. Terminal state (`COMPLETED`/`FAILED`) is delivered via webhook and the status endpoint.
  - Allowed values: `PROCESSING`, `COMPLETED`, `FAILED`

## Errors

### 400 Bad Request Error

Invalid request sent by client.

- `errorCode` (string, required) — Stable machine-readable code. See `ErrorCode` for the known values.
- `message` (string, required) — Human-readable explanation (pt-BR). Presentation only; may change.
- `docs` (string, optional) — Link to this code in the public error catalogue.
- `requestId` (string, optional) — Gateway request id. Quote it when contacting support.
- `details` (map from string to any, optional) — Optional machine-readable context for the specific `errorCode` (for example `kind` on `identity_verification_monthly_limit_exceeded`, `maxBytes` on `payload_too_large`, `attemptsRemaining` on `facetec_attempts_exhausted`). Keys are documented per operation; absent when the code carries no extra context.
- `partner` (ErrorResponsePartner, optional) — Raw error from the settlement bank, when the failure came from it. Diagnostic only.

### 403 Forbidden Error

Feature not enabled or insufficient permissions

- `any`

### 502 Bad Gateway Error

Payment provider error

- `any`

## Types

### ErrorResponsePartner

Raw error from the settlement bank, when the failure came from it. Diagnostic only.

- `code` (string, optional)
- `message` (string, optional)
- `field` (string, optional) — Field the partner pointed at, when any.

## Examples

**Request**

```json
{
  "barcode": "23793381286000782713695000063305975520000015075",
  "amount": 1462.53,
  "line": "Rua Exemplo, 100",
  "taxId": "8c1f6a2e-4d3b-4b9a-9f0e-1a2b3c4d5e6f",
  "scheduled": "2026-02-20",
  "description": "Pagamento pedido #12345"
}
```

**Response**

```json
{
  "paymentId": "bol_7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "boletoId": "bol_7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "workflowId": "boleto-{accountId}-{idempotencyKey}",
  "runId": "8c1f6a2e-4d3b-4b9a-9f0e-1a2b3c4d5e6f",
  "idempotencyKey": "9a5f8c2e-1b3d-4e6f-8a7b-0c1d2e3f4a5b",
  "amount": 150.75,
  "status": "PROCESSING"
}
```

**SDK Code**

```python Boleto Pay_payBoleto_example
import requests

url = "https://tenant.api.corpx.com/v1/accounts/accountId/boleto/pay"

payload = {
    "barcode": "23793381286000782713695000063305975520000015075",
    "amount": 1462.53,
    "line": "Rua Exemplo, 100",
    "taxId": "8c1f6a2e-4d3b-4b9a-9f0e-1a2b3c4d5e6f",
    "scheduled": "2026-02-20",
    "description": "Pagamento pedido #12345"
}
headers = {
    "X-Acting-Geo": "-22.9068,-43.1729",
    "X-Tenant-Id": "X-Tenant-Id",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Boleto Pay_payBoleto_example
const url = 'https://tenant.api.corpx.com/v1/accounts/accountId/boleto/pay';
const options = {
  method: 'POST',
  headers: {
    'X-Acting-Geo': '-22.9068,-43.1729',
    'X-Tenant-Id': 'X-Tenant-Id',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"barcode":"23793381286000782713695000063305975520000015075","amount":1462.53,"line":"Rua Exemplo, 100","taxId":"8c1f6a2e-4d3b-4b9a-9f0e-1a2b3c4d5e6f","scheduled":"2026-02-20","description":"Pagamento pedido #12345"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Boleto Pay_payBoleto_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://tenant.api.corpx.com/v1/accounts/accountId/boleto/pay"

	payload := strings.NewReader("{\n  \"barcode\": \"23793381286000782713695000063305975520000015075\",\n  \"amount\": 1462.53,\n  \"line\": \"Rua Exemplo, 100\",\n  \"taxId\": \"8c1f6a2e-4d3b-4b9a-9f0e-1a2b3c4d5e6f\",\n  \"scheduled\": \"2026-02-20\",\n  \"description\": \"Pagamento pedido #12345\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-Acting-Geo", "-22.9068,-43.1729")
	req.Header.Add("X-Tenant-Id", "X-Tenant-Id")
	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Boleto Pay_payBoleto_example
require 'uri'
require 'net/http'

url = URI("https://tenant.api.corpx.com/v1/accounts/accountId/boleto/pay")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-Acting-Geo"] = '-22.9068,-43.1729'
request["X-Tenant-Id"] = 'X-Tenant-Id'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"barcode\": \"23793381286000782713695000063305975520000015075\",\n  \"amount\": 1462.53,\n  \"line\": \"Rua Exemplo, 100\",\n  \"taxId\": \"8c1f6a2e-4d3b-4b9a-9f0e-1a2b3c4d5e6f\",\n  \"scheduled\": \"2026-02-20\",\n  \"description\": \"Pagamento pedido #12345\"\n}"

response = http.request(request)
puts response.read_body
```

```java Boleto Pay_payBoleto_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://tenant.api.corpx.com/v1/accounts/accountId/boleto/pay")
  .header("X-Acting-Geo", "-22.9068,-43.1729")
  .header("X-Tenant-Id", "X-Tenant-Id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"barcode\": \"23793381286000782713695000063305975520000015075\",\n  \"amount\": 1462.53,\n  \"line\": \"Rua Exemplo, 100\",\n  \"taxId\": \"8c1f6a2e-4d3b-4b9a-9f0e-1a2b3c4d5e6f\",\n  \"scheduled\": \"2026-02-20\",\n  \"description\": \"Pagamento pedido #12345\"\n}")
  .asString();
```

```php Boleto Pay_payBoleto_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://tenant.api.corpx.com/v1/accounts/accountId/boleto/pay', [
  'body' => '{
  "barcode": "23793381286000782713695000063305975520000015075",
  "amount": 1462.53,
  "line": "Rua Exemplo, 100",
  "taxId": "8c1f6a2e-4d3b-4b9a-9f0e-1a2b3c4d5e6f",
  "scheduled": "2026-02-20",
  "description": "Pagamento pedido #12345"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'X-Acting-Geo' => '-22.9068,-43.1729',
    'X-Tenant-Id' => 'X-Tenant-Id',
  ],
]);

echo $response->getBody();
```

```csharp Boleto Pay_payBoleto_example
using RestSharp;

var client = new RestClient("https://tenant.api.corpx.com/v1/accounts/accountId/boleto/pay");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Acting-Geo", "-22.9068,-43.1729");
request.AddHeader("X-Tenant-Id", "X-Tenant-Id");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"barcode\": \"23793381286000782713695000063305975520000015075\",\n  \"amount\": 1462.53,\n  \"line\": \"Rua Exemplo, 100\",\n  \"taxId\": \"8c1f6a2e-4d3b-4b9a-9f0e-1a2b3c4d5e6f\",\n  \"scheduled\": \"2026-02-20\",\n  \"description\": \"Pagamento pedido #12345\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Boleto Pay_payBoleto_example
import Foundation

let headers = [
  "X-Acting-Geo": "-22.9068,-43.1729",
  "X-Tenant-Id": "X-Tenant-Id",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "barcode": "23793381286000782713695000063305975520000015075",
  "amount": 1462.53,
  "line": "Rua Exemplo, 100",
  "taxId": "8c1f6a2e-4d3b-4b9a-9f0e-1a2b3c4d5e6f",
  "scheduled": "2026-02-20",
  "description": "Pagamento pedido #12345"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://tenant.api.corpx.com/v1/accounts/accountId/boleto/pay")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```