Answer the question
In order to leave comments, you need to log in
How to send your variables to Yandex.API?
I pay for services from the site using the API in this way
require_once(dirname(__FILE__) . '/lib/YandexMoney.php');
require_once(dirname(__FILE__) . '/consts.php');
require("../config.php");
require("../engine/functions.php");
$code = $_GET['code'];
if (!isset($code)) { // If we are just begginig OAuth
$scope = "payment.to-account(\"410011*********\",\"account\").limit(,1)";
//сюда вместо 1 надо подставить нужную мне сумму для получения разрешения
$authUri = YandexMoney::authorizeUri(CLIENT_ID, REDIRECT_URI, $scope);
header('Location: ' . $authUri);
} else { // when we recieved a temporary code on redirect
$ym = new YandexMoney(CLIENT_ID, './ym.log');
$receiveTokenResp = $ym->receiveOAuthToken($code, REDIRECT_URI, CLIENT_SECRET);
if ($receiveTokenResp->isSuccess()) {
$token = $receiveTokenResp->getAccessToken();
} else {
die();
}
$resp = $ym->requestPaymentP2P($token, "410011*********", "1");
// сюда вместо 1 надо подставить нужную мне сумму для оплаты
print "<p class=\"output\">";
if ($resp->isSuccess()) {
//var_dump($resp);
} else {
print "Error: " . $resp->getError();
die();
}
print "</p>";
$requestId = $resp->getRequestId();
$resp = $ym->processPaymentByWallet($token, $requestId);
print "<p class=\"output\">";
if ($resp->isSuccess()) {
$q="UPDATE payment SET status=1,code='$code' WHERE id='$_GET[id_pay]'";
mysql_query($q);
header('location: ../success.php');
} else {
header('location: ../fail.php');
}
Answer the question
In order to leave comments, you need to log in
You are using some YandexMoney library.
Look at her code.
In general, of course, you can transfer your parameters in the API description.
api.yandex.ru/money/doc/dg/reference/request-payme...
$q="UPDATE payment SET status=1,code='$code' WHERE id='$_GET[id_pay]'";
mysql_query($q);
It makes me want to kill to be honest. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question