Developer platform

Quickstart

Create a test API key, call the checkout API and redirect your customer to ForgePay hosted checkout.

ForgePay is not a bank. ForgeCredit is an internal settlement unit for services available in the ForgePay ecosystem.

1. Create an API key

Sign in to ForgePay, open Dashboard > Merchant API and create a test API key. The raw key is shown once, so store it immediately in a server-side secret manager or local `.env` file.

  • Use the `fp_test_` key prefix for development.
  • Do not expose API keys in browser JavaScript.
  • Create separate keys for local development, staging and production.

2. Create a checkout session

Your server creates a one-time checkout session and receives a `checkout_url`. Redirect the user to that URL so ForgePay can collect ForgeCode and the transaction PIN inside the hosted page.

curlbash
curl -X POST http://localhost:3000/api/v1/checkout/sessions \
  -H "Authorization: Bearer fp_test_xxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order_1001" \
  -d '{
    "amount_fgc": "250.00",
    "currency": "FGC",
    "description": "AI writing package",
    "success_url": "https://merchant.example/success",
    "cancel_url": "https://merchant.example/cancel",
    "customer_reference": "customer_42",
    "metadata": {
      "order_id": "1001"
    }
  }'
JavaScriptjavascript
const response = await fetch("http://localhost:3000/api/v1/checkout/sessions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer fp_test_xxxxxxxxxxxxxxxxxxxxx",
    "Content-Type": "application/json",
    "Idempotency-Key": "order_1001"
  },
  body: JSON.stringify({
    amount_fgc: "250.00",
    currency: "FGC",
    description: "AI writing package",
    success_url: "https://merchant.example/success",
    cancel_url: "https://merchant.example/cancel",
    customer_reference: "customer_42",
    metadata: { order_id: "1001" }
  })
});

const checkoutSession = await response.json();
console.log(checkoutSession.checkout_url);

3. Listen for webhooks

After the user confirms payment, ForgePay sends a signed webhook such as `checkout.session.paid`. Your server should verify the signature, update the order and keep the webhook idempotent.