Recurring PaymentsOverview

Recurring Payments

SaySwitch Recurring Payments lets you bill a customer automatically on a schedule after the customer authorizes their card and gives recurring-payment consent.

This documentation covers the server-to-server (S2S) API. Dashboard support is planned, but subscription management is not currently available from the merchant dashboard.

How It Works

  1. Create or retrieve the customer through the Customers API.
  2. Create a recurring payment plan.
  3. Initialize a subscription with the customer’s code or email and the plan code.
  4. Receive an authorization_url from SaySwitch.
  5. Redirect the customer to the SaySwitch-hosted checkout.
  6. The customer authorizes their card and gives recurring-payment consent.
  7. SaySwitch activates the subscription after successful authorization.
  8. SaySwitch processes later charges according to the plan schedule.
  9. Your configured endpoint receives webhook notifications for subscription and charge events.

The customer and plan must already exist in the same test or live environment before you initialize a subscription.

Hosted Card Authorization

SaySwitch hosts the card authorization page. Redirect the customer to the exact authorization_url returned by the API.

Do not collect or send card numbers, CVVs, PINs, or other sensitive card information through your own server for this flow.

Base URL

https://backendapi.sayswitchgroup.com/api/v1

Authentication

Recurring Payments endpoints require your secret key in the Authorization header:

Authorization: Bearer YOUR_SECRET_KEY

Use a test secret key for sandbox requests and a live secret key for production requests. Keep secret keys on your server and never expose them in frontend code.

Quick Start

1. Create a Plan

curl --request POST \
  --url https://backendapi.sayswitchgroup.com/api/v1/plan \
  --header "Authorization: Bearer YOUR_SECRET_KEY" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Email Monthly",
    "description": "Monthly access to the email service",
    "amount": 15000,
    "currency": "NGN",
    "interval": "monthly",
    "invoice_limit": 12
  }'

Save the returned plan_code.

2. Initialize a Subscription

curl --request POST \
  --url https://backendapi.sayswitchgroup.com/api/v1/subscription \
  --header "Authorization: Bearer YOUR_SECRET_KEY" \
  --header "Idempotency-Key: email-subscription-test-001" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --data '{
    "customer": "CUS_customer_code",
    "plan_code": "PLN_plan_code",
    "start_date": "2026-10-01T00:00:00+01:00",
    "return_url": "https://merchant.example/subscription/complete",
    "metadata": {
      "merchant_order_id": "EMAIL-ORDER-001"
    }
  }'

Redirect the customer to data.authorization_url. Treat the browser redirect as a convenience only; confirm the final subscription state through the API and webhooks.

Subscription Statuses

StatusMeaning
pending_authorizationThe subscription was initialized and is waiting for the customer to open checkout.
authorizingCard authorization is currently in progress.
activeAuthorization succeeded and the subscription is eligible for scheduled billing.
past_dueThe latest recurring charge failed or the subscription cannot currently be charged.
cancelledThe subscription was cancelled and no future charges will be scheduled.
completedThe plan’s invoice_limit was reached successfully.
expiredThe hosted authorization session expired before authorization was completed.

Common API Errors

Missing authentication returns HTTP 401:

{
  "status": false,
  "message": "Merchant Authorization is required"
}

An invalid plain secret key also returns HTTP 401:

{
  "status": false,
  "message": "Invalid Secret Key"
}

Endpoint-specific validation errors return HTTP 422. A plan or subscription that cannot be found for the authenticated merchant and environment returns HTTP 404.

Next Steps