On-Demand Charges
Charge subscriptions outside of the scheduled cadence. POST /v1/subscriptions/charges is a batch intake endpoint: you submit many charges in one request and they are processed asynchronously.
Endpointβ
curl -X POST https://mw.migopayments.com/v1/subscriptions/charges \
-H "Authorization: Bearer <middleware-jwt>" \
-H "Content-Type: application/json" \
-d '{
"client": "client_abc123",
"data": [
{ "subscriptionId": "sub_01HAAA", "amount": 15.00, "metadata": { "note": "Metered usage" } },
{ "subscriptionId": "sub_01HBBB", "amount": 49.99 }
]
}'
| Field | Required | Notes |
|---|---|---|
client | β | Client / tenant id (string) |
data | β | Non-empty array, max 5000 items |
data[].subscriptionId | β | Target subscription (string) |
data[].amount | β | Number |
data[].metadata | β | Free-form |
There is no subUid, currency, description, externalId, mode, or cardId field, and no Idempotency-Key header.
Responseβ
The endpoint returns 202 Accepted with batch totals:
{
"success": true,
"message": "Batch received",
"data": {
"clientId": "client_abc123",
"batchId": "bat_01HDDD",
"totals": { },
"errorsSample": [ ]
}
}
There is no single-charge response (chg_..., paymentId, state).
When to use on-demandβ
- Usage billing β bill for metered consumption.
- Add-ons β charge for upgrades or extra items.
- Top-ups β charge to replenish a balance.
- Dunning recovery β attempt a charge on a failing subscription.
When NOT to use on-demandβ
- For regular cadence billing β use Scheduled charges.
- For a one-off charge on a non-subscription card β use a Payment Link.
Notificationsβ
On-demand charges feed the same email-notification mechanism as scheduled charges. There is no public outbound webhook contract β see Subscriptions β Notifications.