$create_payment_request ?
tried writing the value to the the console and its like its not even hitting the process-payment.php
Right its $create_payment_request. Are you able to print the request body that it builds? ![]()
error_log(“start1”);
error_log($create_payment_request);
error_log(“end1”);
produces this in the php error log
[22-Mar-2023 23:47:04 UTC] -------------------------------------------------------------------------------------------------
[22-Mar-2023 23:47:04 UTC] start1
[22-Mar-2023 23:47:04 UTC] PHP Warning: error_log() expects parameter 1 to be string, object given in D:\vhosts\nac-issa.org\httpdocs\SquareEcom2\process-payment.php on line 72
[22-Mar-2023 23:47:04 UTC] end1
[22-Mar-2023 23:47:04 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to Square\ApiHelper::appendUrlWithTemplateParameters() must be of the type string, null given, called in D:\vhosts\nac-issa.org\httpdocs\SquareEcom2\vendor\square\square\src\SquareClient.php on line 304 and defined in D:\vhosts\nac-issa.org\httpdocs\SquareEcom2\vendor\square\square\src\ApiHelper.php:47
Stack trace:
#0 D:\vhosts\nac-issa.org\httpdocs\SquareEcom2\vendor\square\square\src\SquareClient.php(304): Square\ApiHelper::appendUrlWithTemplateParameters()
#1 D:\vhosts\nac-issa.org\httpdocs\SquareEcom2\vendor\square\square\src\Apis\PaymentsApi.php(163): Square\SquareClient->getBaseUri()
#2 D:\vhosts\nac-issa.org\httpdocs\SquareEcom2\process-payment.php(75): Square\Apis\PaymentsApi->createPayment()
#3 {main}
thrown in D:\vhosts\nac-issa.org\httpdocs\SquareEcom2\vendor\square\square\src\ApiHelper.php on line 47
Whats on \process-payment.php on line 72? ![]()
error_log(“start1”);
error_log(strval( $create_payment_request));
error_log(“end1”);
ok got it to print to log…
Square\Models\CreatePaymentRequest Object
(
[sourceId:Square\Models\CreatePaymentRequest:private] => cnon:CBESEFtRO_N50XJl5M3izXyk3Ec
[idempotencyKey:Square\Models\CreatePaymentRequest:private] => 309504d6-12d3-44dc-aa9b-803b2794e947
[amountMoney:Square\Models\CreatePaymentRequest:private] => Square\Models\Money Object
(
[amount:Square\Models\Money:private] => 100
[currency:Square\Models\Money:private] => USD
)
[tipMoney:Square\Models\CreatePaymentRequest:private] =>
[appFeeMoney:Square\Models\CreatePaymentRequest:private] =>
[delayDuration:Square\Models\CreatePaymentRequest:private] =>
[autocomplete:Square\Models\CreatePaymentRequest:private] =>
[orderId:Square\Models\CreatePaymentRequest:private] =>
[customerId:Square\Models\CreatePaymentRequest:private] =>
[locationId:Square\Models\CreatePaymentRequest:private] => 67DE3EQ108NQZ
[teamMemberId:Square\Models\CreatePaymentRequest:private] =>
[referenceId:Square\Models\CreatePaymentRequest:private] =>
[verificationToken:Square\Models\CreatePaymentRequest:private] =>
[acceptPartialAuthorization:Square\Models\CreatePaymentRequest:private] =>
[buyerEmailAddress:Square\Models\CreatePaymentRequest:private] =>
[billingAddress:Square\Models\CreatePaymentRequest:private] =>
[shippingAddress:Square\Models\CreatePaymentRequest:private] =>
[note:Square\Models\CreatePaymentRequest:private] =>
[statementDescriptionIdentifier:Square\Models\CreatePaymentRequest:private] =>
[cashDetails:Square\Models\CreatePaymentRequest:private] =>
[externalDetails:Square\Models\CreatePaymentRequest:private] =>
)
the php then crashes on this line
$response = $payments_api->createPayment($create_payment_request);
Is it the JSON error crash at this point? ![]()
Yeah it is. It crashes and produces that error in the console.