problem with listing items of this object

Asked

Viewed 166 times

4

I’m having a problem getting the data received from the payment order from pagseguro. I’m doing the consultation he’s bringing me the results but I can’t get what’s inside the paymentOrders for the simple fact that he brings me a code together someone would know how to solve it?

down with the return

stdClass Object
(
    [date] => 2018-05-03T14:13:44-03:00
    [resultsInThisPage] => 2
    [currentPage] => 1
    [totalPages] => 1
    [paymentOrders] => stdClass Object
        (
            [98ECCE252FFE40FBAF8A143BF6B7C77A] => stdClass Object
                (
                    [code] => 98ECCE252FFE40FBAF8A143BF6B7C77A
                    [status] => 1
                    [amount] => 75
                    [grossAmount] => 0
                    [lastEventDate] => 2018-04-08T16:01:26-03:00
                    [schedulingDate] => 2018-05-08T06:01:24-03:00
                    [transactions] => Array
                        (
                        )

                    [discount] => stdClass Object
                        (
                            [type] => DISCOUNT_PERCENT
                            [value] => 0
                        )

                )

            [CBA68FE94E0B49069397562DF8238AD9] => stdClass Object
                (
                    [code] => CBA68FE94E0B49069397562DF8238AD9
                    [status] => 2
                    [amount] => 75
                    [grossAmount] => 75
                    [lastEventDate] => 2018-04-08T16:01:26-03:00
                    [schedulingDate] => 2018-04-08T16:01:24-03:00
                    [transactions] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [code] => BDEB784FE176479BA9844976DEC8B5D3
                                    [date] => 2018-04-08T16:01:24-03:00
                                    [status] => 1
                                )

                        )

                    [discount] => stdClass Object
                        (
                            [type] => DISCOUNT_PERCENT
                            [value] => 0
                        )

                )

        )

)
   

1 answer

1

Uses a foreach()

foreach($resultados->paymentOrders as $key => $value){
    var_dump($value);
    //ou abstrai as informações
    $code[$key]=$value;
}
  • I tried to use as you described foreach($resOrders->paymentOrders as $key => $value){ var_dump($value); } but give me the following error Trying to get property of non-object and also Invalid argument supplied for foreach()

  • although it may be because the sandbox is under maintenance and will return only at 19 if Oce is testing in sandbox and clear.

  • I will check here, I also use pagseguro, but I created a class for the functionalities, so warning here.

  • and... I’m testing in sandbox and I think that might be it, because I came back with the code that was before and has the same mistake

  • I used the example code you posted here, and the foreach worked correctly. I’ll do a test straight from the sandbox, you’re doing the search by date range?

  • I am no longer using that url https://ws.sandbox.pagseguro.uol.com.br/pre-approvals/{preApprovalCode}/payment-orders?email=suporte%40lojamodelo.com.br&token=57BE455F4EC148E5A54D9BB91C5AC12C and with the result of it I want to take the right payment orders one by one to be shown

  • try that one https://ws.sandbox.pagseguro.uol.com.br/pre-approvals/payment-orders?email=suporte%40lojamodelo.com.br&token=57BE455F4EC148E5A54D9BB91C5AC12C without the asdas/

  • intao but I need his code to show the client who effected this signature if I leave without will show all of there I do not want to show tds the orders of the client in question

  • return of your query is in xml?

  • it is not json the return

Show 5 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.