首页 > 解决方案 > 使用支付 api 获取 razorpay 上的所有支付详细信息

问题描述

我正在尝试使用支付 API 从 razorpay 帐户中获取所有付款详细信息。我可以通过如下提供付款 ID 来为个人付款这样做

<?php
include "razorpay-php\Razorpay.php";
use Razorpay\Api\Api;
$api = new Api('rzp_live_xxxxxxxxxxxxx', 'xxxxxxxxxxxxxxxxxx');
$payment = $api->payment->fetch('pay_xxxxxxxxxxxxx');
echo $payment->amount;
echo $payment->currency;
?>

但是当我做一个

<?php
$payments = $api->payment->all();
?>

我得到这样的回应

[6]=> object(Razorpay\Api\Payment)#24 (1) { ["attributes":protected]=> array(29) { ["id"]=> string(18) "pay_xxxxxxxxxx" ["entity"]=> string(7) "payment" ["amount"]=> int(1000) ["currency"]=> string(3) "INR" ["status"]=> string(8) "captured " ["order_id"]=> string(20) "order_xxxxxxxx" ["invoice_id"]=> NULL ["international"]=> bool(false) ["method"]=> string(4) "card" ["amount_refunded"]=> int(0) ["refund_status"]=> NULL ["captured"]=> bool(true) ["description"]=> NULL ["card_id"]=> string(19) "card_xxxxxxxxxx" ["bank"]=> NULL ["wallet"]=> NULL ["vpa"]=> NULL ["email"]=> string(22) "xxx@xxx.com " ["contact"]=> 字符串(13) "+xxxxxxxxx" ["notes"]=> 对象(Razorpay\Api\Payment)#25 (1) { ["attributes":protected]=> array(4) { ["title"]=> string(2) "xx" ["institution_or_individual_name"]=> string(12) "xxxxxxx" ["phone"]=> string(10) "xxxxxxxxx" ["email"]=> string(22) "xxxx@xxx.com" } } ["fee"]=> int(20) ["tax"]=> int(0) ["error_code"]=> NULL ["error_description"]=> NULL ["error_source"]=> NULL ["error_step"]=> NULL ["error_reason"]=> NULL ["acquirer_data"]=> 对象(Razorpay\Api\Payment)#26 ( 1){ ["attributes":protected]=> 数组(1){ ["auth_code"]=> 字符串(6)“xxxxx” } } ["created_at"]=> int(1599750807) } }

我无法访问此数组响应中的各个下标。

你能帮我吗。

标签: phprazorpay

解决方案


推荐阅读