Billing
Create checkout session (fiat)
**Customer subscription flow — Step 2.** Creates a fiat checkout session. Request body must include planId (from GET public plans), billingCycle (monthly|yearly), and customerInfo.email. Redirect the user to **checkoutUrl** (same URL as authorizationUrl). After payment, call verify-payment with **reference** (mudbase_...). Response includes only fiat fields (no paymentAddress, paymentOptions, network, asset, or pmt_ references).
POST
/api/billing/public/projects/{projectId}/checkoutSDK setup
Create a client instance. No authentication is required for this endpoint.
import { Configuration, BillingApi } from 'mudbase-sdk';
const configuration = new Configuration({
basePath: 'https://cloud.mudbase.dev',
});
const billing = new BillingApi(configuration);import { Configuration, BillingApi } from 'mudbase-sdk';
const configuration = new Configuration({
basePath: 'https://cloud.mudbase.dev',
});
const billing = new BillingApi(configuration);Example request
Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.
const { data: result } = await billing.createCheckoutSession(
"proj_9fzxmOjpTFvr",
{
planId: "NxsQPIvBlkS1q7nO",
billingCycle: "interface bypass",
customerInfo: "program synthesize",
successUrl: "https://vast-brace.com",
cancelUrl: "https://practical-lotion.name"
}
);const { data: result } = await billing.createCheckoutSession(
"proj_9fzxmOjpTFvr",
{
planId: "NxsQPIvBlkS1q7nO",
billingCycle: "interface bypass",
customerInfo: "program synthesize",
successUrl: "https://vast-brace.com",
cancelUrl: "https://practical-lotion.name"
}
);Playground
liveTest 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
Authentication
Public — No Auth Required
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | Project ID |
Request Body
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/"
}Responses
200Checkout session created
json
{
"success": true,
"data": {
"checkoutUrl": "https://pay.mudbase.dev/checkout/xxx",
"authorizationUrl": "https://pay.mudbase.dev/checkout/xxx",
"accessCode": "ACCESS_xxx",
"reference": "mudbase_abc123xyz",
"amount": 29.99,
"currency": "USD"
}
}{
"success": true,
"data": {
"checkoutUrl": "https://pay.mudbase.dev/checkout/xxx",
"authorizationUrl": "https://pay.mudbase.dev/checkout/xxx",
"accessCode": "ACCESS_xxx",
"reference": "mudbase_abc123xyz",
"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"
}500—
Errors
| Code | Meaning |
|---|---|
400 | Missing planId, billingCycle, or customerInfo.email |
500 | — |