> 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/codashop-and-distribution/integration-guides/validation-api-request/validation-api-request-example-and-responses.md).

# Validation API Request Example & Responses

## <mark style="color:purple;">**Codashop Transaction Validation Request**</mark>

<mark style="color:purple;">**Example**</mark>\
Format JSON-RPC\
<http://www.jsonrpc.org/specification>

<pre class="language-javascript"><code class="lang-javascript"><strong>// {
</strong>  "id": "6164695159717629913",
  "jsonrpc": "2.0",
  "method": "validate",
  "params": [
    {
      "isForTest": 1,
      "price": {
        "amount": "50000",
        "currency": "IDR"
      },
      "serviceProvider": "Coda",
      "quantity": 1,
      "paymentChannelId": 227,
      "sku": "Diamonds_10",
      "purchaseOrigin": "TH",
      "user": {
        "userId": "111111",
        "zoneId": "101"
      },
      "signature": "4646fbd3363ab452f40187f8744cd321f71968ed01cdc19c416203832cddd76e",
      "txnId": "6164695159717629913",
      "orderId": "6164695159719894644"
    }
  ]
}

</code></pre>

<table><thead><tr><th width="255">Parameter</th><th width="112.33333333333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>A unique ID identifying the API call.</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 “validate”.</td></tr><tr><td>params.serviceProvider</td><td>String</td><td>Payment service provider name, default value is “Coda”, but partner can decide the value.</td></tr><tr><td>params.isForTest</td><td>Integer</td><td>A flag to indicate whether this order is for sandbox test or real order. If isForTest=1, this order is a sandbox test order; otherwise if isForTest=0, this order is a real order.</td></tr><tr><td>params.signature</td><td>String</td><td>Generated based on the content of the message. See section on Signature Generation. </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 partner's system.</p><p>If zoneId is not required, the default value is “”.</p></td></tr><tr><td>params.price.currency</td><td>String</td><td>An ISO 4217 currency code.</td></tr><tr><td>params.price.amount</td><td>String</td><td>Representing 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>Note: purchaseOrigin is a 2 country code ISO standard. This will be the region where the user of codashop did the purchase from.<br><br><a href="https://www.iban.com/country-codes">https://www.iban.com/country-codes</a></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 6.</td></tr><tr><td>params.txnId</td><td>String</td><td>Representing the payment transaction ID.</td></tr><tr><td>params.orderId</td><td>String</td><td>Representing the Codashop order ID. </td></tr></tbody></table>

## <mark style="color:purple;">Codashop Validation Request Responses</mark>

The Codashop Validation Response describes the response to a validation request by the partner.\
\
See below for examples of [Valid](#valid-validation-response) and [Invalid](#invalid-validation-response) Validation responses.

## <mark style="color:purple;">Valid Validation Response</mark>

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

```javascript
// 
{
  "id": "6164695159717629913",
  "jsonrpc": "2.0",
  "result": {
    "merchantTransactionId": "816176257914769",
    "username": "Test User",
    "accountRegionCode": "SG"
  }
}
```

<mark style="color:purple;">**Example 2**</mark>\
If there are multiple roles or sub-accounts under each account, and the user needs to choose which one to top up, the option should be shared as a roleList. Only roles that can be topped up should be included. Coda will present these options to the user before proceeding to payment.

```javascript
// 
{
  "id": "6164695159717629913",
  "jsonrpc": "2.0",
  "result": {
    "roleList": [
      {
        "roleName": "roleA",
        "roleId": "111"
      },
      {
        "roleName": "roleB",
        "roleId": "222"
      },
      {
        "roleName": "roleC",
        "roleId": "333"
      }
    ],
    "merchantTransactionId": "816176257914769",
    "accountRegionCode": "SG"
  }
}
```

<table><thead><tr><th width="272">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><tr><td>result.username</td><td>Player username, nickname, or other identifier that can be used to let the customer confirm they are topping up the intended account. For example, a unique player id may be “123456789”, and their username (not necessarily unique) may be “Terminator123”. </td></tr><tr><td>result.roleList</td><td>Listing all roles or sub-accounts under the user’s account, if applicable. </td></tr><tr><td>result.roleList.roleName</td><td>Role name.</td></tr><tr><td>result.roleList.roleId</td><td>Role ID.</td></tr><tr><td>result.merchantTransactionId</td><td>(Optional) Unique OrderID generated by the partner side.</td></tr><tr><td>result.accountRegionCode</td><td><p>Note: accountRegionCode must be returned in a 2 country code ISO standard. This will be the account Region name where the userId got created.<br></p><p>Egs: TH for thailand, SG for Singapore<br><a href="https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes">https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes</a></p></td></tr></tbody></table>

## <mark style="color:purple;">Invalid Validation Response</mark>

Format: JSON-RPC

```javascript
// 
{
    "id": "6164695159717629913",
    "jsonrpc": "2.0",
    "error": {
        "code": -100,
        "message": "Invalid user ID"
    }
}
```

<table><thead><tr><th width="200">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.</td></tr><tr><td>error.message</td><td>A message explaining the error.</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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.coda.co/codashop-and-distribution/integration-guides/validation-api-request/validation-api-request-example-and-responses.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
