I am new to using Square APIs and am attempting to integrate the PHP version of the API into a website.
I have followed the instructions on their site to the best of my ability, utilizing Sandbox credentials including the location ID. The payment form is created, I fill in the form using the fake credit card information provided in the documentation, I receive the javascript alert indicating the nonce has been created, but receive the following error:
Caught exception!
Response body: null
Response headers: null
Can you please provide me with some guidance on how to fix this?
Square Connect Only allows connections from secure sites. Make sure your site has ssl certificate installed.
My guess is you are testing on localhost, in that case you try to generate the self signed certificate. Although I dint try generating my own certificate. I just tested it on live website with ssl certificate and that error was gone.
If you are using the php api v2 sample try printing out the full response by placing print_r($e); in the catch block and view the full description of your errors. Thats how I figured out the problem.
Hope it helps.
Related
Have been struggling to connect to Google API
via PHP using Service Account. If to use examples provided by API (link) and google developers site itself (or any other source from google searches), I'm getting the error
{
"error": "invalid_grant",
"error_description": "Invalid JWT Signature."
}
And if to search how to connect using JWT as well, there are only JS or JAVA or PYTHON examples.
Any real experience out there how to correctly get the connection?
I have:
service account set up and allowed to use Search Console (and analytics)
set up the API to server
added service account address to Search Console for site we need the data from
downloaded and added the key file.
All goes well till I start making the actual request for data. Then the JWT error appears.
ANY input is appreciated!
Got solution by removing service account from google console and created new.
I am trying to create code for sending document for signature request using docusign API:
I already downloaded the PHP SDK
I already opened a developer sandbox account
But after filling in some info in the PHP SDK file and run, it gave me the above error.
I am guessing the error may mean that I have not gone through the steps to configure client and request authorization code.
I tried to follow the steps on that page, but the instructions are so vague and difficult to follow. I clicked on the 'use sandbox account data' on the upper right corner of the C# code, but it only asked me to log in to my account and directed me back to the same page.
I don't know where to start from there.
I need a more step-by-step instruction.
Thanks
#T. Nguyen 401 translates to an unauthorized API request and the response should say which part is wrong aka the username / password or Integrator Key is incorrect.
I really suggest using PostMan Client and / or SoapUI to validate you can get login information and see the actual error returned, as it will say Integrator Key or Username/Password in the response. PostMan or SoapUI will issue the actual API calls successfully (Demo or Prod once you have passed prod API certification) showing you the actual response without having to worry about coding typo's, properties of objects or debugging logging to see what really came back.
This allows you to learn the DocuSign API while using the PHP SDK. You did the right thing asking for help here on Stack Overflow.
I have a couple links for you to get started:
DocuSign Developer Center where you probably found the PHP SDK https://developers.docusign.com/esign-rest-api/sdk-tools
Link for info on PostMan (older version, you can get the latest one - aka Orange Rocket Man logo vs blue world, for Chrome or Mac Standalone - https://blog.grigsbyconsultingllc.com/postman-rest-client-a-google-chrome-app/
X-DocuSign-Authentication Header Q&A on StackOverflow How should the header X-DocuSign-Authentication be used for REST and SOAP?
I like the concept of the DocuSign API explorer to start with, sad part is it doesn't work against prod, so you still have to use something else when you move from demo to prod.
Best of Luck and Enjoy your DocuSign API journey!
You can set $config->setDebug(true) in dev environment and have all the errors displayed.
to fetch error use this
try{
//send request
}
catch (DocuSign\eSign\ApiException $ex){
print_R($ex); //<--- print normal readeble error
echo "Exception: " . $ex->getMessage() . "\n";
}
I am using the PHP version of the Google Glass Developer Kit. Setup everything per the sample code instructions. API/credentials are all fine, account billing is setup, have added the Mirror API to the project, but after I permission the application, I get the following Error:
An error ocurred: Error calling POST
https://www.googleapis.com/mirror/v1/timeline?key=xxxxxx
(403) Access Not Configured.
Please use Google Developers Console to activate the API for your project.
I have added the Mirror API and have Billing active and setup so have no idea why i am getting the error message. Testing the app via the Glass Explorer works just fine.
Google APIs have been known to misbehave when you provide both OAuth2 credentials and an API Key. Also since you have to use OAuth2 to access the Mirror API, the key=xxxxx isn't necessary anyway.
If you are using the Google APIs Client Library for PHP you can simply remove the following line from your code:
$client->setDeveloperKey($key);
Not entirely sure if this causes your issue, but I have come across similar issues in other Google APIs.
In Google API console for your project (https://code.google.com/apis/console/)
Make sure that your "Public API access" or "Key for server application" has allowed the IP address of your server.
Also make sure you have the proper "Redirect URIs", if you get refused, look at your php logs, I had this:
PHP Fatal error: Uncaught exception 'Google_ServiceException' with message 'Error calling GET https://www.googleapis.com/mirror/v1/timeline?maxResults=3&key=: (403) Access Not Configured. Please use Google Developers Console to activate the API for your project.'
use your $base_url + /oauth2callback.php to find out what the correct Redirect URI is.
I managed to solve the issue by adding the IP address and REDIRECT URIs and it runs both on my local machine and on the server. (same code, same key)
PS: I want to thank Scarygami, disabling the $client->setDeveloperKey($key); helped me find the solution.
I am using Adwords API from last 3 months and all of a sudden today it is coming up with error message as follows:
Uncaught exception 'AuthTokenException' with message 'Failed to get authToken. Reason: BadAuthentication'
I am using google adwords V201101 php library with auth.ini containing all user details and settings.ini with https://adwords.google.com not sandbox environment. Can anyone help me with this please???
Thanks,
Murali.
you may requesting authToken from ClientLogin service too many times, that is way you get 'CaptchaRequired'.
Request authToken just for the first time, and then cache it for subsequent requests.
Check this out http://goo.gl/TOX6N
I recently had this problem trying to connect to Google DFP. I copied perfectly working code from my localhost after development and ran it on my remote cloud server. I then received the
Failed to get authToken
message. The reason was that google was blocking the attempted login as a security measure because it was a new location. I had to log into the google account (from the web) with those credentials in order to see the message and confirm the added login location. Everything worked fine after that authorization.
I've stumbled across this question and thought that this info may help someone else.
BadAuthentication means your username/password is incorrect. May be someone changed the account password, may be auth.ini got modified by mistake.
See detailed error codes here: http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#Errors
Cheers,
Anash
I started getting this error after somebody in my organization updated the password for the account my app was using to log in. The best way to avoid this happening again is to use OAuth2.
It's as easy as going to the Google API console and creating a Client ID for Installed Applications (under API access) for your project. You then use the Client ID and Client Secret in your Adwords API auth.ini file.
Next you run the examples/AdWords/Auth/GetRefreshToken.php script which will have you grant your app access to your Adwords account. You'll end up with a Refresh Token which you need to add to your auth.ini.
The ClientLogin (username and password) method of authentication is being deprecated in favour of the above so best to migrate ASAP.
I want to implement Google Checkout in my PHP project (running on Apache). I put the callback URL in my merchant center account. My Checkout is in sandbox mode. When placing an order I get the following error message in my merchant center:
We encountered an error trying to access your server at myurl.org -- the error we got is
Send failed with code: 401.
Response body was: Failed to Get Basic Authentication Headers
Since neither version of this question has been addressed, I figure I'll add some advice to the one I edited:
I'm not at all familiar with Google Checkout and its API, but a quick Wikipedia search for HTTP error informs me that a 401 error is because authentication has failed. Note, this is not the same as the authentication being rejected (error 403: Forbidden) but rather that the actual attempt to authenticate failed. A good analogy might be to imagine going to a door, being asked for the secret password (which we'll say is Fedelio) and instead of saying "Applesauce" and getting beat up for trespassing (error 403) instead you respond with "Huh?" and the gate keeper simply stands there wondering if you even know what he meant by password.
The same wiki article refers to Basic Authentication in relationship to this error. I highly reccommend taking a look into that as well.
Long story short, your users need to authenticate when the URL is requested, but it sounds like you are trying to request the site server-side or through some kind of redirect, so the server is returning the 401 error instead of returning a login prompt.