Validation Request Example & Responses

Format: JSON-RPC

// {
  "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"
    }
  ]
}
ParameterTypeDescription

id

String

A unique ID identifying the API call.

jsonrpc

String

Fixed to “2.0” by json-rpc standard.

method

String

Fixed to “validate”.

params.serviceProvider

String

Payment service provider name, default value is “Coda”, but partner can decide the value.

params.isForTest

Integer

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.

params.signature

String

Generated based on the content of the message. See section on Signature Generation.

params.user.userId

String

The user ID/player ID of the customer account in the publisher’s system.

params.user.zoneId

String

The zone ID/server ID of the customer account in the publisher’s system.

If zoneId is not required, the default value is “”.

params.price.currency

String

An ISO 4217 currency code.

params.price.amount

String

Representing the amount paid by the customer, in the currency defined in params.price.currency.

params.sku

String

A product ID representing the item being purchased, e.g. “Diamonds_123”.

params.purchaseOrigin

String

Note: purchaseOrigin is a 2 country code ISO standard. This will be the region where the user of codashop did the purchase from. https://www.iban.com/country-codes

params.quantity

Integer

Number of the SKU to be purchased, typically 1.

params.paymentChannelId

Integer

Payment channel id, please check section 6.

params.txnId

String

Representing the payment transaction ID.

params.orderId

String

Representing the Codashop order ID.

Codashop Validation Request Responses

The Codashop Validation Response describes the response to a validation request by the partner. See below for examples of Valid and Invalid Validation responses.

Valid Validation Response

Example 1 Format: JSON-RPC

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

Example 2 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.

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

id

The id of the message this response is associated with.

jsonrpc

Fixed to “2.0” by json-rpc standard.

result

An Object representing success.

result.username

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”.

result.roleList

Listing all roles or sub-accounts under the user’s account, if applicable.

result.roleList.roleName

Role name.

result.roleList.roleId

Role ID.

result.merchantTransactionId

(Optional) Unique OrderID generated by the publisher side.

result.accountRegionCode

Note: accountRegionCode must be returned in a 2 country code ISO standard. This will be the account Region name where the userId got created.

Egs: TH for thailand, SG for Singapore https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes

Invalid Validation Response

Format: JSON-RPC

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

id

The ID of the message this response is associated with.

jsonrpc

Fixed to “2.0” by json-rpc standard.

error.code

A code representing the error.

error.message

A message explaining the error.

Last updated