Answer the question
In order to leave comments, you need to log in
How to pull out the Yandex checkout response bodies in the symphony controller?
I'm trying to integrate Yandex checkout using Yandex api I
generated a secret key
I successfully sent a test payment, but I just can't get the response body from the Yandex checkout server ,
for some reason everything is empty there
:), what are the options?
the response comes from the server in json, maybe because of this
controllers
public function newYandexPayAction(Request $request)
{
$config_ym = self::configYM();
$client = new Client();
$client->setAuth($config_ym->shopId, $config_ym->yandexKey);
$response = $client->createPayment(array(
'amount' => array(
'value' => '20.00',
'currency' => 'RUB',
),
'payment_method_data' => array(
'type' => 'bank_card',
),
'confirmation' => array(
'type' => 'redirect',
'return_url' => 'http://127.0.0.1:8000/ym/response',
),
'description' => 'описание платежа'
)
);
$redirectToYandexForPayment = $response->confirmation->confirmationUrl;
return $this->render('@App/Pay/without_session.html.twig',
array(
'yandex_client' => $redirectToYandexForPayment
)
);
}
public function checkUrlAction(Request $request)
{
$response = $request->getContent();
return $this->render('@App/Yandex/ym_return.twig', array('data' => $response));
}
Answer the question
In order to leave comments, you need to log in
From the documentation (exactly your case):
Finally, the raw data sent with the request body can be accessed using getContent():
$content = $request->getContent();
For instance, this may be useful to process a JSON string sent to the application by a remote service using the HTTP POST method.
See https://symfony.com/doc/current/components/http_fo...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question