Documentation

Hosted Checkout

Create checkout sessions and redirect customers securely.

Hosted Checkout lets you send customers to a Stafiel-branded payment experience. You control the amount, currency, and redirect URLs, while Stafiel handles wallet selection and payment monitoring.

Create a checkout session

Use your API key to create a session and receive a checkout URL.

curl -X POST https://api.stafiel.com/v1/checkout/session \
  -H "Authorization: Bearer $STAFIEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1999,
    "currency": "USD",
    "order_id": "ORDER_1402",
    "success_url": "https://merchant.example/checkout/success",
    "cancel_url": "https://merchant.example/checkout/cancel"
  }'

Session response

The response includes the session ID and a URL to redirect the customer.

{
  "id": "cs_01H9Y5A0D3",
  "status": "created",
  "checkout_url": "https://checkout.stafiel.com/session/cs_01H9Y5A0D3"
}

Redirect flow

  • Redirect the customer to checkout_url.
  • Listen for the webhook event when the payment is confirmed.
  • Send the customer to the success_url or cancel_url.

Testing in sandbox

Use sandbox API keys for testing. Sandbox sessions behave like production sessions but do not move funds.