$payment = $client->createPayment(
(new CreatePaymentRequest())
->setAmount([
'value' => 100.50,
'currency' => 'RUB',
])
->setConfirmation([
'type' => 'redirect',
'return_url' => $confirmationUrl,
])
->setCapture(true)
->setDescription('Оплата заказа')
);
if ($payment->getStatus() === 'waiting_for_capture') {
$confirmationUrl = $payment->getConfirmation()->getConfirmationUrl();
return redirect($confirmationUrl);
} else {
return 'Ошибка при создании тестового платежа: ' . $payment->getStatus() . ' - ' . $payment->getMetadata()->getMessage();
}
}