Razorpay 不使用订单 ID 返回付款 ID

Razorpay not returning payment id using order id

我需要 razorpay_payment_id 使用 razorpay_order_id。但是,

当我使用它时,响应是

$order = $api->order->fetch("order_xxxxxxxxxx")->payments;
var_dump($order);

enter image description here

Notice: Undefined index: payments in D:\wamp\www\xxxxxxxxxx\xxxxxxxx\razorpay-php\src\Resource.php on line 40
Call Stack
#   Time    Memory  Function    Location
1   0.0010  139848  {main}( )   ..\test.php:0
2   3.0040  772824  Razorpay\Api\Resource->__get( ) ..\test.php:981

$order = $api->order->fetch("order_xxxxxxxxxx")->payments();
var_dump($order);

object(Razorpay\Api\Collection)[8]
protected 'attributes' => 
array (size=3)
'entity' => string 'collection' (length=10)
'count' => int 1
'items' => 
array (size=1)
0 => 
object(Razorpay\Api\Payment)[10]
...

未获取付款 ID 和付款详细信息。

我认为您可以使用 -

以一维数组的形式轻松获取付款详细信息
$api->payment->fetch($id) 

其中 $id 是 razorpayment_id 而不是您使用的是长解决方案。

我用这个得到了解决方案

$payment = $api->payment->fetch($_REQUEST['razorpay_payment_id']) ;;

print_r($payment->contact);