Developer platform

Subscriptions

Create recurring payment mandates that users explicitly approve in ForgePay hosted checkout.

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

Create a subscription checkout

Subscription creation returns a hosted checkout URL. The user must review the interval, amount and cancellation terms before approving recurring payments with ForgeCode and transaction PIN.

curlbash
curl -X POST http://localhost:3000/api/v1/subscriptions \
  -H "Authorization: Bearer fp_test_xxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: subscription_customer_42" \
  -d '{
    "amount_fgc": "99.00",
    "interval": "monthly",
    "description": "Monthly AI automation plan",
    "merchant_customer_reference": "customer_42",
    "success_url": "https://merchant.example/subscription/success",
    "cancel_url": "https://merchant.example/subscription/cancel",
    "max_total_amount_fgc": "1200.00",
    "metadata": {
      "plan": "automation_monthly"
    }
  }'
JavaScriptjavascript
const response = await fetch("http://localhost:3000/api/v1/subscriptions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer fp_test_xxxxxxxxxxxxxxxxxxxxx",
    "Content-Type": "application/json",
    "Idempotency-Key": "subscription_customer_42"
  },
  body: JSON.stringify({
    amount_fgc: "99.00",
    interval: "monthly",
    description: "Monthly AI automation plan",
    merchant_customer_reference: "customer_42",
    success_url: "https://merchant.example/subscription/success",
    cancel_url: "https://merchant.example/subscription/cancel",
    max_total_amount_fgc: "1200.00",
    metadata: { plan: "automation_monthly" }
  })
});

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

Intervals and limits

Supported intervals are `daily`, `weekly`, `monthly` and `yearly`. You can set an optional maximum total amount and optional end date to limit future charges.

User control

Users can cancel recurring authorization from their ForgePay dashboard. Merchants can also cancel subscriptions through the API.