Arul Prasad J
Arul Prasad J

Reputation: 25

Razorpay not returning payment id using order id

I need razorpay_payment_id using razorpay_order_id. But,

When I use this the response is

$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

null

$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]
...

Not getting payment id and payment details.

Upvotes: 1

Views: 5000

Answers (2)

shubomb
shubomb

Reputation: 832

I got solution by using this

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

print_r($payment->contact);

Upvotes: 0

aishwarya
aishwarya

Reputation: 272

I think you can easily get the payment details as a single dimensional array using -

$api->payment->fetch($id) 

where $id is the razorpayment_id instead you are using long solution .

Upvotes: 2

Related Questions