Working with payments
Signature formation rules
Sign: The string is formed as follows: all mandatory request parameters are arranged in alphabetical key order, values are concatenated via the colon sign («:»), at the end the secret key is added (without «:»), sha256 is generated from the received string and its HEX-representation is passed in the sign request parameter.
Each method has its own set of mandatory parameters, additional parameters can also be passed, but they do not participate in signature formation.
Example of signature formation for the invoice request.
Mandatory request parameters:
"currency": "980",
"payway": "card_uah",
"amount": "12.34",
"shop_id": 5,
"shop_order_id": 4126
Secret key of the shop (from shop settings):
secret = "SecretKey01"
Ordered keys:
'amount', 'currency', 'payway', 'shop_id', 'shop_order_id'
String for sha256 hash generation looks like:
12.34:980:card_uah:5:4126SecretKey01
HEX-representation of hash:
4c2608a8638c0650d54dd4809bd69ab50d1a1cd55f2e13366b68d43caee34104
Example of signature formation for invoice request
"currency": "980",
"sign": "4c2608a8638c0650d54dd4809bd69ab50d1a1cd55f2e13366b68d43caee34104",
"payway": "card_uah",
"amount": "12.34",
"shop_id": "5",
"shop_order_id": 4126,
"description": "Test invoice"
For online verification you can use an online service
http://www.xorbin.com/tools/sha256-hash-calculator