I am implementing a "View Invoice PDF" feature on my webpage, allowing users to access their invoice PDFs via the following Square Sandbox URL:
https://app.squareupsandbox.com/invoices/{invoiceId}/attachments/pdf?inline=true
Currently, this functionality works if I am logged into the Square Dashboard on the same browser. However, when accessed from a different browser or by an unauthenticated user, the following authentication error occurs:
{
"errors": [
{
"category": "AUTHENTICATION_ERROR",
"code": "UNAUTHORIZED",
"detail": "This request could not be authorized."
}
]
}
This prevents users from viewing and downloading their invoice PDFs unless they are logged into Square. Is there a way to resolve this issue, or is authentication a strict requirement for accessing invoice attachments?
Best regards,
Hi @aZticot !
My recommendation would be to ask this question over in the Square Developer's Forum. Most of the moderators here are not super familiar with coding or APIs.
I think one of my friends @JTPets may have some insight, but not sure.
Sorry i could not be of more assistance, but the developer's forum will probably get you set in the right direction.
Hi @aZticot !
My recommendation would be to ask this question over in the Square Developer's Forum. Most of the moderators here are not super familiar with coding or APIs.
I think one of my friends @JTPets may have some insight, but not sure.
Sorry i could not be of more assistance, but the developer's forum will probably get you set in the right direction.
I am not a developer and I have very little code skill myself. However it appears that you are using the sandbox which is for testing and not live production.
Change your urls and ensure you use a production api key and url
I use AI for a lot of my own Square API issues, here is what the AI says as an additional reply:
The issue here is that Square's invoice PDF URLs are not publicly accessible and require authentication to view. This means:
I appreciate you @JTPets !
Square Community
Square Products