Subscription membership

Sell a fixed monthly plan that activates when the transfer verifies.

AGENTS.md

1. Fixed subscription product

product_type: "subscription", pricing_model: "fixed", set amount_etb and interval (e.g. month). Do not send amount_etb on checkout create for fixed products.

2. Create checkout

ts
await fetch("https://verifyitet.duckdns.org/api/v1/checkouts/", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.PAYPROOF_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    app_id: Number(process.env.PAYPROOF_APP_ID),
    product_id: Number(process.env.PAYPROOF_SUBSCRIPTION_PRODUCT_ID),
    customer_ref: userId,
    customer_email: email,
    success_url: `${siteUrl}/membership?ok=1`,
  }),
});

3. Activate on webhook

Listen for subscription.activated (and subscription.renewed / subscription.ended). Store subscription_id and period end from the payload.

4. Gate access

bash
GET https://verifyitet.duckdns.org/api/v1/subscriptions/{id}/status/
→ { "status": "active", "ok": true, "current_period_end": "..." }