Who is this for?

Businesses and developers who want to automate subscription billing or recurring payments using Monieswitch.

Overview

This guide covers:
  • Setting up recurring payment plans
  • Subscribing customers to plans
  • Managing and cancelling subscriptions
  • Handling webhooks for payment events

Prerequisites

1

Create Monieswitch Account

A Monieswitch account. Register at Monieswitch Dashboard.
2

Obtain API Key

API Key from your Monieswitch dashboard.
3

Set Up Backend Server

A backend server to securely manage subscriptions and webhooks.

1. Create a Recurring Payment Plan

Send a request to create a subscription plan:
POST https://nini.monieswitch.com/api/subscription/plans
Headers:
  Authorization: Bearer YOUR_API_KEY
  Content-Type: application/json

Body:
{
  "name": "Pro Plan",
  "amount": 10000,
  "interval": "monthly", // or "weekly", "yearly"
  "currency": "NGN",
  "description": "Access to premium features"
}

2. Subscribe a Customer to a Plan

Once you have a plan, subscribe a customer:
POST https://nini.monieswitch.com/api/subscription/subscribe
Headers:
  Authorization: Bearer YOUR_API_KEY
  Content-Type: application/json

Body:
{
  "planId": "YOUR_PLAN_ID",
  "customer": {
    "email": "[email protected]"
  },
  "startDate": "2024-09-01"
}

3. Managing Subscriptions

  • List Subscriptions: GET /api/subscription/list
  • Cancel Subscription: POST /api/subscription/cancel Body: { "subscriptionId": "SUBSCRIPTION_ID" }

4. Handling Webhooks

Set up webhooks to receive real-time notifications for successful payments, failed renewals, and cancellations.
  • Configure your webhook endpoint in the Monieswitch dashboard.
  • Handle events like subscription.payment_success, subscription.payment_failed, and subscription.cancelled.

5. Best Practices

  • Always verify webhook signatures for security.
  • Notify customers on successful or failed payments.
  • Allow customers to manage their subscriptions from your dashboard.

Visit our Support page or join the Monieswitch Community