SelectwinDOCS
Transactions

Transactions - Create

Cria uma nova cobrança (cartão, Pix, boleto, etc.). O corpo segue o contrato `transaction.create` com meio de pagamento e valores em centavos.

POST
/v1/transactions

Cria uma nova cobrança (cartão, Pix, boleto, etc.). O corpo segue o contrato transaction.create com meio de pagamento e valores em centavos.

Authorization

SelectKeyAuth
selectkey<token>

API key for all authenticated requests. Send your key in the selectkey header (e.g. sandbox sl_test_…, production sl_live_…).

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/transactions" \  -H "Content-Type: application/json" \  -d '{    "payment": {      "card": {        "holderName": "JOAO SILVA",        "expirationMonth": 12,        "expirationYear": 2028,        "numbering": "4111111111111111",        "securityCode": "123",        "id": "card_abc123"      },      "pix": {        "expiresInMinutes": 30      },      "billet": {        "instructions": "Texto de exemplo",        "expirationDate": "2026-04-15",        "paymentLimitDate": "2026-04-15T23:59:59Z",        "expiresInDays": 3      },      "currency": "BRL",      "method": "credit",      "capture": true,      "installments": 3    },    "geolocation": {      "ipAddress": "189.44.12.1",      "longitude": -46.63,      "latitude": -23.55,      "deviceFingerprint": "fp_5f9c2a7b3e4d8b1a",      "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15",      "acceptLanguage": "pt-BR,pt;q=0.9,en;q=0.8"    },    "shipping": {      "address": {        "postcode": "01310-100",        "country": "BR",        "state": "SP",        "city": "São Paulo",        "district": "Centro",        "complement": "Apt 42",        "number": "1000",        "street": "Av. Paulista",        "id": "addr_abc123"      },      "customerCost": "1500",      "internalCost": "1200",      "description": "Leave at concierge",      "recipientName": "Maria Souza",      "recipientDocument": "12345678901",      "recipientPhone": "5511999999999",      "trackingCode": "BR123456789BR",      "deliveryStatus": "in_transit",      "deliveryTimeWindow24h": "9h/18h",      "packageWeight": "1.2kg",      "packageDimensions": "30x20x10cm",      "instructions": "Ring doorbell twice",      "geolocationLatitude": -23.55,      "geolocationLongitude": -46.63,      "insurance": false,      "method": "pac",      "trackingSiteUrl": "https://example.com",      "recipientDocumentType": "cpf",      "deliveryDate": "2026-04-15"    },    "callback": {      "webhookUrl": "https://api.example.com/webhooks/transaction"    },    "discount": {      "type": "flat",      "value": 500,      "id": "dis_abc123"    },    "customer": {      "document": {        "type": "cpf",        "number": "12345678901"      },      "telephone": {        "countryCode": "55",        "areaCode": "11",        "number": "999999999"      },      "firstName": "João",      "lastName": "Silva",      "email": "[email protected]",      "externalReference": "CRM-USER-001",      "gender": "male",      "birthdate": "1990-01-15",      "additionalEmails": [        "[email protected]"      ],      "metadata": {        "crmId": "lead-42"      },      "id": "cus_abc123"    },    "billing": {      "address": {        "street": "Av. Paulista",        "number": "1000",        "complement": "Apt 42",        "district": "Bela Vista",        "city": "São Paulo",        "state": "SP",        "country": "BR",        "postcode": "01310-100",        "id": "addr_abc123"      }    },    "items": [      {        "id": "var_abc123",        "name": "Premium plan",        "description": "Assinatura mensal",        "pricing": {          "unitPrice": 9900,          "quantity": 1,          "currency": "BRL"        },        "isOrderbump": false,        "isUpsell": false,        "images": [          "https://cdn.example.com/product.png"        ],        "metadata": {          "sku": "SKU-1",          "brand": "Acme"        },        "externalReference": "line-1"      }    ],    "description": "Order #1001 — store checkout",    "metadata": {      "source": "mobile_app",      "campaign": "spring"    },    "tags": [      "vip",      "recurring"    ],    "splits": [      {        "recipient": "acc_abc",        "type": "percentage",        "value": 10      }    ],    "amount": 5000,    "externalReference": "ORDER-1001",    "discounts": [      {        "id": "dis_abc123"      },      {        "type": "flat",        "value": 500      }    ],    "primary": true  }'
{
  "id": "tra_01hqzvabc",
  "customId": "PEDIDO-1042",
  "amount": 5000,
  "originalAmount": 5000,
  "status": "pending",
  "method": "pix",
  "currency": "BRL",
  "payment": {
    "provider": "selectwin",
    "version": "1.1",
    "refused": null,
    "reusable": false,
    "billetUrl": null,
    "billetBarcode": null,
    "billetSequence": null,
    "billetDocumentNumber": null,
    "billetReferenceNumber": null,
    "pixQrCodeEmv": "00020126580014br.gov.bcb.pix0136a1b2c3d4-5678-90ab-cdef-1234567890ab5204000053039865802BR5913Seller Name6009Sao Paulo62070503***6304ABCD",
    "pixQrCodeUrl": "https://api.selectwin.io/pix/qr/tra_01hqzvabc.png",
    "pixQrCodeImage": null,
    "acquirerTransactionNumber": null,
    "cardFirstDigits": null,
    "cardLastDigits": null,
    "cardBrand": null,
    "cardRegistered": false,
    "installments": null,
    "expirationDate": "2026-04-12T18:26:33.000Z",
    "paidAt": null,
    "allowRenewPayment": true,
    "invoiceLink": "https://selectwin.io/invoices/tra_01hqzvabc"
  },
  "discount": null,
  "customer": {
    "id": "cus_01hqzvabc",
    "firstName": "João",
    "lastName": "Silva",
    "email": "[email protected]",
    "birthdate": "1990-01-15",
    "gender": "male",
    "document": {
      "type": "cpf",
      "number": "12345678901"
    },
    "telephone": {
      "countryCode": "55",
      "areaCode": "11",
      "number": "999999999",
      "line": "5511999999999"
    },
    "available": true,
    "delinquent": false,
    "externalReference": "CRM-USER-001",
    "additionalEmails": null,
    "metadata": {},
    "updatedAt": "2026-04-12T17:56:33.000Z",
    "createdAt": "2026-04-12T17:56:33.000Z"
  },
  "billing": {
    "address": {
      "id": "addr_01hqzvabc",
      "ownerId": "cus_01hqzvabc",
      "ownerType": "customer",
      "street": "Av. Paulista",
      "number": "1000",
      "complement": "Apt 42",
      "district": "Bela Vista",
      "city": "São Paulo",
      "state": "SP",
      "postcode": "01310-100",
      "country": "BR",
      "latitude": -23.5613,
      "longitude": -46.6558,
      "line": "Av. Paulista, 1000 - Apt 42 - Bela Vista, São Paulo - SP, 01310-100",
      "line1": "Av. Paulista, 1000",
      "line2": "Apt 42",
      "line3": "Bela Vista",
      "updatedAt": "2026-04-12T17:56:33.000Z",
      "createdAt": "2026-04-12T17:56:33.000Z"
    }
  },
  "shipping": null,
  "externalReference": "ORDER-1001",
  "shippable": false,
  "spplited": false,
  "items": [
    {
      "id": "item_01hqzvabc",
      "name": "Premium Plan",
      "unitPrice": 5000,
      "quantity": 1,
      "currency": "BRL",
      "description": "Assinatura mensal",
      "images": [
        "https://cdn.example.com/product.png"
      ],
      "isUpsell": false,
      "isOrderbump": false,
      "metadata": {
        "sku": "SKU-1"
      },
      "variantId": "var_01hqzvabc",
      "externalReference": "line-1",
      "updatedAt": "2026-04-12T17:56:33.000Z",
      "createdAt": "2026-04-12T17:56:33.000Z"
    }
  ],
  "receivables": null,
  "splits": null,
  "refunds": null,
  "disputes": null,
  "timeline": [
    {
      "id": "tml_01hqzvabc",
      "message": "Transaction created",
      "details": null,
      "type": "status",
      "updatedAt": "2026-04-12T17:56:33.000Z",
      "createdAt": "2026-04-12T17:56:33.000Z"
    }
  ],
  "callback": {
    "webhookUrl": "https://api.example.com/webhooks/transaction",
    "active": true
  },
  "metadata": {},
  "updatedAt": "2026-04-12T17:56:33.000Z",
  "createdAt": "2026-04-12T17:56:33.000Z",
  "merchant": {
    "name": "Seller Name",
    "merchantId": "bus_1234567890",
    "isSubAccount": false
  },
  "_links": {
    "self": {
      "href": "https://api.selectwin.io/v1/transactions",
      "method": "POST",
      "description": "Create a new transaction."
    },
    "read": {
      "href": "https://api.selectwin.io/v1/transactions/tra_01hqzvabc",
      "method": "GET",
      "description": "Read a transaction."
    },
    "dispute": {
      "href": "https://api.selectwin.io/v1/transactions/tra_01hqzvabc",
      "method": "PUT",
      "description": "Dispute the transaction."
    },
    "refund": {
      "href": "https://api.selectwin.io/v1/transactions/tra_01hqzvabc/refund",
      "method": "POST",
      "description": "Refund the transaction."
    },
    "capture": {
      "href": "https://api.selectwin.io/v1/transactions/tra_01hqzvabc/capture",
      "method": "POST",
      "description": "Capture the transaction."
    },
    "list": {
      "href": "https://api.selectwin.io/v1/transactions",
      "method": "GET",
      "description": "List all transactions."
    }
  }
}
{
  "error": {
    "status": "Bad Request",
    "statusCode": 400,
    "category": "validation",
    "message": "Validation errors occurred",
    "details": "One or more parameters are invalid or out of range. Please check the parameters and try again.",
    "params": [
      {
        "payment[currency]": "currency must be one of [BRL]"
      },
      {
        "amount": "amount is required"
      }
    ],
    "code": "invalidParameters",
    "resource": "client"
  }
}
{
  "error": {
    "status": "Unauthorized",
    "statusCode": 401,
    "category": "authentication",
    "message": "Unauthorized",
    "details": "Authentication failed. The provided API key is invalid or does not have permission to operate.",
    "code": "unauthorized"
  }
}
{
  "error": {
    "status": "Request Failed",
    "statusCode": 402,
    "category": "payment",
    "code": "insufficientFundsError",
    "type": "cardError",
    "message": "The request was valid, but the payment process failed.",
    "details": "Please verify your payment information and try again.",
    "params": [
      {
        "payment": "Saldo insuficiente para realizar esta compra. Verifique seu limite disponível."
      }
    ],
    "displayMessage": "Saldo insuficiente para realizar esta compra. Verifique seu limite disponível.",
    "reversible": false
  }
}
{
  "error": {
    "status": "Forbidden",
    "statusCode": 403,
    "category": "authorization",
    "message": "Forbidden",
    "details": "Access denied. This may be due to IP blocks, domain restrictions, or insufficient permissions.",
    "code": "forbidden"
  }
}
{
  "error": {
    "status": "Not Found",
    "statusCode": 404,
    "category": "client",
    "message": "Not Found",
    "details": "The requested resource was not found on the server.",
    "code": "notFound"
  }
}
{
  "error": {
    "status": "Unprocessable Entity",
    "statusCode": 422,
    "category": "validation",
    "message": "Unprocessable Entity",
    "details": "The request was understood, but contains invalid data that could not be processed.",
    "code": "unprocessableEntity"
  }
}
{
  "error": {
    "status": "Too Many Requests",
    "statusCode": 429,
    "category": "rate_limit",
    "message": "Too Many Requests",
    "details": "The number of requests exceeded the limit allowed for the IP or user.",
    "retryAfterMinutes": 60,
    "code": "tooManyRequests"
  }
}
{
  "error": {
    "status": "Internal Server Error",
    "statusCode": 500,
    "category": "server",
    "message": "Server error.",
    "details": "An internal server error occurred. Please try again later.",
    "code": "serverError",
    "resource": "server"
  }
}