Answer the question
In order to leave comments, you need to log in
How to process JSON data received via cURL from qiwi site?
Hi,
I'm trying to make a simple form to check for a specific payment.
For this purpose, I am trying to carry out this GET
https://developer.qiwi.com/sandbox/index.html#!/pa...
Current code ..
<?php
$url = 'https://edge.qiwi.com/payment-history/v2/transactions/00000000002?type=OUT';
$parameters = array(
"statusText" => $statusText,
"comment" => $comment,
"date" => $date,
"comment" => $comment,
"pay_source" => "qw"
);
$headers = array(
"Accept: application/json",
"Authorization: Bearer dgr35h9fsyhdgrgfbjk543ecc474d5e9",
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_POST, 1);
$httpResponse = curl_exec($ch);
$results = json_decode($httpResponse);
$result_code = $results->response->result_code;
$description = $results->response->description;
echo($httpResponse);
?>
{"txnId":00000000002,"personId":79180007000,"date":"2020-10-15T16:15:56+03:00","errorCode":0,"error":null,"status":" SUCCESS","type":"OUT","statusText":"Success","trmTxnId":"1038309102906","account":"+79180007000","sum":{"amount":36.43,"currency" :643},"commission":{"amount":0.00,"currency":643},"total":{"amount":36.43,"currency":643},"provider":{"id":99 ,"shortName":"Transfer to QIWI Wallet","longName":null,"logoUrl":" https://static.qiwi.com/img/providers/logoBig/99_l... , transfer, qiwi, wallet, pay,online, payment, invoice, method, service, transfer","siteUrl":" https://www.qiwi.com","extras":[{"key":"seo_descri...QIWI Wallet with a bank card without commission from 2000 rubles, from a mobile phone account or in cash through QIWI Terminals. Paying for services has become easier."},{"key":"seo_title","value":"Top up QIWI Wallet: from a bank card, from a phone balance, through a QIWI Wallet"}]},"source":{"id" :7,"shortName":"QIWI Wallet","longName":"QIWI Wallet","logoUrl":null,"description":"
An exclusive code for Internet banks has been created:
ID 36271 (with FON LLC) special rate 3% for Tinkoff Bank from DS 18 k dog ek 7023/2016
ID 36754 (with Santorin LLC) special rate 7% for Home Credit Bank from DS 12 k dog ek 7022/2016
","keys":"mobile wallet, wallet, transfer money, personal account, send money, transfer between users","siteUrl":null,"extras":[]},"comment":"to myself"," currencyRate":1,"paymentExtras":[{"id":605,"name":"account","value":"+79180007000","title":"Recipient phone number"}],"features": {"checkReady":true,"bankDocumentReady":false,"regularPaymentEnabled":true,"bankDocumentAvailable":false,"repeatPaymentEnabled":true,"favoritePaymentEnabled":true,"chatAvailable":false,"greetingCardAttached":false}, "serviceExtras":{"comment":"to myself","language":"en","account":"+79180007000"},"view":{"title":"Transfer to QIWI Wallet","account":"+79180007000"}}
Answer the question
In order to leave comments, you need to log in
$results = json_decode($httpResponse);
$result_code = $results->response->result_code;
$description = $results->response->description;
Вот же ответ
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question