Answer the question
In order to leave comments, you need to log in
How to change document type in browser?
Good night, colleagues! Please tell me, I'm integrating the site with YandexKassa, I ran into the following problem: The fact is that for Yandex, at one of the payment steps, it is necessary to give an XML response after checking the payment data.
The code of the file that generates the answer for Yandex:
<?php
$responce = getResponse('checkOrder', $_REQUEST['invoiceId'], 0, 'Тест заказа');
sendResponse($responce);
//Функция, формирующая ответ для Яндекса в форме, указанной в документации
function getResponse($functionName, $invoiceId, $result_code, $message = null)
{
try
{
// $performedDatetime = new DateTime()->format($performedDatetime::W3C);
$performedDatetime = date( 'c' );
$response = '<?xml version="1.0" encoding="UTF-8"?><'.$functionName.'Response performedDatetime="'.$performedDatetime.
'" code="'.$result_code.'" '.($message != null ? 'message="' . $message . '"' : "").' invoiceId="'.$invoiceId.'" shopId="150634"/>';
return $response;
} catch(\Exception $e) {
return null;
}
return null;
}
function sendResponse($responseBody) {
header("HTTP/1.0 200");
header("Content-Type: application/xml");
echo $responseBody;
exit;
}
?>
Answer the question
In order to leave comments, you need to log in
Is everything OK. There is no error. Chrome just says that there are no appropriate styles (xslt) to transform XML into a readable form and that you see the bare data, exactly what you need.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question