Paygate Docs

Quickstart

Process your first payment with Paygate in under five minutes.

Overview

Paygate is a unified payment gateway API that abstracts Stripe (Visa, Mastercard, Apple Pay) and Checkout.com (Mada) behind a single interface. Every endpoint lives under /v1 and uses Bearer token authentication.

Base URL: https://paygate-api.fly.dev

1. Register a merchant account

curl -X POST https://paygate-api.fly.dev/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Corp",
    "email": "acme@example.com",
    "password": "supersecret"
  }'
{
  "merchant": { "id": "...", "name": "Acme Corp", "email": "acme@example.com" },
  "token": "eyJhbGciOiJIUzI1NiJ9..."
}

Save the token — it's a JWT valid for 24 hours and usable as a Bearer token.

2. Generate API keys

JWT tokens are for the dashboard. For programmatic access, generate a dedicated key pair:

curl -X POST https://paygate-api.fly.dev/v1/me/api_keys \
  -H "Authorization: Bearer <jwt_token>"
{
  "public_key": "pk_test_...",
  "secret_key": "sk_test_...",
  "api_key": { "id": "...", "environment": "sandbox", ... }
}

The secret_key is shown once at creation. Store it securely — it cannot be retrieved later.

3. Create a charge

Tokenize the card client-side (Stripe.js or Checkout.com Frames), then send the token to Paygate:

curl -X POST https://paygate-api.fly.dev/v1/charges \
  -H "Authorization: Bearer sk_test_..." \
  -H "Idempotency-Key: order-9f3a1b" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 5000,
    "currency": "SAR",
    "payment_method": "card",
    "token": "tok_visa",
    "metadata": { "order_id": "1042" }
  }'
{
  "id": "ch_01HXYZ...",
  "status": "captured",
  "amount": 5000,
  "currency": "SAR",
  "payment_method": "card",
  "provider": "stripe",
  "created_at": "2024-01-15T10:30:00Z"
}

4. Check the status

curl https://paygate-api.fly.dev/v1/charges/ch_01HXYZ... \
  -H "Authorization: Bearer sk_test_..."

That's it. For a full walkthrough of refunds, webhooks, and idempotency, continue through the guides below.

On this page