Как получить данные с массива API яндекс кассы?

Здравствуйте, создаю платеж вот таким кодом

use YandexCheckout\Client;

    $client = new Client();
    $client->setAuth('000000', 'test_UBynaQ4beNmiGv5Rz8CaOjn');
    $payment = $client->createPayment(
        array(
            'amount' => array(
                'value' => 500.0,
                'currency' => 'RUB',
            ),
            'confirmation' => array(
                'type' => 'redirect',
                'return_url' => 'https://www.merchant-website.com/return_url',
            ),
            'capture' => true,
            'description' => 'Заказ №1',
            'metadata' => array(
                'order_id' => '37',
            )
        ),
        uniqid('', true)
    );


При выводе print_r получаю:
YandexCheckout\Request\Payments\CreatePaymentResponse Object ( [_id:YandexCheckout\Model\Payment:private] => 251d67aa-000f-5000-9000-172[_status:YandexCheckout\Model\Payment:private] => pending [_recipient:YandexCheckout\Model\Payment:private] => YandexCheckout\Model\Recipient Object ( [_accountId:YandexCheckout\Model\Recipient:private] => 000000 [_gatewayId:YandexCheckout\Model\Recipient:private] => 1627085 [unknownProperties:YandexCheckout\Common\AbstractObject:private] => Array ( ) ) [_amount:YandexCheckout\Model\Payment:private] => YandexCheckout\Model\MonetaryAmount Object ( [_value:YandexCheckout\Model\MonetaryAmount:private] => 50000 [_currency:YandexCheckout\Model\MonetaryAmount:private] => RUB [unknownProperties:YandexCheckout\Common\AbstractObject:private] => Array ( ) ) [_description:YandexCheckout\Model\Payment:private] => Заказ №1 [_paymentMethod:YandexCheckout\Model\Payment:private] => [_createdAt:YandexCheckout\Model\Payment:private] => DateTime Object ( [date] => 2019-09-25 11:47:54.736000 [timezone_type] => 2 [timezone] => Z ) [_capturedAt:YandexCheckout\Model\Payment:private] => [_confirmation:YandexCheckout\Model\Payment:private] => YandexCheckout\Model\Confirmation\ConfirmationRedirect Object ( [_enforce:YandexCheckout\Model\Confirmation\ConfirmationRedirect:private] => [_returnUrl:YandexCheckout\Model\Confirmation\ConfirmationRedirect:private] => [_confirmationUrl:YandexCheckout\Model\Confirmation\ConfirmationRedirect:private] => https://money.yandex.ru/api-pages/v2/payment-confirm/epl?orderId=251d67aa-000f-5000-9000-172 [_type:YandexCheckout\Model\Confirmation\AbstractConfirmation:private] => redirect [unknownProperties:YandexCheckout\Common\AbstractObject:private] => Array ( ) ) [_refundedAmount:YandexCheckout\Model\Payment:private] => [_paid:YandexCheckout\Model\Payment:private] => [_refundable:YandexCheckout\Model\Payment:private] => [_receiptRegistration:YandexCheckout\Model\Payment:private] => [_metadata:YandexCheckout\Model\Payment:private] => YandexCheckout\Model\Metadata Object ( [unknownProperties:YandexCheckout\Common\AbstractObject:private] => Array ( [order_id] => 37 ) ) [_expiresAt:YandexCheckout\Model\Payment:private] => [_cancellationDetails:YandexCheckout\Model\Payment:private] => [_authorizationDetails:YandexCheckout\Model\Payment:private] => [_test:YandexCheckout\Model\Payment:private] => 1 [unknownProperties:YandexCheckout\Common\AbstractObject:private] => Array ( ) )


Как мне получить данную ссылку для редиректа: https://money.yandex.ru/api-pages/v2/payment-confi... ?
  • Вопрос задан
  • 315 просмотров
Решения вопроса 1
TTATPuOT
@TTATPuOT
https://code.patriotovsky.ru/
$payment->getConfirmation()->getConfirmationUrl(); //Это и будет ваша ссылка
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы