The translation was generated automatically and may contain mistakes
How to Create an Application Signature
Подпиcь приложения sign passed as a parameter in a JSON object params and ensures that the payment form parameters have not been changed on the client side.
sign MD5 hash from string concatenation with payment form and secure key parameters app secure key which is unique to each application.
You can find the protected application key in the settings of your applications :
- 1.Нажмите на Settings in front of your mini-app.
- 2.In the section Development выберите Access keys .
- 3.?1?’ поле The protected key The importance is
app secure key. To see the value of the key, click on Show me and confirm the action with a push message or SMS on your mobile device.
Important! In order not to compromise the private key, you need to form an application signature on the backend side of your application.
To form the app signature:
- 1.
- 2.
- 3.
Step 1. Collect a string in JSON format from the payment form parameters
A JSON parameter string is a pair concatenation "параметр":"значение" .
At the same time, the following rules must be observed:
- 1.Names of Parameters in
paramsshould be sorted alphabetically, including the parameter names inside the JSON objectdata. Ifdatacontains a fieldcashback, the fields inside that object must also be sorted alphabetically. - 2.From the line, we need to delete the parameter
action. - 3.String values must be passed without quotation marks.
Example of a JSON parameter string for signing an application
amount=1.5data={"currency":"RUB","merchant_data":"eyJvcmRlcl9pZCI6IjI1NTMxIiwidHMiOiIxNTM5MzI5NzcwIiwiYW1vdW50IjoxLjUsImN1cnJlbmN5IjoiUlVCIn0=","merchant_sign":"63d5dce9d2c9d29198ba12ba3f8e270e6606a221","order_id":"25531","ts":"1539329770"}description=Test Paymentmerchant_id=617001version=2?1?’ажно! Скорее всего, вам не нужно реализовывать свой алгоритм сериализации для canonical JSON. Для многи?1?… языков уже есть соответствующие инструменты.
Шаг 2. Сконкатенируйте полученную строку с защищённым ключом вашего приложения app secure key
?1?’ примере app secure key = 2ug3CQvCkfRyI6svLVpC.
Пример конкатенации JSON-строки и защищённого ключа
amount=1.5data={"currency":"RUB","merchant_data":"eyJvcmRlcl9pZCI6IjI1NTMxIiwidHMiOiIxNTM5MzI5NzcwIiwiYW1vdW50IjoxLjUsImN1cnJlbmN5IjoiUlVCIn0=","merchant_sign":"63d5dce9d2c9d29198ba12ba3f8e270e6606a221","order_id":"25531","ts":"1539329770"}description=Test Paymentmerchant_id=617001version=2ug3CQvCkfRyI6svLVpCStep 3. Encode the result of concatenation using the hash algorithm MD5
818964335a550e39d9a1dd0d752e60ab
Done! Use the received value in sending a Request в параметре params.sign Among others payment window parameters .