Checkout session returns private data

This may be user misunderstanding… I am trying to implement a quick pay link for our website in the Sandbox. I’ve tried the data in the API tester and it gives me a result, but when I try it on my server, it returns a private array and any attempt to access it gives the error “Uncaught Error: Cannot access private property Square\Models\CreatePaymentLinkResponse”

My code is below (I’ve hidden the location id):

$price_money = new \Square\Models\Money();

$quick_pay = new \Square\Models\QuickPay(
‘Tickets x 2’,

$checkout_options = new \Square\Models\CheckoutOptions();

$sik = ‘tct-’.uniqid();

$body = new \Square\Models\CreatePaymentLinkRequest();

$api_response = $client->getCheckoutApi()->createPaymentLink($body);

I get a full response, headed by:
[errors:Square\Models\CreatePaymentLinkResponse:private] =>

Any assistance gratefully received


The error you’re facing seems to be related to trying to access the private property errors within the Square\Models\CreatePaymentLinkResponse class. Since this property is marked as private, you can’t directly access it from outside the class.

To handle the response, you should use the public methods or getters provided by the CreatePaymentLinkResponse class. :slightly_smiling_face:

Hi Bryan
Thanks for that - not sure I understand though. I’ve used the API tester to generate the code so not sure what additional steps I need to take.
I’ve extensively looked at the documentation but am still unclear.
Perhaps time to give up!

When you say API tester do you mean our API Explorer? If so on your server did you setup the SDK properly? Cause all of the examples from the API Explorer use the SDK if there not CURL. :slightly_smiling_face: