Corteksa
GuidesBilling

Billing endpoint renames — frontend integration

Billing endpoint renames — frontend integration

The two billing action endpoints were renamed to reflect what they actually do after the Paymob native-subscription migration. These are breaking route changes — update the frontend calls.

Renamed routes

OldNewWhat it does
POST /api/v1/user/billing/payment-methodPOST /api/v1/user/billing/checkoutSets up the subscription + card via one hosted 3DS checkout. Returns { data: { redirect_url } } — redirect the browser there. On a trial the first charge is delayed to trial end (native free trial); a lapsed account is charged immediately to recover. Requires a paid plan.
POST /api/v1/user/billing/subscribePOST /api/v1/user/billing/change-planChanges which plan you're on. Free immediate swap during the trial; a prorated charge to the saved card when active. Returns { data: { charged, subscription } } — poll /usage when charged is true.

Request/response bodies are unchanged — only the paths changed:

  • POST /checkout body: { callback_url? } (unchanged from the old /payment-method).
  • POST /change-plan body: { plan_slug, period? } (unchanged from the old /subscribe).

Why

  • payment-method now creates the whole subscription (not just "adds a card"), so it's the checkout entry point.
  • subscribe only ever changed the plan — the actual subscribing happens at /checkout — so it's now change-plan.

Also note (unrelated to the rename)

  • GET /billing/payment-status param is payment_id (the legacy tap_id still works as an alias).

On this page