Hi there, I’m using PHP and the curl_init function to try to run the Retrieve Subscription API call. Here is my code:
$curl_url = "https://connect.squareup.com/v2/subscriptions/" . $subscriptionID; system_log("curl_url is $curl_url"); if (($subscriptionID != "") && ($curl_url != "")) { $ch = curl_init($curl_url); curl_setopt_array($ch, array( CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HTTPHEADER => array( 'Square-Version: 2023-09-25', 'Authorization: Bearer ' . $GLOBALS['square_access_token'], 'Content-Type: application/json' ) )); $response = curl_exec($ch); system_log("response is $response"); }
system_log is just a simple function I have to log information to the database. The $response I’m constantly getting is:
{
“errors”: [{
“category”: “INVALID_REQUEST_ERROR”,
“code”: “NOT_FOUND”,
“detail”: “Resource not found.”
}]
}
I have verified that the $subscriptionID variable is being passed in correctly, and the $curl_url value is correctly being set. I’ve also verified that the $subscriptionID is valid using the API Explorer, where I get valid data returned.
I’m using the API to make far more complicated calls, using the exact same code format, so I’m at a complete loss as to why (what should be) the simplest call that I have to make is failing…
Thank you in advance for your help!