I am attempting to create a REST integration with Square (https://developer.squareup.com), but am receiving a 302 Found error when I attempt to send a webhook via Square.
My API is working successfully when tested through Workbench with the payload that is being sent via Square, at the URI of /services/apexrest/[SOBJECTNAME]/[RESTRESOURCENAME]
.
My endpoint URL is as follows:
https://ORGNAME--partial.lightning.force.com/services/apexrest/[SOBJECTNAME]/[RESTRESOURCENAME]
which generates a 302 Found error, meaning that the endpoint is redirecting. I am unable to process the redirect via Square.
I have tried playing around with different base URLs for the endpoint per the Salesforce documentation and other forum posts, for example ORGNAME--partial.my.salesforce.com
(401 unauthorized), ORGNAME--partial.INSTANCE.my.salesforce.com
(307 redirect), and ORGNAME--partial.INSTANCE.force.com
(401 unauthorized) to no avail. I am unable to use ORGNAME--partial.salesforce.com
for the subscription endpoint per Square.
Hoping someone has run into this issue before. Thank you!
Following up on identigral's comment, I have created a Site with the value of https://ORGNAME-square.INSTANCE.force.com/square/
and have updated my webhook endpoint accordingly to https://ORGNAME-square.INSTANCE.force.com/square/services/apexrest/[SOBJECTNAME]/[RESTRESOURCENAME]
. Now getting a code of status 500 Internal Server Error.
I should add that I also have a Remote Site Setting with the appropriate value of https://connect.squareupsandbox.com
.
@restResource
annotation?