Skip to content

Unable to do refund due to bad requestRazorpay\Api\Errors\ServerError: The server did not send back a well-formed response.  #383

Description

@rishab1788

Steps to reproduce the behavior

Use Refund API -

$payment = $this->razorpay_api->payment->fetch($razorpay_payment_id);
$payment->refund(array("amount" => $amountInSmallestUnit, "speed" => "normal",  "notes"=>array("notes_key_1"=>$refundReason),"receipt" => "Receipt No." . $bookingId));
$refundId = $this->razorpay_api->payment->fetch($razorpay_payment_id)->fetchMultipleRefund()['items'][0]['id'];

here while refund the API fails and give below response it used to work before but now it does not work can some please help me here

Unable to do refund due to bad requestRazorpay\Api\Errors\ServerError: The server did not send back a well-formed response. Server Response: Array in /var/www/html/gearz-vehicle/razorpay-php/src/Request.php:150 Stack trace: #0 /var/www/html/gearz-vehicle/razorpay-php/src/Request.php(219): Razorpay\Api\Request->throwServerError(Array, 404) #1 /var/www/html/gearz-vehicle/razorpay-php/src/Request.php(115): Razorpay\Api\Request->verifyErrorFormat(Array, 404) #2 /var/www/html/gearz-vehicle/razorpay-php/src/Request.php(109): Razorpay\Api\Request->processError(Array, 404, Object(WpOrg\Requests\Response)) #3 /var/www/html/gearz-vehicle/razorpay-php/src/Request.php(58): Razorpay\Api\Request->checkErrors(Object(WpOrg\Requests\Response)) #4 /var/www/html/gearz-vehicle/razorpay-php/src/Entity.php(92): Razorpay\Api\Request->request('POST', 'https://api.raz...', Array) #5 /var/www/html/gearz-vehicle/razorpay-php/src/Entity.php(20): Razorpay\Api\Entity->request('POST', 'refunds/', Array) #6 /var/www/html/gearz-vehicle/razorpay-php/src/Refund.php(17): Razorpay\Api\Entity->create(Array) #7 /var/www/html/gearz-vehicle/razorpay-php/src/Payment.php(52): Razorpay\Api\Refund->create(Array) #8 /var/www/html/gearz-vehicle/includes/classes/payment/OrderRefundProcessor.php(20): Razorpay\Api\Payment->refund(Array) #9 /var/www/html/gearz-vehicle/admin/edit-booking.php(195): OrderRefundProcessor->processRefund('19537', 'pay_PcuYuxicJ8W...', 'boooking succes...', '144') #10
here while refund the API fails and give below response it used to work before but now it does not work can some please help me here

Expected behavior

This api should do the refund instead of throwing error

Actual behavior

thworing error

Code snippets

`Unable to do refund due to bad requestRazorpay\Api\Errors\ServerError: The server did not send back a well-formed response. Server Response: Array in /var/www/html/gearz-vehicle/razorpay-php/src/Request.php:150 Stack trace: #0 /var/www/html/gearz-vehicle/razorpay-php/src/Request.php(219): Razorpay\Api\Request->throwServerError(Array, 404) #1 /var/www/html/gearz-vehicle/razorpay-php/src/Request.php(115): Razorpay\Api\Request->verifyErrorFormat(Array, 404) #2 /var/www/html/gearz-vehicle/razorpay-php/src/Request.php(109): Razorpay\Api\Request->processError(Array, 404, Object(WpOrg\Requests\Response)) #3 /var/www/html/gearz-vehicle/razorpay-php/src/Request.php(58): Razorpay\Api\Request->checkErrors(Object(WpOrg\Requests\Response)) #4 /var/www/html/gearz-vehicle/razorpay-php/src/Entity.php(92): Razorpay\Api\Request->request('POST', 'https://api.raz...', Array) #5 /var/www/html/gearz-vehicle/razorpay-php/src/Entity.php(20): Razorpay\Api\Entity->request('POST', 'refunds/', Array) #6 /var/www/html/gearz-vehicle/razorpay-php/src/Refund.php(17): Razorpay\Api\Entity->create(Array) #7 /var/www/html/gearz-vehicle/razorpay-php/src/Payment.php(52): Razorpay\Api\Refund->create(Array) #8 /var/www/html/gearz-vehicle/includes/classes/payment/OrderRefundProcessor.php(20): Razorpay\Api\Payment->refund(Array) #9 /var/www/html/gearz-vehicle/admin/edit-booking.php(195): OrderRefundProcessor->processRefund('19537', 'pay_PcuYuxicJ8W...', 'boooking succes...', '144') #10
`

Php version

Php v7.2

Library version

2.8.5

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions