billing

Create checkout session (Flutterwave or crypto)

Creates a checkout session for subscription billing. When Flutterwave is configured (platform), returns authorizationUrl and accessCode for redirect. When using crypto payment processor, returns checkoutUrl, paymentOptions (multi-chain USDC/USDT/BTC Lightning), and reference.

POST/api/billing/public/projects/{projectId}/checkout

Authentication

Public — No Auth Required

Path Parameters

NameTypeRequiredDescription
projectIdstringYesProject ID (MongoDB ObjectId) for the billing project.

Request Body

Plan to subscribe to, billing cycle, customer email/name, and optional success/cancel redirect URLs.

json
{
  "planId": "dvLn0aNZBCCCt0gY",
  "billingCycle": "monthly",
  "customerInfo": {
    "email": "joy81@northwind.dev",
    "name": "Mr. Nick Considine"
  },
  "successUrl": "https://rough-deduction.name/",
  "cancelUrl": "https://needy-perfection.net/"
}
{
  "planId": "dvLn0aNZBCCCt0gY",
  "billingCycle": "monthly",
  "customerInfo": {
    "email": "joy81@northwind.dev",
    "name": "Mr. Nick Considine"
  },
  "successUrl": "https://rough-deduction.name/",
  "cancelUrl": "https://needy-perfection.net/"
}

SDK setup

Create a client instance. No authentication is required for this endpoint.

import { MudbaseClient } from "mudbase";

const client = new MudbaseClient();
import { MudbaseClient } from "mudbase";

const client = new MudbaseClient();

Example request

Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.

const result = await client.billing.createCheckoutSession({
  projectId: "proj_2MtIu4KxG091",
  planId: "c9YJOxvZ1RoACG1v",
  billingCycle: "capacitor copy",
  customerInfo: "driver synthesize",
  successUrl: "https://lucky-slide.biz",
  cancelUrl: "https://scented-sustenance.net/"
});
const result = await client.billing.createCheckoutSession({
  projectId: "proj_2MtIu4KxG091",
  planId: "c9YJOxvZ1RoACG1v",
  billingCycle: "capacitor copy",
  customerInfo: "driver synthesize",
  successUrl: "https://lucky-slide.biz",
  cancelUrl: "https://scented-sustenance.net/"
});

Try It Live

Test this endpoint with your own credentials. Your requests will be sent to the live API.

No Request Yet

Send a request to see the full inspector

Responses

200Checkout session created

Flutterwave response

json
{
  "success": true,
  "data": {
    "authorizationUrl": "https://checkout.flutterwave.com/v3/xxx",
    "accessCode": "FLW_ACCESS_xxx",
    "reference": "mudbase_abc123xyz",
    "amount": 29.99,
    "currency": "USD"
  }
}
{
  "success": true,
  "data": {
    "authorizationUrl": "https://checkout.flutterwave.com/v3/xxx",
    "accessCode": "FLW_ACCESS_xxx",
    "reference": "mudbase_abc123xyz",
    "amount": 29.99,
    "currency": "USD"
  }
}

Crypto payment response

json
{
  "success": true,
  "data": {
    "checkoutUrl": "https://mudbase-pay.com/checkout/pmt_abc123",
    "reference": "pmt_abc123",
    "paymentId": "pmt_abc123",
    "paymentOptions": [
      {
        "chain": "polygon",
        "asset": "USDC",
        "address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
        "networkFee": "0.01",
        "totalDue": "29.99"
      }
    ],
    "amount": 29.99,
    "currency": "USD"
  }
}
{
  "success": true,
  "data": {
    "checkoutUrl": "https://mudbase-pay.com/checkout/pmt_abc123",
    "reference": "pmt_abc123",
    "paymentId": "pmt_abc123",
    "paymentOptions": [
      {
        "chain": "polygon",
        "asset": "USDC",
        "address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
        "networkFee": "0.01",
        "totalDue": "29.99"
      }
    ],
    "amount": 29.99,
    "currency": "USD"
  }
}
400Missing planId, billingCycle, or customerInfo.email
json
{
  "error": "planId, billingCycle, and customerInfo.email are required"
}
{
  "error": "planId, billingCycle, and customerInfo.email are required"
}
401Authentication required or invalid token.
403Access denied or insufficient permissions.
500Internal server error.

Errors

CodeMeaning
400Missing planId, billingCycle, or customerInfo.email
401Authentication required or invalid token.
403Access denied or insufficient permissions.
500Internal server error.
Edit this page on GitHub