I just started to do payments things for my app. So I start with testing this all things. I opened app, put fake card information and in Log chat, app gave me back this.
So I replace YOUR_ACCESS_TOKEN with my access token and all this put in terminal. The terminal gave me back this error.
{“errors”: [{“code”: “UNAUTHORIZED”,“detail”: "Your request did not include an Authorization http header with an access token. The header value is expected to be of the format “Bear
er TOKEN” (without quotation marks), where TOKEN is to be replaced with your access token (e.g. “Bearer ABC123def456GHI789jkl0”).
Since you’re using the sandbox url, did you ensure you copied the sandbox access token and not the production access token? Typically UNAUTHORIZED means you’re using an invalid access token.
Does it work if you use the API Explorer, or a tool like Postman? I think the terminal needs to be told that the command is continuing (by adding \ at the end of the line) so that could be an issue as well.
Honestly not 100% sure how to do curl/multiline commands in Android Studio. Is there a reason you’re trying to do it via terminal rather than via code (creating the HTTP request or using one of our SDKs)?
Based on your last screenshots, with the --header errors, it sounds like it’s still trying to execute them as separate commands, rather than one command but that’s specific to the Android Studio terminal, not to Square. In our In-App Payments SDK example we print out a curl command that should just be copy/paste to the terminal.
I do that in terminal because I am new in this and I just followed steps in tutorial. So now I try do this in app and not in terminal and I will let you know. Thanks