putty
API ReferenceLedger

Quote a credit pack at the server's token price

Quotes a credit pack in a token and returns the amount to send, priced from a **Chainlink Data Feed on Robinhood Chain read at request time** — the price is never taken from the request and never assumed. `usdg` is priced through the `USDG / USD` feed and `eth` through `ETH / USD`. The response carries `priceSource`: the aggregator proxy, the exact round id, and when that round was published, so a client can call `latestRoundData()` on the same address and confirm the rate it was given. `roundId` is a string because it is an 80-bit counter that does not fit a JSON number. A round older than **twice the feed's own heartbeat** is refused rather than quoted. Every feed on this chain reports once a day, which is correct for a stablecoin whose price does not move intraday, so a shorter bound would refuse a healthy feed. Two heartbeats tolerates one missed update and no more. **`tokenPriceUsd` in the request is ignored.** The rate is the server's; a caller that names one does not get it. The field is still accepted so an older client is not broken by the change. This is the pricing half of the order. Creating the payment order and the unsigned transaction to sign needs a deployed payment receiver contract, and there is not one yet — so the response is a quote, and the 201 order response is not yet returned by this route. Card checkout through the Business Kit is a separate flow and is unaffected.

POST
/billing/orders

Quotes a credit pack in a token and returns the amount to send, priced from a Chainlink Data Feed on Robinhood Chain read at request time — the price is never taken from the request and never assumed. usdg is priced through the USDG / USD feed and eth through ETH / USD.

The response carries priceSource: the aggregator proxy, the exact round id, and when that round was published, so a client can call latestRoundData() on the same address and confirm the rate it was given. roundId is a string because it is an 80-bit counter that does not fit a JSON number.

A round older than twice the feed's own heartbeat is refused rather than quoted. Every feed on this chain reports once a day, which is correct for a stablecoin whose price does not move intraday, so a shorter bound would refuse a healthy feed. Two heartbeats tolerates one missed update and no more.

tokenPriceUsd in the request is ignored. The rate is the server's; a caller that names one does not get it. The field is still accepted so an older client is not broken by the change.

This is the pricing half of the order. Creating the payment order and the unsigned transaction to sign needs a deployed payment receiver contract, and there is not one yet — so the response is a quote, and the 201 order response is not yet returned by this route. Card checkout through the Business Kit is a separate flow and is unaffected.

Request Body

application/json

The pack to buy and what to pay with.

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/billing/orders" \  -H "Content-Type: application/json" \  -d '{    "pack": "string",    "token": "usdg"  }'
{  "quote": {    "pack": "string",    "quoteUsd": "string",    "token": "string",    "tokenPriceUsd": "string",    "amount": "string",    "decimals": 0,    "credits": 0,    "orderId": "string",    "expiresAt": "2019-08-24T14:15:22Z",    "priceSource": {      "feedAddress": "string",      "roundId": "string",      "updatedAt": "2019-08-24T14:15:22Z",      "ageSeconds": 0    }  }}