Answer the question
In order to leave comments, you need to log in
Can you help with accepting payments on the site?
Hello!
There is a simple task: to embed a form for accepting payments from Yandex.Money into the site page and sending a password for those who paid by email.
I made the form, indicated the mandatory requirement email there.
Created a page that accepts an http request from Yandex after receiving a payment.
Here is the test code:
<?php
$notification_type = $_POST['notification_type']; //p2p-incoming
$operation_id = $_POST['operation_id']; //1234567
$amount = $_POST['amount']; //300.00
$currency = $_POST['currency']; //643
$datetime = $_POST['datetime']; //2011-07-01T09:00:00.000+04:00
$sender = $_POST['sender']; //41001XXXXXXXX
$codepro = $_POST['codepro']; //false
$sha1_hash = $_POST['sha1_hash']; //090a8e7ebb6982a7ad76f4c0f0fa5665d741aafa
file_put_contents("file.txt", $notification_type, FILE_APPEND);
file_put_contents("file.txt", $operation_id, FILE_APPEND);
file_put_contents("file.txt", $amount, FILE_APPEND);
file_put_contents("file.txt", $datetime, FILE_APPEND);
file_put_contents("file.txt", $sender, FILE_APPEND);
?>
Answer the question
In order to leave comments, you need to log in
Library: github.com/melnikovdv/PHP-Yandex.Money-API-SDK
<?php
require_once(dirname(__FILE__) . '/../lib/YandexMoney.php');
$token = ...; // Предварительно полученный токен, можно брать из БД, можно прописать.
//Актуален в течении 3-х лет с момента получения
// ваш код
$ym = new YandexMoney(CLIENT_ID, './ym.log');
$resp = $ym->operationDetail($token, $operation_id);
if ($resp->isSuccess()) {
// Данные получены успешно, можно забирать нужное.
var_dump($resp);
} else {
print "Error: " . $resp->getError();
die();
}
Well, yes, I did just that, but mail does not come from the test request either. It probably needs to be requested in some other way...
The documentation says that contact data is transmitted via HTTPS:
It is recommended to use the HTTPS protocol to receive notifications. Please
note that receiving contact information about the sender in notifications
is only possible when using this protocol. When using the
HTTP protocol, contact information will not be transmitted in the notification.
Maybe that's just the point.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question