API Reference

Checkout API

Complete API reference for the Hosted Checkout integration.

Endpoints

POST/api/v1/checkout

Create checkout session

GET/api/v1/checkout/{session_id}

Get session details

POST/api/v1/checkout/process

Process payment for session

POST/api/v1/checkout/{session_id}/cancel

Cancel checkout session

Create Checkout Session

POST/api/v1/checkout

Creates a new checkout session and returns a URL for the hosted checkout page.

Headers

HeaderRequiredDescription
X-API-KeyYesYour API key
Content-TypeYesapplication/json

Request Body

FieldTypeRequiredDescription
merchant_idstringYesYour merchant identifier
amountnumberYesPayment amount (must be greater than 0)
currencystringYesISO 4217 currency code (BRL, PEN, COP, CLP, MXN, USD, ARS)
countrystringYesISO 3166-1 alpha-3 country code (BRA, PER, COL, CHL, MEX, ECU, ARG)
success_urlstringYesURL to redirect after successful payment
cancel_urlstringYesURL to redirect if customer cancels
notification_urlstringNoWebhook URL for payment notifications
descriptionstringNoDescription shown to customer
expires_in_minutesnumberNoSession expiration in minutes (default: 30, min: 5, max: 1440)
customerobjectNoPre-fill customer data (see below)
metadataobjectNoCustom key-value pairs returned in webhooks

Customer Object (Optional)

Pre-fill customer information on the checkout page:

FieldTypeDescription
namestringCustomer full name
emailstringCustomer email address
documentstringCustomer document number
phonestringCustomer phone number

Example Request

create-session.sh
curl -X POST "https://cashier.flowpayment.net/api/v1/checkout" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: sk_live_your_api_key" \
  -d '{
    "amount": 150.00,
    "currency": "BRL",
    "country": "BRA",
    "description": "Order #12345",
    "success_url": "https://your-site.com/success",
    "cancel_url": "https://your-site.com/cancel",
    "notification_url": "https://your-site.com/webhooks",
    "customer": {
      "name": "Joao Silva",
      "email": "joao@example.com"
    },
    "metadata": {
      "order_id": "12345"
    }
  }'

Note

The merchant_id is automatically set from your API key. You don't need to include it in the request body.

Success Response (200)

success-response.json
{
  "success": true,
  "session_id": "cs_abc123xyz",
  "checkout_url": "https://cashier-checkout.s-interio.com/checkout/cs_abc123xyz",
  "expires_at": "2026-01-04T13:00:00Z"
}

Error Response (4xx)

error-response.json
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "amount must be greater than 0"
  }
}

Get Checkout Session

GET/api/v1/checkout/{session_id}

Retrieves details of an existing checkout session.

Example Request

bash
curl -X GET "https://cashier.flowpayment.net/api/v1/checkout/cs_abc123xyz"

Success Response

session-details.json
{
  "id": "cs_abc123xyz",
  "merchant_id": "your_merchant_id",
  "merchant_name": "Your Store Name",
  "amount": 150.00,
  "currency": "BRL",
  "country": "BRA",
  "description": "Order #12345",
  "customer": {
    "name": "Joao Silva",
    "email": "joao@example.com"
  },
  "available_methods": [
    {
      "id": "pix",
      "type": "pix",
      "name": "PIX",
      "provider": "sfp",
      "method_code": "s-interio-mt-1",
      "enabled": true,
      "flow_type": "embedded",
      "required_fields": [
        { "field": "document", "type": "cpf", "label": "CPF", "required": true }
      ]
    },
    {
      "id": "card",
      "type": "card",
      "name": "Credit Card",
      "provider": "izipay",
      "method_code": "s-interio-mt-2",
      "enabled": true,
      "flow_type": "redirect"
    }
  ],
  "success_url": "https://your-site.com/success",
  "cancel_url": "https://your-site.com/cancel",
  "status": "pending",
  "expires_at": "2026-01-04T13:00:00Z",
  "created_at": "2026-01-04T12:00:00Z"
}

Process Payment

POST/api/v1/checkout/process

Process payment for a checkout session.

Internal Endpoint

This endpoint is used internally by the hosted checkout page. You typically don't need to call it directly - redirect customers to the checkout_url returned when creating a session.

Request Body

FieldTypeRequiredDescription
session_idstringYesCheckout session ID (cs_xxx)
method_codestringYes*Payment method code (e.g., "s-interio-mt-1")
customerobjectYesCustomer information (name, email, document)
cardobjectNoCard details (required for card payments)

* Either method_code OR both provider + payment_method required

Card Object (for card payments)

FieldTypeDescription
numberstringCard number (13-19 digits)
holder_namestringCardholder name
expiry_monthstringExpiration month (MM)
expiry_yearstringExpiration year (YYYY)
cvvstringSecurity code (3-4 digits)

Example Request (PIX)

process-pix.sh
curl -X POST "https://cashier.flowpayment.net/api/v1/checkout/process" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "cs_abc123xyz",
    "method_code": "s-interio-mt-1",
    "customer": {
      "name": "Joao Silva",
      "email": "joao@example.com",
      "document": "12345678909"
    }
  }'

Success Response (PIX)

pix-response.json
{
  "success": true,
  "payment_id": "pi_xyz789abc",
  "status": "pending",
  "pix_code": "00020126360014br.gov.bcb.pix...",
  "pix_qr_code": "https://api.provider.com/qr/abc123.png"
}

Success Response (Card with 3DS redirect)

card-response.json
{
  "success": true,
  "payment_id": "pi_xyz789abc",
  "status": "processing",
  "redirect_url": "https://3ds.provider.com/auth/abc123"
}

Error Response

error.json
{
  "success": false,
  "status": "failed",
  "error_message": "Card declined by issuer"
}

Cancel Checkout Session

POST/api/v1/checkout/{session_id}/cancel

Cancels a pending checkout session. Cannot cancel completed sessions.

Example Request

bash
curl -X POST "https://cashier.flowpayment.net/api/v1/checkout/cs_abc123xyz/cancel"

Success Response

json
{
  "success": true,
  "message": "Checkout session cancelled"
}

Session Status

pending

Session created, awaiting customer

processing

Payment is being processed

completed

Payment successful

failed

Payment failed

expired

Session expired before completion

cancelled

Session was cancelled

Error Codes

CodeHTTPDescription
UNAUTHORIZED401Invalid or missing API key
VALIDATION_ERROR400Invalid request parameters
MERCHANT_NOT_FOUND404Merchant ID not found
MERCHANT_INACTIVE403Merchant account is inactive
SESSION_NOT_FOUND404Checkout session not found
SESSION_EXPIRED410Checkout session has expired
COUNTRY_NOT_SUPPORTED400Country not available for this merchant
RATE_LIMIT_EXCEEDED429Too many requests

Idempotency

To prevent duplicate checkouts, include an X-Idempotency-Key header:

bash
curl -X POST "https://cashier.flowpayment.net/api/v1/checkout" \
  -H "X-API-Key: your_api_key" \
  -H "X-Idempotency-Key: unique_request_id_12345" \
  -d '{ ... }'

If you send the same idempotency key within 24 hours, you'll receive the same response without creating a new session.

Rate Limits

EndpointLimit
POST /api/v1/checkout100 requests/minute
GET /api/v1/checkout/{id}300 requests/minute

Testing

Use sandbox mode for testing by including environment: "sandbox" in your request.

Sandbox Mode

No real charges are made. Use test credentials provided in your dashboard.