Authorization
1. Signature Calculation
The signature must be included in all requests. The signature for a request is a hash of the following fields, in correct sequence:
For Validate and Topup API calls:
id + jsonrpc + method + serviceProvider + txnId + orderId + userId + zoneId + currency + amount + sku + quantity + paymentChannelId + isForTest (+ roleId)
Example id = “4123456789012345678” jsonrpc = "2.0" method = "topup" serviceProvider = "Coda" txnId = “4123456789012345678" orderId = "4876543210987654321" userId "1002356" zoneId": "101" currency = "IDR" amount = "200000.0" sku = "diamonds_1" quantity = 1 paymentChannelId = 0 isForTest = 0 roleId="111" secretKey = 1234567890ABCDE
If roleId is not required:
The Hmac value should be calculated as: hmac.encode ("1234567890ABCDE", "41234567890123456782.0topupCoda412345678901234567848765432109876543211002356101IDR200000.0diamonds_1100", 'SHA256')
The resulting signature value equals: 78c0e1335a95b9b0bd2b8c24f34f15c2b5d51b860487aa1a5d0e84ad4bf3c09b
If roleId is required:
The Hmac value should be calculated as: _hmac.encode("1234567890ABCDE", "41234567890123456782.0topupCoda412345678901234567848765432109876543211002356101IDR200000.0diamonds_1100111", 'SHA256')
The resulting signature value equals: 9a648682c00726535f3c0c7db15cdb795bf6138378ff3478625eca260dcfe3dd
Sample bash script using python to generate the signature: #------------------------------------------------------------- echo -e "import hashlib,hmac\nprint hmac.new('secretKey', '41234567890123456782.0topupCoda412345678901234567848765432109876543211002356101IDR200000.0diamonds_112270', hashlib.sha256).hexdigest()" | python #-------------------------------------------------------------
Sample code for signature generation.
*secretKey: The merchant defines this value and shares it with Coda.
Last updated
Was this helpful?