> For the complete documentation index, see [llms.txt](https://docs.coda.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coda.co/coda-webstore/web-store-integration-guides/top-up-api-request/top-up-api-request-example-and-responses.md).

# Top-Up API Request Example & Responses

<mark style="color:purple;">**Example**</mark>\
Format: JSON-RPC

```javascript
// 
{
  "id": "6164699909785264260",
  "jsonrpc": "2.0",
  "method": "topup",
  "params": [
    {
      "isForTest": 1,
      "price": {
        "amount": "50000",
        "currency": "IDR"
      },
      "serviceProvider": "Coda",
      "quantity": 1,
      "paymentChannelId": 227,
      "sku": "Diamonds_10",
      "purchaseOrigin": "TH",
      "user": {
        "userId": "111111",
        "zoneId": "101",
        "roleId": "111"
      },
      "signature": "73d173363f6706d59c35bcea785f543488389b68d582a9b2339e9450db177695",
      "txnId": "6164699909785264260",
      "orderId": "6164699909782101750",
      "merchantTransactionId": "816176257914769"
    }
  ]
}
```

<table><thead><tr><th width="289">Parameter</th><th width="120.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>A per-method unique string (the ID can be repeated in calls for different methods). </td></tr><tr><td>jsonrpc</td><td>String</td><td>Fixed to “2.0” by json-rpc standard.</td></tr><tr><td>method</td><td>String</td><td>Fixed to “topup”.</td></tr><tr><td>params.serviceProvider</td><td>String</td><td>Payment service provider name, default value is “Coda”, but partners can decide the value.</td></tr><tr><td>params.isForTest</td><td>Integer</td><td>1 for sandbox test order; 0 for production orders.</td></tr><tr><td>params.signature</td><td>String</td><td>A generated string with the content of the message. </td></tr><tr><td>params.user.userId</td><td>String</td><td>The user ID/player ID of the customer account in the partner's system.</td></tr><tr><td>params.user.zoneId</td><td>String</td><td><p>The zone ID/server ID of the customer account in the publisher’s system. </p><p></p><p>If zoneId is not required, the default value is “”.</p></td></tr><tr><td>params.user.roleId</td><td>String</td><td><p>Optional. The role ID/character ID of this user account. <br></p><p>If the Validate API response includes roleList, it is required.</p></td></tr><tr><td>params.price.currency</td><td>String</td><td>Currency code of the purchase amount (ISO 4217)</td></tr><tr><td>params.price.amount</td><td>String</td><td>The amount paid by the customer, in the currency defined in params.price.currency.</td></tr><tr><td>params.sku</td><td>String</td><td>A product ID representing the item being purchased, e.g. “Diamonds_123”.</td></tr><tr><td>params.purchaseOrigin</td><td>String</td><td><p>Note: purchaseOrigin is a 2 country code ISO standard. This will be the region where the user of webstore did the purchase from.<br></p><p><a href="https://www.iban.com/country-codes">https://www.iban.com/country-codes</a></p></td></tr><tr><td>params.quantity</td><td>Integer</td><td>Number of the SKU to be purchased, typically 1.</td></tr><tr><td>params.paymentChannelId</td><td>Integer</td><td>Payment channel id, please check section 7 below for values.</td></tr><tr><td>params.txnId</td><td>String</td><td>Payment transaction identifier</td></tr><tr><td>params.orderId</td><td>String</td><td>webstore order identifier</td></tr><tr><td>params.merchantTransactionId</td><td>String</td><td>Optional. publisher’s order ID in validate response</td></tr></tbody></table>

## <mark style="color:purple;">Top-up Request Responses</mark>

The Top-up Request Response describes the response to a top-up request by the publisher.\
\
See below for examples of [Valid](#valid-top-up-transaction-response) and [Invalid](#invalid-top-up-transaction-response) Top-up responses.

## <mark style="color:purple;">Valid Top-up Transaction Response</mark>

Format: JSON-RPC

```javascript
{
  "id": "6164699909785264260",
  "jsonrpc": "2.0",
  "result": 0
}
```

<table><thead><tr><th width="136">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>The ID of the message this response is associated with.  </td></tr><tr><td>jsonrpc</td><td>Fixed to “2.0” by json-rpc standard</td></tr><tr><td>result</td><td>An Object representing success.</td></tr></tbody></table>

## <mark style="color:purple;">Invalid Top-up Transaction Response</mark>

The response returned when a top-up <mark style="color:red;">failed</mark>.&#x20;

While failures in the validation process are expected, a failure in this method is an unexpected event, as all parameters of the top-up should already have been validated.

<mark style="color:purple;">**Example**</mark>\
Format: JSON-RPC

```javascript
{
  "id": "6164699909785264260",
  "jsonrpc": "2.0",
  "error": {
    "code": -103,
    "message": "Server is under maintenance"
  }
}
```

<table><thead><tr><th width="171">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>The ID of the message this response is associated with.  </td></tr><tr><td>jsonrpc</td><td>Fixed to “2.0” by json-rpc standard</td></tr><tr><td>error.code</td><td>A code representing the error cause.</td></tr><tr><td>error.message</td><td>A message explaining the error condition. </td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.coda.co/coda-webstore/web-store-integration-guides/top-up-api-request/top-up-api-request-example-and-responses.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
