/transactions/:transactionId/payments.
All requests use the header
x-api-key: YOUR_SANDBOX_KEY. See Authentication for details. The sandbox base URL is https://api.sandbox.z2pay.com.Endpoints
| Method | Route | Description |
|---|---|---|
GET | /transactions/{transactionId}/payments | Lists all payments for the transaction |
GET | /transactions/{transactionId}/payments/{paymentId} | Retrieves a payment by ID |
POST | /transactions/{transactionId}/payments/process | Processes pending payments through the gateway |
POST | /transactions/{transactionId}/payments/{paymentId}/refund | Refunds a payment |
The Payment object
The fields below make up thePayment object returned by the list and retrieve endpoints. Monetary values are integers in cents (e.g., 15000 = R$ 150.00). Dates are ISO 8601 strings with timezone and are null when they have not occurred yet.
Payment identifier (prefix
pay_).ID of the transaction this payment belongs to (prefix
txn_).When the payment was replaced (status
replaced), points to the new payment that replaced it. null otherwise.ID of the company that owns the payment.
Payment amount, in cents.
Payment currency. Default:
BRL.Number of installments. Default:
1.Payment method. One of:
credit_card, boleto, pix.Internal identifier of the provider that processed the payment.
null while not yet processed.ID of the gateway configuration selected by the routing engine.
null while not yet processed.ID of the card used (prefix
card_), when applicable. null for boleto/PIX.Current status of the payment. See the list of values in Payment status.
Free-form metadata associated with the payment.
null when absent.Soft descriptor sent to the cardholder on their statement (already normalized, maximum 13 characters).
null when not set.Boleto URL (PDF/view). Populated after a boleto payment is processed.
Boleto digitable line (linha digitável).
Boleto barcode.
URL of the PIX QR Code image (for display/scanning).
PIX BR Code payload (copy-and-paste, EMV starting with
00020126...), to be pasted into the banking app.ID of the split configuration applied to the payment, if any.
Original amount before adjustments (in cents), when applicable.
Return code from the acquirer.
Return message from the acquirer.
Indicates whether a failure can be retried.
null when not applicable.Decline code, when the payment was declined.
Processing error message, when present.
Creation date (ISO 8601).
Last updated date (ISO 8601).
Date when the payment was paid.
null while not yet paid.Expiration date of the payment instrument (e.g., PIX QR Code TTL, boleto due date).
null when not applicable.Cancellation date.
null when not canceled.Refund date.
null when not refunded.Chargeback date.
null when no chargeback occurred.Date when the payment entered protest.
null when not applicable.Logical deletion date (soft delete).
null for active payments.Optimistic concurrency version of the record.
Payment status
Thestatus field takes one of the following values:
| Status | Meaning |
|---|---|
pending | Created, not yet processed |
waiting_payment | Awaiting payment (boleto/PIX issued) |
authorized | Authorized (card), not yet captured/settled |
paid | Paid |
partially_paid | Partially paid |
refused | Declined by the acquirer |
failed | Processing failure |
canceled | Canceled |
expired | Expired before completion (e.g., PIX QR Code or overdue boleto) |
replaced | Replaced by another payment |
waiting_refund | Refund requested, awaiting processing |
refunded | Fully refunded |
partially_refunded | Partially refunded |
chargeback | Chargeback registered |
in_protest | Under protest |
deleted | Logically removed |
List payments for a transaction
Transaction ID (prefix
txn_).200) wraps the list in the data field:
List of payments for the transaction. See The Payment object.
| Code | When |
|---|---|
200 | List returned |
404 | Transaction not found |
Retrieve a payment by ID
Transaction ID (prefix
txn_).Payment ID (prefix
pay_).200) is the Payment object directly (no envelope):
For boleto, use
boletoUrl, boletoDigitableLine, and boletoBarcode. For PIX, use pixUrl (QR Code) and pixCopyPaste (copy-and-paste). These fields are only populated after the payment is processed by the gateway.| Code | When |
|---|---|
200 | Payment returned |
404 | Payment not found |
Process payments
pending or waiting_payment are processed. You can restrict processing to specific payments by providing paymentIds.
This endpoint supports idempotency. Send the
Idempotency-Key header with a unique value per request to prevent duplicate processing in case of retries.Path parameters
Transaction ID (prefix
txn_).Header
Unique key to ensure request idempotency. Optional.
Request body
Customer data, required by the gateway.
Card data (required for
credit_card).Boleto data (required for
boleto).PIX data (required for
pix).Customer IP address.
Free-form metadata (key/value) for the processing.
ID of the routing configuration to use. When omitted, the company’s default routing is applied.
Restricts which gateways the routing engine may select.
Specific payment IDs to process. If omitted or empty, all payments with status
pending/waiting_payment in the transaction are processed.Response
When there are payments to process, the response (200) returns the count and the result for each processing cycle:
Number of processing cycles executed.
List of results, one per cycle.
If there are no pending payments to process, the response (
200) differs: it returns an empty results array and an informational message.| Code | When |
|---|---|
200 | Processing completed (or no pending payments) |
404 | Transaction not found |
Refund a payment
amount field.
The approval behavior depends on the company’s refund.auto_approve setting (default: true):
- With auto-approve, the refund is created, approved, and processed through the gateway immediately.
- Without auto-approve, the refund remains pending manual approval.
This endpoint supports idempotency. Send the
Idempotency-Key header to prevent duplicate refunds in case of retries.Path parameters
Transaction ID (prefix
txn_).ID of the payment to refund (prefix
pay_).Header
Unique key to ensure request idempotency. Optional.
Request body
Refund reason (1 to 4000 characters).
Amount to refund, in cents. Must be a positive integer. When omitted, the full payment amount is refunded.
Response
The response (200) is the Refund object created:
Refund ID (prefix
ref_).ID of the refunded payment (prefix
pay_).Refunded amount, in cents.
Refund status. When the refund is pending manual approval, this will be in a status prior to
refunded.Reason provided.
Failure reason, when the refund fails at the gateway.
Date when the refund was completed.
null while pending.| Code | When |
|---|---|
200 | Refund created (and processed, if auto-approve) |
404 | Payment not found |
409 | Payment is not refundable or amount exceeds the limit |
See also
Transactions
The parent resource of payments.
Refunds
Complete details about the refund resource.
Tokenizer
Generate a card token to pay with
credit_card.Simulate payments (Sandbox)
Force the outcome of a PIX/boleto in the test environment.

