Log paid status in appsheet from square

Hello. I’m creating an app that I have connected to square for payment processing. Currently just using square sandbox for testing. So far I am able to send a webhook to square to get a payment link for the user prefilled with the amount they have to pay. What I can’t figure out is once the user have completed payment, how do I mark “paid” back in appsheet.

I have created a Google script file (very new to scripts), and I have created a square app subscription that redirects to the script to handle passing the paid confirmation back to the app.

I keep getting a 302 found response from square. My script log shows that it completed but nothing shows in the app that the user completed their payment.

Any feedback would be greatly appreciated

Your exact automation configuration is not clear. Also a deep troubleshooting may be outside the scope of community help. However the error itself suggests a shifting of a resource linked to a URL. You may want use that to further troubleshoot.

An AI response from Google search is in the screenshot below

1 Like

You are likely getting the 302 because you are being redirected to the “sandbox”.

As for indicating in AppSheet that an order/service has been paid, you should be getting back a response from Square’s API call with that information. Square supports REST API’s. Taking a quick look, it seems you probably should be using the “CreatePayment” API call

In that description, they show all the information that is returned. One of those is “Status” which indicates the success or failure of the payment. Webhooks in AppSheet CAN accept a return payload as described in Use return values from webhooks. They indicate that nested objects are supported but I have had trouble understanding how the fields are defined within the webhook step.

Alternatively, you can use Google Script to call the “CreatePayment” API call and then parse the returned payload to grab the status and send that back as a return to AppSheet.

I hope this helps!!

1 Like

I think what’s happening is I’m running into some weird authentication issues using the doPost function in my app script relay back to appsheet. I haven’t test it yet but I will soon. Once I figure it out I’ll report back to this thread and keep everyone in the know.

Greatly appreciate everyone’s insights thus far. Some got my brain thinking differently about this.

Hey everyone. So I figured it out. I was requesting a quick pay link from square in my JASON body of my bot. Running app scripts isn’t supported that way but using the square checkout pay API worked like a charm. That took longer than I’d like to admit to figure out lol.

2 Likes

Well done! Thanks for closing the loop on this.

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.