0
I got the answer from API
of CIELO
below, now I would like to understand with do to read and store the values.
If anyone can help me with what key information should I store in the database?
object(stdClass)#2 (3) { ["MerchantOrderId"]=> string(16) "2014113245231706" ["Customer"]=> object(stdClass)#3 (1) { ["Name"]=> string(24) "Comprador rec programada" } ["Payment"]=> object(stdClass)#4 (15) { ["ServiceTaxAmount"]=> int(0) ["Installments"]=> int(1) ["Interest"]=> int(0) ["Capture"]=> bool(false) ["Authenticate"]=> bool(false) ["Recurrent"]=> bool(false) ["CreditCard"]=> object(stdClass)#5 (5) { ["CardNumber"]=> string(16) "123412******1231" ["Holder"]=> string(12) "Teste Holder" ["ExpirationDate"]=> string(7) "03/2019" ["SaveCard"]=> bool(false) ["Brand"]=> string(4) "Visa" } ["SoftDescriptor"]=> string(13) "123456789ABCD" ["Provider"]=> string(8) "Simulado" ["Type"]=> string(10) "CreditCard" ["Amount"]=> int(1500) ["Currency"]=> string(3) "BRL" ["Country"]=> string(3) "BRA" ["Status"]=> int(20) ["RecurrentPayment"]=> object(stdClass)#6 (9) { ["RecurrentPaymentId"]=> string(36) "85717927-b438-461b-908f-764772289cb5" ["ReasonCode"]=> int(0) ["ReasonMessage"]=> string(10) "Successful" ["NextRecurrency"]=> string(10) "2015-06-01" ["StartDate"]=> string(10) "2015-06-01" ["EndDate"]=> string(10) "2019-12-01" ["Interval"]=> int(6) ["Link"]=> object(stdClass)#7 (3) { ["Method"]=> string(3) "GET" ["Rel"]=> string(16) "recurrentPayment" ["Href"]=> string(107) "https://apiquerysandbox.cieloecommerce.cielo.com.br/1/RecurrentPayment/8 5717927-b438-461b-908f-764772289cb5" } ["AuthorizeNow"]=> bool(false) } } }
Thank you very much! And if I want the information mapped below: ["Payment"]["Recurrentpayment"]["Startdate"]=> string(10) "2015-06-01", how do I do ?
– Felipe Lima Diniz
Could paste the JSON as it appears in the API?
– Pedro Antônio
Something like that would work ? $xmlString = "my.xml"; $xmlObject = simplexml_load_file($xmlString); $xmltovar = json_decode(json_encode($xmlObject), true); foreach($xmltovar ["Payment"] as $test) { echo $test["Recurrentpayment"]["Startdate"]." <br>"; }
– Felipe Lima Diniz