I
I
iamdivine2021-05-05 09:55:44
Laravel
iamdivine, 2021-05-05 09:55:44

How to parse response from qiwi p2p in laravel?

Good afternoon, I make a qiwi p2p payment, after payment, the notification of the norms comes

[2021-05-05 09:49:57] laravel.EMERGENCY: array (
  'bill' => 
  array (
    'siteId' => 'vgtvw5-00',
    'billId' => '7bb758214f34a49ee18bd227d1b4480c',
    'amount' => 
    array (
      'value' => '10.00',
      'currency' => 'RUB',
    ),
    'status' => 
    array (
      'value' => 'PAID',
      'changedDateTime' => '2021-05-05T09:49:42+03',
    ),
    'customer' => 
    array (
      'account' => '165685444',
    ),
    'customFields' => 
    array (
      'apiClient' => 'php_sdk',
      'CHECKOUT_REFERER' => 'testshop',
      'apiClientVersion' => '0.1.2',
    ),
    'comment' => NULL,
    'creationDateTime' => '2021-05-05T09:48:33+03',
    'expirationDateTime' => '2021-06-19T09:48:33+03',
  ),
  'version' => '1',
)

I want to write data to the database that Qiwi sends after payment
public function qiwiapi(Request $r) {
            QiwiPayment::create([
                'number' => NULL,
                'status' => $r->bill->status->value,
                'user_id' => $r->bill->customer->account,
                'profit' => $r->bill->amount->value,
                'billID' => $r->bill->billId,
                'paySourcesFilter' => NULL
        ]);
        Log::emergency($r);

    }

but getting errors when getting data
[2021-05-05 09:54:44] laravel.ERROR: Trying to get property 'status' of non-object {"exception":"[object] (ErrorException(code: 0): Trying to get property 'status' of non-object at

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2021-05-05
@iamdivine

Why did you decide that the standard Request object in bill will give you some object?
There is an array and you need to work with it as with an array. And there is no need to parse anything here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question