Solve: Object of class stdClass could not be converted to string WHMCS

On your WHMCS payment gateway, if you face issues like this

Oops!
Something went wrong and we couldn't process your request.

Please go back to the previous page and try again.

For additional assistance, please reference the WHMCS TroubleShooting Guide »

Error: Object of class stdClass could not be converted to string in /home/yourdomain/whmcs.yourdomain.com/modules/gateways/aamarpay.php:309
Stack trace:
#0 /home/yourdomain/whmcs.yourdomain.com/vendor/whmcs/whmcs-foundation/lib/Module/AbstractModule.php(0): aamarpay_link(Array)
#1 /home/yourdomain/whmcs.yourdomain.com/vendor/whmcs/whmcs-foundation/lib/Module/Gateway.php(0): WHMCS\Module\AbstractModule->call('link', Array)
#2 /home/yourdomain/whmcs.yourdomain.com/vendor/whmcs/whmcs-foundation/lib/Invoice.php(0): WHMCS\Module\Gateway->call('link', Array)
#3 /home/yourdomain/whmcs.yourdomain.com/modules/addons/RSThemes/hooks.php(146): WHMCS\Invoice->getPaymentLink()
#4 /home/yourdomain/whmcs.yourdomain.com/templates/lagom2/invoicepdf.tpl(7): invoiceVars(Array)
#5 /home/yourdomain/whmcs.yourdomain.com/vendor/whmcs/whmcs-foundation/lib/Invoice.php(0): unknown()
#6 /home/yourdomain/whmcs.yourdomain.com/vendor/whmcs/whmcs-foundation/lib/Invoice.php(0): WHMCS\Invoice->pdfAddPage('invoicepdf.tpl', Array)
#7 /home/yourdomain/whmcs.yourdomain.com/vendor/whmcs/whmcs-foundation/lib/Mail/Entity/Invoice.php(0): WHMCS\Invoice->pdfInvoicePage()
#8 /home/yourdomain/whmcs.yourdomain.com/vendor/whmcs/whmcs-foundation/lib/Mail/Emailer.php(0): WHMCS\Mail\Entity\Invoice->getEntitySpecificMergeData(27754, Array)
#9 /home/yourdomain/whmcs.yourdomain.com/vendor/whmcs/whmcs-foundation/lib/Mail/Emailer.php(0): WHMCS\Mail\Emailer->prepare()
#10 /home/yourdomain/whmcs.yourdomain.com/includes/functions.php(0): WHMCS\Mail\Emailer->send()
#11 /home/yourdomain/whmcs.yourdomain.com/includes/orderfunctions.php(0): sendMessage('Invoice Created', 27754)
#12 /home/yourdomain/whmcs.yourdomain.com/cart.php(0): calcCartTotals(Object(WHMCS\User\Client), true, false)
#13 {main}

Then you will have to find jsondecode or $url_decode = json_decode line on your payment gateway file and add , TRUE  with that line.

$url_decode = json_decode($result, TRUE);

It should solve your issue.

Leave a Comment