Skip to main content
A plan is what you charge and how often. A subscription is one customer on that plan. You create the plan once, and each customer who signs up gets a subscription against it. This guide creates a plan, reads it back, looks at its subscribers, and shows how to stop billing. All calls are on the gateway service:

What you’ll need

  • Your secret key. Every call in this guide authenticates with it.
  • A currency you are set up to collect in. Your regions determine this.
Plans and subscriptions are on /gateway/api/v1, not /accounts/api/v1. Accounts, balances and transfers are the other way round.

The shape of the flow

1

Create the plan

What you charge, in what currency, how often.
2

Read the plan back

Confirm the pricing and the region it resolved to.
3

See who is subscribed

List subscriptions on the plan, or count them by status.
4

Read one subscription

The billing dates and the card behind it.
5

Stop the billing

Cancel the plan, or cancel one customer’s subscription.

Step 1: Create the plan

Three things to note:
  • This returns 200, not 201, even though it creates the plan.
  • regions is derived, not sent. Spotflow worked out ["Ghana"] from the GHS currency and the GH country code. You cannot set it directly.
  • subscribers and subscriptions are separate counts. One customer who resubscribes is one subscriber and two subscriptions.

The plan is already active

A new plan comes back with status: "active". There is a POST /plans/{id}/activate endpoint, but calling it on a plan you just created always fails:
Do not put an activate call in your create flow. It is only for reactivating a plan you previously cancelled.

Your internal reference is the uniqueness key

Reusing an internalReference is rejected:
That makes plan creation safe to retry: a repeated request cannot create a duplicate plan.

Step 2: Read the plan back

Same body as the create call, plus createdAt. For a portfolio view across all plans:
Those counts are strings, not numbers. Parse them before doing arithmetic.
GET /plans lists them all and accepts size and status filters.

Step 3: See who is subscribed

nextPaymentDate is when this customer gets charged again. A brand new plan returns "content": [] with totalElements: 0. For a status breakdown rather than the rows:
Those seven keys are the full set of subscription statuses. completed means the cycleCount ran out; expired means the plan’s endDate passed. GET /subscriptions lists across all plans and accepts status and size.

Step 4: Read one subscription

This response has no customer object, while the by-plan list in Step 3 does. There is a customerId and nothing else. If you need the customer’s name, email or phone, fetch them from the by-plan list, not from this endpoint.
To see the card that will be charged:
Enough to show the customer which card is on file, and to warn them before it expires. There is a matching PUT on the same path to change it.

Step 5: Stop the billing

To stop the whole plan:
A cancelled plan can be brought back — this is the one case where activate is the right call:
status returns to active. To stop one customer instead of the whole plan, cancel their subscription:
We did not run the subscription cancel or activate calls, so their exact response bodies are not shown here. Cancelling a live subscription is destructive and there was no disposable one to use. The plan-level cancel and activate above are verified.

When things go wrong

What to do next