Starship Rewards API
Recharge

Charges API

Preview what a recharge will cost — face, discount and payable — without placing anything

Charges API

Returns the price breakdown for a prospective recharge: the face value, your discount, and what your wallet would be debited. Nothing is placed and no money moves.

Use it to show a price before the user commits. It is optional — submit prices the recharge server-side regardless — but it lets you show an accurate number first.

Endpoint

POST /api/v1/recharge/charges

Authentication: API Key + Secret required

It is a POST rather than a GET because pricing is per-client and dynamic. For the same reason the response is never cached.

Request

curl -X POST https://api.starshiprewards.com/api/v1/recharge/charges \
  -H "X-API-Key: <your-api-key>" \
  -H "X-API-Secret: <your-api-secret>" \
  -H "Content-Type: application/json" \
  -d '{
    "operator_id": 1,
    "amount": 199
  }'

Body

FieldTypeRequiredDescription
operator_idnumberYesFrom GET /api/v1/recharge/operators
amountnumber | stringYesFace value in whole rupees. Must be greater than zero

amount accepts a JSON number or a string and is parsed exactly — money never passes through a float. "199" and 199 are equivalent.

Whole rupees only. 199.50 is rejected with a 400, not rounded and not truncated. Our vendor truncates fractional rupees, so we refuse the request rather than let the amount silently change under you.

Response

200 OK

{
  "face": 199.00,
  "discount_pct": 2.50,
  "discount": 4.98,
  "payable": 194.02
}
FieldTypeDescription
facenumberThe recharge amount that reaches the operator — what the subscriber receives
discount_pctnumberYour resolved discount percentage
discountnumberface * discount_pct / 100, rounded to 2 decimal places
payablenumberface - discount. What your wallet would be debited

All money fields are returned to 2 decimal places.

The subscriber always receives the full face amount. The discount is your margin on the transaction, not a reduction in what gets recharged.

Pricing rules

  • discount_pct is resolved per client and per operator. Two operators can price differently for the same account.
  • The rate can change without notice. Do not hardcode it — call this endpoint, or read the discount and payable returned by submit.
  • If no discount is configured for your account, discount_pct is 0 and payable equals face. Pricing fails safe rather than guessing a rate.

This is a quote, not a hold

The response reserves nothing. It does not check your wallet balance, does not run the duplicate guard, and does not lock the price.

A 200 here does not mean the recharge will succeed. Between the quote and the submit, any of these can still refuse it:

  • Insufficient wallet balance
  • The duplicate guard
  • A client, channel or operator guard
  • The global kill-switch

Always treat the payable on the submit response as authoritative for reconciliation.

Validation

The operator is validated before a price is quoted, so you never receive a plausible-looking quote for an operator that cannot actually be recharged.

Errors

StatusMessageCause
400operator_id is requiredMissing or zero operator_id
400amount must be greater than zeroZero or negative amount
400amount must be a whole rupeeFractional amount, e.g. 199.50
400unknown operator_idNo such operator, or the operator is inactive
400invalid request bodyMalformed JSON
401Missing or invalid API credentials
500Pricing could not be resolved. Retry with backoff

Next

Submit a recharge — place the real thing.