Transactions

Create a transaction (charge)

Create a transaction (charge) **Conditional rules (enforced by the API; not in the JSON Schema):** - `payment.method=credit` requires `payment.card.id`. - `payment.method=billet` requires `billing.address.id`. - If `items[]` is sent, `sum(unitPrice*quantity)` must equal `amount`. - A percentage `discount.value` cannot exceed 100; `discount` and `coupon` are mutually exclusive. See the per-method examples (credit / pix / billet / creditWithCart).

POST
/v1/transactions

Create a transaction (charge)

Conditional rules (enforced by the API; not in the JSON Schema):

  • payment.method=credit requires payment.card.id.
  • payment.method=billet requires billing.address.id.
  • If items[] is sent, sum(unitPrice*quantity) must equal amount.
  • A percentage discount.value cannot exceed 100; discount and coupon are mutually exclusive. See the per-method examples (credit / pix / billet / creditWithCart).

Authorization

selectkey<token>

API key para requisições autenticadas. Envie sua chave no cabeçalho selectkey (sandbox sk_test_…, produção sk_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

curl -X POST "https://example.com/v1/transactions" \  -H "Content-Type: application/json" \  -d '{    "amount": 5000,    "payment": {      "method": "credit",      "card": {        "id": "card_0a1b2c3d4e5f60718293"      },      "installments": 1,      "capture": true    },    "customer": {      "id": "cus_0a1b2c3d4e5f60718293"    }  }'

{
  "id": "tra_0a1b2c3d4e5f60718293",
  "status": "pending",
  "method": "pix",
  "amount": 5000,
  "originalAmount": 5000,
  "currency": "BRL",
  "installments": 1,
  "capture": true,
  "discount": null,
  "items": null,
  "spplited": false,
  "splits": null,
  "refunds": null,
  "card": null,
  "pix": {
    "qrCodeEmv": "00020126…5204000053039865802BR…6304ABCD",
    "qrCodeUrl": "https://api.selectwin.io/pix/qr/tra_….png"
  },
  "billet": null,
  "acquirer": null,
  "customer": {
    "customerId": "cus_0a1b2c3d4e5f60718293"
  },
  "fees": {
    "provider": 50,
    "platform": 50,
    "total": 100
  },
  "correlationId": "cor_0a1b2c3d4e5f60718293",
  "externalReference": null,
  "approvedAt": null,
  "createdAt": "2026-01-15T12:00:00.000Z",
  "updatedAt": "2026-01-15T12:00:00.000Z",
  "merchant": {
    "name": "Acme Ltda",
    "merchantId": "bus_0a1b2c3d4e5f60718293",
    "isSubAccount": false
  },
  "_links": {
    "self": {
      "href": "https://api.selectwin.io/v1/transactions/tra_…",
      "method": "GET"
    }
  }
}

{
  "error": {
    "status": "Bad Request",
    "statusCode": 400,
    "category": "validation",
    "code": "invalidParameters",
    "message": "Validation errors occurred.",
    "resource": "server"
  }
}
{
  "error": {
    "status": "Unauthorized",
    "statusCode": 401,
    "category": "authentication",
    "code": "unauthorized",
    "message": "Authentication is required to access this resource.",
    "resource": "server"
  }
}
{
  "error": {
    "status": "Forbidden",
    "statusCode": 403,
    "category": "authorization",
    "code": "forbidden",
    "message": "You do not have permission to perform this action.",
    "resource": "server"
  }
}
{
  "error": {
    "status": "Internal Server Error",
    "statusCode": 500,
    "category": "server",
    "code": "notFound",
    "message": "An unexpected error occurred.",
    "resource": "server"
  }
}
{
  "error": {
    "status": "Conflict",
    "statusCode": 409,
    "category": "client",
    "code": "idempotencyInProgress",
    "message": "A request with this idempotency key is already being processed.",
    "resource": "server"
  }
}
{
  "error": {
    "status": "Bad Request",
    "statusCode": 400,
    "category": "validation",
    "code": "invalidParameters",
    "message": "Validation errors occurred.",
    "resource": "server"
  }
}
{
  "error": {
    "status": "Internal Server Error",
    "statusCode": 500,
    "category": "server",
    "code": "serverError",
    "message": "An unexpected error occurred. Please try again later.",
    "resource": "server",
    "details": "If the problem persists, contact support with the correlationId from the response headers."
  }
}