V
V
Vasily Petrov2016-10-06 22:07:38
PHP
Vasily Petrov, 2016-10-06 22:07:38

How to accept JSON format via php (Yandex.Money)?

I use the Yandex API to receive information about the payment. Yandex sends data to the site in JSON format, how to accept this data?
Here is the documentation - https://tech.yandex.ru/money/doc/dg/reference/noti...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
entermix, 2016-10-06
@entermix

Where is it written about JSON?

Request format The
notification is sent as an HTTP request to the address specified in the account settings in the following format:
method — POST;
each notification parameter is specified by a key/value pair as a POST request parameter;
MIME type - application/x-www-form-urlencoded;
character encoding is UTF-8.

A POST request will come to your site, catch something like this:
if (isset($_POST['operation_id'])){
    // Делаем проверку подлинности запроса, послечего выполняем нужные действия на сайте
}

X
xmoonlight, 2016-10-06
@xmoonlight

1. What JSON?!

The notification is sent as an HTTP request to the address specified in the account settings in the following format:
method - POST;
each notification parameter is specified by a key/value pair as a POST request parameter;
MIME type - application/x-www-form-urlencoded;
character encoding is UTF-8.
The data will be in the $_POST array. You just need to save them to a text file to see them. (the page - you don’t need to give Yandex: it doesn’t need it)))
At the time of receipt before saving, you can perform any operations with the data (based on the verified payment notification data from Yandex) in your database. For example, update the user's balance for the amount paid, etc.
Notification Authentication and Integrity
One of the notification parameters, sha1_hash, contains the SHA-1 hash value of the notification parameters convolution together with the secret word.
Note.
The secret word for checking notifications is used as a shared secret between Yandex.Money and the application developer. This makes it impossible to fake a notification. The secret word can be obtained in the account settings.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question