- A plan: a monthly subscription the merchant picks when installing your app.
- A usage wallet: the merchant tops it up, and your app takes from it as it is used.
Amounts
Every amount is a string of US dollars with up to 6 decimals:"19.00", "0.05", "0.000001". Answers show at least two decimals. Amounts you send must be more than zero; a bad one answers 422 with the rule amount and the param 0.000001,6.
The subscription
subscription is null when your app has no plans. Otherwise:
priceis what the merchant agreed to pay a month. It stays the same until a price change applies.pending_plan_idandpending_plan_price: a cheaper plan the merchant picked, which starts at the next renewal.price_change: a higher price your app set for the plan. Until the merchant accepts it, renewals charge the old price; if they neither accept it nor remove your app bydeadline, your app is removed then.
app/subscription_updated when the subscription changes.
When the subscription is suspended
Whilestatus is suspended, every endpoint of the API answers 402 payment_required, except the billing endpoints: your app can still read its billing and its wallet’s transactions, to see why. A new debit is refused with 402 payment_required; a debit sent again with its key still answers the first one.
The usage wallet
wallet.enabled says whether your app has a usage wallet. The merchant tops it up from their credits, and your app receives app/wallet_topped_up. Your app can never add to it.
Debit the wallet takes an amount for usage, priced as your app sees fit:
Idempotency-Keyis required. Use a key from your own record. The same key again answers201with the first debit andIdempotent-Replayed: true, and takes nothing, however long after. The same key with another amount or description answers422 idempotency_key_reused. See Idempotency.descriptionis up to 200 characters, one line, no<. The merchant reads it in the wallet’s transactions after your app’s name.- The balance never goes below zero. A debit the wallet does not cover answers
402 insufficient_balance, and takes nothing. Warning the merchant when the balance runs low is your app’s job. - Refusals:
409 wallet_not_enabledwhen your app has no wallet,409 app_suspendedwhen your app is suspended and being removed,402 payment_requiredwhile the subscription is suspended.
Transactions
List wallet transactions pages through every move of the wallet (see Pagination):amount is always positive; type gives the direction. balance_after is the balance right after the move. description is what the merchant reads, in Arabic: it names your app, and for a debit your own description follows.