Skip to content

Quickstart

This walks through a card payment end to end: create an intent, then commit it to capture funds. All amounts are integers in the currency’s minor units — 1000 means $10.00 for USD.

  1. Authenticate. Send your secret key as a bearer token on every request. Use a sk_test_… key while you build — see Authentication.

  2. Create a card payment intent. Card details are supplied as a client-side encrypted block. The raw card number never touches your server. See Encryption Keys for details

    Create a card payment intent
    curl https://api.paygasus.com/payments/card \
    -H "Authorization: Bearer sk_test_…" \
    -H "Content-Type: application/json" \
    -d '{
    "amount": 1000,
    "currency": "USD",
    "capture_method": "automatic",
    "description": "first intent",
    "payment_method": {
    "payload": "eyJhbGciOiJSU0Et…ENCRYPTED…",
    "key_id": "key_…",
    "layout": [{ "field": "pan", "len": 16 }],
    "brand": "VISA",
    "last4": "4242"
    }
    }'

    The response is a card payment intent in the created state:

    201 Created
    {
    "id": "pi_card_9Z3K01ARZ3NDEKTSV4RRFFQ69G5FAV",
    "status": { "status": "created" },
    "amount": 1000,
    "currency": "USD",
    "capture_method": "automatic",
    "payment_method": { "brand": "VISA", "last4": "4242" },
    "livemode": false,
    "created": 1746500000
    }

    created does not authorize the payment method. This is by design to allow a customer experience step (e.g. some kind of “You authorize the institution to charge this payment method for X amount”)

  3. Authorize to charge the payment method. Reference the intent ID. Amount is set in the initial create step.

    Authorize the intent
    curl -X POST https://api.paygasus.com/payments/card/pi_card_9Z3K01ARZ3NDEKTSV4RRFFQ69G5FAV/authorize \
    -H "Authorization: Bearer sk_test_…"

    Because we set capture_method: "automatic" in step 1, this returns as committed. A committed intent comes back with status.status = "committed". You’ve taken your first payment.

    If the card declines, you still get a 200, the intent comes back in failed with a reason. Declines are outcomes, not errors. See Test mode to simulate one.

  • Browse the full, always-current API reference for every field.
    • Learn the error envelope so your integration handles declines and retries.