UserSync API Request Example & Responses
UserSync API Request
Example Format JSON-RPC http://www.jsonrpc.org/specification
//
{
"id": "6164695159717629913",
"jsonrpc": "2.0",
"method": "syncUser",
"params": [
{
"isForTest": 1,
"serviceProvider": "Coda",
"purchaseOrigin": "TH",
"user": {
"userId": "111111",
"zoneId": "101"
},
"signature": "4646fbd3363ab452f40187f8744cd321f71968ed01cdc19c416203832cddd76e"
}
]
}id
String
A unique ID identifying the API call.
jsonrpc
String
Fixed to “2.0” by json-rpc standard.
method
String
Fixed to “syncUser”
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 Calculation
params.user.userId
String
The user ID/player ID of the customer account in the partner's system.
params.user.zoneId
String
The zone ID/server ID of the customer account in the partner's system.
If zoneId is not required, the default value is “”.
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
Signature Calculation
The signature must be included in all requests. The signature for a request is a hash of the following fields, in the correct sequence:
For UserSync API calls:
id + jsonrpc + method + serviceProvider + userId + zoneId + isForTest
For Validate and Topup API calls:
id + jsonrpc + method + serviceProvider + txnId + orderId + userId + zoneId + currency + amount + sku + quantity + paymentChannelId + isForTest (+ roleId)
UserSync API Request Responses
UserSync API Response describes the response to a UserSync API request by the partner. See below for examples of Valid and Invalid UserSync API responses.
Valid UserSync API Response
Example 1 Format: JSON-RPC
Example 2
If the Publisher wants to send metadata to showcase personalized SKU list based on the in-game user information
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.metadata
Publisher can use this field to add details such as user’s country of origin, in-game level, list of character or roleInfo of that user etc. (Optional)
result.personalisedSkus
The list of SKUs available to the user. (Optional)
result.personalisedSkus.skuId
SkuId (Optional)
result.personalisedSkus.description
Name of the SkuId (Optional)
result.personalisedSkus.details
The Object that holds sku’s details (Optional)
result.personalisedSkus.status
SKU status
INACTIVE (Locked/Disabled) = 0 ACTIVE (Available) = 1 PURCHASED (Already Purchased) = 2
result.personalisedSkus.details.category
Category or the Sub-type of the SKU (Optional)
result.personalisedSkus.details.price
Price that needs to be send in API to the publishers (Optional)
result.personalisedSkus.details.currency
Currency that needs to be sent in API to the publishers during top-up (Optional)
result.personalisedSkus.details.pendingPurchaseLimit
The maximum quantity of this SKU the user can purchase based on their current eligibility (Optional)
result.personalisedSkus.details.validTill
The specific date and time until which the SKUs will remain available for purchase. YYYY-MM-DD HH:MM:SS (Optional)
result.personalisedSkus.metadata.imageUrl
Image source for a specific SKU in Partner’s CDN (Optional)
Invalid UserSync API Response
Format: JSON-RPC
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.
For any queries related to integration, reach out to the Partnership Support Team.
Last updated
Was this helpful?