Skip to main content

Create Transaction

Use this endpoint to create transactions for sales of physical or digital products.

Available Environments​

https://api.gateway.com.br/core

Endpoint​

  • Method: POST
  • Endpoint: /transaction
  • Authentication: Bearer token

Request Body​

⚠️ Important: Amounts in Cents

Every monetary amount (amount, unitPrice) must be sent in cents, as an integer.

Examples:

  • R$10.00 = 1000
  • R$99.99 = 9999
  • R$100.50 = 10050

DO NOT use: 99.99, 10.00, negative values USE: 9999, 1000 (always integers)

NameTypeRequiredDescriptionValidations
amountnumberYesTransaction amount (integer, in cents)Must be an integer in cents; minimum 1 (R$0.01) and maximum 10000000 (R$100,000.00)
paymentMethodstring (enum) - PIXYesPayment methodMust be a valid enum
webhookUrlstring (URL)NoHTTPS URL that receives notificationsMust be a valid URL, https required; no fragment (#); host and TLD required; query allowed
externalCodestringNoYour reference codeMust be between 8 and 255 characters
idempotencyKeystringYesUnique identifier that prevents duplicatesMust be between 8 and 255 characters
customerobjectNoCustomer data (see Sub-Object Customer)
sellerobjectNoSeller data (see Sub-Object Seller)
isInfoProductboolean (Default: true)NoFlag for digital or physical products
addressobjectYes (if isInfoProduct is false)Customer address (see Sub-Object Address)
itemsobject[]NoProduct list (see Sub-Object Item)
metadataobjectNoMetadata
NameTypeRequiredDescriptionValidations
pixobjectYes (if paymentMethod is PIX)PIX data (see Sub-Object Pix)

Sub-Objects​

Customer​

FieldTypeRequiredDescriptionValidations
ipstringNoIPMust be a valid IPv4 or IPv6
namestringYesNameMust be international alphanumeric
documentstringYesDocumentMust be a valid CPF or CNPJ
emailobjectNoE-mailMust be a valid email format
landlineobjectNoLandline phoneMust be a valid landline phone format
mobilePhoneobjectNoMobile phoneMust be a valid mobile phone format
birthdateobjectNoDate of birthMust be an ISO date string with no time

Seller​

FieldTypeRequiredDescriptionValidations
namestringYesNameMust be international alphanumeric
documentstringYesDocumentMust be a valid CPF or CNPJ

Address​

FieldTypeRequiredDescriptionValidations
postalCodestringYesBrazilian postal code (CEP)Must be a valid CEP format
complementstringNoAdditional informationMust be between 2 and 150 characters
numberstringYesStreet numberMust be between 1 and 10 characters, digits only
streetstringYesStreet nameMust be between 2 and 200 characters
neighborhoodstringYesNeighborhood nameMust be between 2 and 100 characters
citystringYesCity nameMust be between 2 and 100 characters
statestringYesState name or abbreviationMust be between 2 and 50 characters
countrystringYesCountry nameMust be between 2 and 60 characters

Item​

FieldTypeRequiredDescriptionValidations
titlestringYesTitleMust be between 2 and 150 characters
descriptionstringNoAdditional informationMust be between 2 and 255 characters
unitPricenumberYesItem amount (integer, in cents)Must be an integer in cents; minimum 1 (R$0.01) and maximum 10000000 (R$100,000.00)
quantitynumber (Default: 1)NoQuantity of this itemMust be an integer; minimum 1; maximum 100

Pix​

FieldTypeRequiredDescriptionValidations
expirationSecondsnumber (Default: 1800 (30 minutes))NoTime until the PIX QR Code expires, in secondsMust be an integer; minimum 60; maximum 86400

Request Example​

curl --request POST \
--url https://api.gateway.com.br/core/transaction \
--header 'Authorization: Bearer your-jwt-token' \
--header 'Content-Type: application/json' \
--data '{
"amount": 500,
"paymentMethod": "PIX",
"webhookUrl": "https://sua-api.com/webhooks/transaction",
"externalCode": "TRANSACTION-123",
"idempotencyKey": "unique-key-12345",
"customer": {
"ip": "123.123.123.123",
"name": "Customer",
"document": "123.123.123-12",
"email": "customer@gmail.com",
"landline": "(12) 12345-1234",
"mobilePhone": "(12) 12345-1234"
},
"seller": {
"name": "Seller",
"document": "123.123.123-12"
},
"isInfoProduct": false,
"address": {
"postalCode": "54753-800",
"number": "155",
"street": "Rua Santa Mariana",
"neighborhood": "São Pedro",
"city": "Camaragibe",
"state": "Pernambuco",
"country": "Brazil",
"complement": "Casa Azul"
},
"items": [
{
"title": "Fone Bluetooth PulseWave X200",
"unitPrice": 500,
"quantity": 1,
"description": "Fone de ouvido sem fio com cancelamento ativo de ruído, bateria de 30h e microfone embutido. Compatível com Android e iOS."
}
],
"metadata": {
"moeda": "BRL",
"autorizacao": "A1B2C3",
"status": "aprovada"
},
"pix": {
"expirationSeconds": 600
}
}'

Success Response​

FieldTypeRequiredDescription
idstring (UUID)YesUnique identifier of the transaction
externalCodestringNoYour reference code
amountnumberYesTransaction amount (integer, in cents)
typestring (enum) - TRANSACTIONYes
statusstring (enum) - PIX_QRCODE_GENERATEDYes
  • PIX_QRCODE_GENERATED: QR Code generated, awaiting payment
pixResponseobjectYesPIX data (see Sub-Object PixResponse)

Sub-Objects​

PixResponse​

FieldTypeRequiredDescription
uristringYesCopy-and-paste code of the QR Code
qrCodeBase64stringYesQR Code image
expirationDatestringYesQR Code expiration date

Response Example​

{
"id": "553e8400-e29b-41d4-a716-436251480000",
"externalCode": "TRANSACTION-123",
"amount": 500,
"status": "PIX_QRCODE_GENERATED",
"pixResponse": {
"uri": "00020126580014br.gov.bcb.pix0136123e4567-e89b-12d3-a456-426614174000",
"qrCodeBase64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
"expirationDate": "2026-03-06T12:49:04.681Z"
}
}

Possible Errors​

CodeDescriptionSolution
401Invalid credentialsCheck your credentials
403No permission/authorizationContact support
422Invalid or missing dataCheck the format of the data
422ValidationsContact support
429Too many requestsWait and try again
500Internal errorContact support