Billing API
Plan, checkout, invoices and X credit top-ups.
| Operation | Method and path |
|---|---|
| Current plan and subscription | GET /api/v1/billing/subscription |
| Start a plan checkout | POST /api/v1/billing/checkout |
| Open the payment-details portal | POST /api/v1/billing/portal |
| Cancel at the end of the period | POST /api/v1/billing/cancel |
| Undo a pending cancellation | POST /api/v1/billing/resume |
| List invoices | GET /api/v1/billing/invoices |
| Get an invoice with its lines | GET /api/v1/billing/invoices/{id} |
| Billing details printed on invoices | GET /api/v1/billing/details |
| Update billing details | PATCH /api/v1/billing/details |
| Buy X credit | POST /api/v1/billing/credits/top-up |
| Credit movements | GET /api/v1/billing/credits/ledger |
| Set the low-balance threshold | PATCH /api/v1/billing/credits/settings |
GET
/api/v1/billing/subscription Current plan and subscription
billing.subscription · requires x-api-key
Example
curl -X GET "https://api.siaran.my/api/v1/billing/subscription" \
-H "x-api-key: $SIAR_API_KEY" Response 200
8 top-level fields
-
planstring requiredOne of:FREEPROBUSINESSENTERPRISE -
intervalstring nullableOne of:MONTHLYYEARLY -
statusstring nullableOne of:trialingactivecanceledincompleteincomplete_expiredpast_dueunpaidpaused -
providerstring nullableOne of:STRIPECHIPMOCK -
currentPeriodEndstring nullable date-time -
trialEndsAtstring nullable date-time -
cancelAtPeriodEndboolean -
currencystring
POST
/api/v1/billing/checkout Start a plan checkout
billing.checkout · requires x-api-key
Request body application/json
-
planstring requiredOne of:FREEPROBUSINESSENTERPRISE -
intervalstring requiredOne of:MONTHLYYEARLY -
providerstringOne of:STRIPECHIP -
couponstring nullable
Example
curl -X POST "https://api.siaran.my/api/v1/billing/checkout" \
-H "x-api-key: $SIAR_API_KEY" \
-H "content-type: application/json" \
-d '{
"plan": "FREE",
"interval": "MONTHLY"
}' Response 200
2 top-level fields
-
urlstring required -
providerstring
POST
/api/v1/billing/portal Open the payment-details portal
billing.portal · requires x-api-key
Example
curl -X POST "https://api.siaran.my/api/v1/billing/portal" \
-H "x-api-key: $SIAR_API_KEY" Response 200
2 top-level fields
-
urlstring required -
providerstring
POST
/api/v1/billing/cancel Cancel at the end of the period
billing.cancel · requires x-api-key
Example
curl -X POST "https://api.siaran.my/api/v1/billing/cancel" \
-H "x-api-key: $SIAR_API_KEY" Response 200
8 top-level fields
-
planstring requiredOne of:FREEPROBUSINESSENTERPRISE -
intervalstring nullableOne of:MONTHLYYEARLY -
statusstring nullableOne of:trialingactivecanceledincompleteincomplete_expiredpast_dueunpaidpaused -
providerstring nullableOne of:STRIPECHIPMOCK -
currentPeriodEndstring nullable date-time -
trialEndsAtstring nullable date-time -
cancelAtPeriodEndboolean -
currencystring
POST
/api/v1/billing/resume Undo a pending cancellation
billing.resume · requires x-api-key
Example
curl -X POST "https://api.siaran.my/api/v1/billing/resume" \
-H "x-api-key: $SIAR_API_KEY" Response 200
8 top-level fields
-
planstring requiredOne of:FREEPROBUSINESSENTERPRISE -
intervalstring nullableOne of:MONTHLYYEARLY -
statusstring nullableOne of:trialingactivecanceledincompleteincomplete_expiredpast_dueunpaidpaused -
providerstring nullableOne of:STRIPECHIPMOCK -
currentPeriodEndstring nullable date-time -
trialEndsAtstring nullable date-time -
cancelAtPeriodEndboolean -
currencystring
GET
/api/v1/billing/invoices List invoices
billing.invoices · requires x-api-key
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
offset | query | integer | |
limit | query | integer |
Example
curl -X GET "https://api.siaran.my/api/v1/billing/invoices" \
-H "x-api-key: $SIAR_API_KEY" Response 200
2 top-level fields
-
itemsobject[] required14 fields
-
idstring required -
numberstring required -
descriptionstring -
amountCentsinteger required -
currencystring -
statusstring -
providerstring -
pdfUrlstring nullable -
hostedUrlstring nullable -
periodStartstring nullable date-time -
periodEndstring nullable date-time -
paidAtstring nullable date-time -
paymentMethodstring nullable -
createdAtstring date-time
-
-
totalinteger required
GET
/api/v1/billing/invoices/{id} Get an invoice with its lines
billing.invoice · requires x-api-key
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
id required | path | string |
Example
curl -X GET "https://api.siaran.my/api/v1/billing/invoices/ID" \
-H "x-api-key: $SIAR_API_KEY" Response 200
21 top-level fields
-
idstring required -
numberstring required -
descriptionstring -
amountCentsinteger required -
currencystring -
statusstring -
providerstring -
pdfUrlstring nullable -
hostedUrlstring nullable -
periodStartstring nullable date-time -
periodEndstring nullable date-time -
paidAtstring nullable date-time -
paymentMethodstring nullable -
createdAtstring date-time -
linesobject[]6 fields
-
descriptionstring required -
quantityinteger -
unitAmountCentsinteger -
amountCentsinteger required -
periodStartstring nullable date-time -
periodEndstring nullable date-time
-
-
subtotalCentsinteger -
totalCentsinteger -
amountPaidCentsinteger -
amountDueCentsinteger -
billToobject nullable4 fields
-
namestring nullable -
emailstring nullable -
addressstring nullable -
taxIdstring nullable
-
-
issuermap<string, any>
GET
/api/v1/billing/details Billing details printed on invoices
billing.details · requires x-api-key
Example
curl -X GET "https://api.siaran.my/api/v1/billing/details" \
-H "x-api-key: $SIAR_API_KEY" Response 200
4 top-level fields
-
namestring nullable -
emailstring nullable -
addressstring nullable -
taxIdstring nullable
PATCH
/api/v1/billing/details Update billing details
billing.updateDetails · requires x-api-key
Request body application/json
-
namestring nullable max length 200 -
emailstring nullable emailmax length 254 -
addressstring nullable max length 600 -
taxIdstring nullable max length 60
Example
curl -X PATCH "https://api.siaran.my/api/v1/billing/details" \
-H "x-api-key: $SIAR_API_KEY" \
-H "content-type: application/json" \
-d '{
"name": "Example",
"email": "[email protected]",
"address": "string"
}' Response 200
4 top-level fields
-
namestring nullable -
emailstring nullable -
addressstring nullable -
taxIdstring nullable
POST
/api/v1/billing/credits/top-up Buy X credit
billing.topUp · requires x-api-key
Request body application/json
-
amountUsdinteger required ≥ 5≤ 5000 -
providerstringOne of:STRIPECHIP
Example
curl -X POST "https://api.siaran.my/api/v1/billing/credits/top-up" \
-H "x-api-key: $SIAR_API_KEY" \
-H "content-type: application/json" \
-d '{
"amountUsd": 5
}' Response 200
2 top-level fields
-
urlstring required -
providerstring
GET
/api/v1/billing/credits/ledger Credit movements
billing.ledger · requires x-api-key
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
offset | query | integer | |
limit | query | integer |
Example
curl -X GET "https://api.siaran.my/api/v1/billing/credits/ledger" \
-H "x-api-key: $SIAR_API_KEY" Response 200
2 top-level fields
-
itemsobject[] required7 fields
-
idstring required -
deltaMicroUsdinteger required -
reasonstring required -
actionstring nullable -
refTypestring nullable -
refIdstring nullable -
createdAtstring date-time
-
-
totalinteger required
PATCH
/api/v1/billing/credits/settings Set the low-balance threshold
billing.creditSettings · requires x-api-key
Request body application/json
-
lowBalanceThresholdMicroUsdinteger required
Example
curl -X PATCH "https://api.siaran.my/api/v1/billing/credits/settings" \
-H "x-api-key: $SIAR_API_KEY" \
-H "content-type: application/json" \
-d '{
"lowBalanceThresholdMicroUsd": 1
}' Response 200
A map<string, any>.