Did some extra research but still confused

Hi again, so I made a previous post but I wasn’t that familiar with the terms so I did some extra research. So I still want to know if I can connect to multiple square terminals with just one device code. Also, after understanding web-hooks and how they work, I want to essentially fetch certain payment details of a purchase every time a user of my app makes a purchase on a square terminal that i’m connected to. So for instance I use webhook.site or requestbin or whatever, is there a way that when the payment.created event gets pushed to my webhook, I can use the webhook URL as a URL endpoint in Swift to pull the payment id and then use that payment ID to get payment details. I know it might sound like I’m an idiot and I have no idea what I’m talking about, and that might be the case but I know what I want to do I just don’t know how to express it over texting. If anyone could respond and give me a chance to maybe bounce ideas and explain myself more clearly, that would be great. Thanks

I answered some of this here: Load JSON data into a PDF file on an iOS app (saw it first). Essentially, you’ll need a server/service running somewhere (outside of your mobile application, as it needs to be running 24/7 for it to be effective) that would be listening for webhooks. Ideally, we also strongly discourage calling any of Square APIs directly from the mobile application itself as this means you would be storing your secret access token in the application which is a security risk. Anything doing with our APIs should be coming from a backend server.

At a very high-level, this could look like:

  • Your mobile application wants to start a Terminal checkout via a button. On button click…
  • Your mobile application makes a HTTP request to your own server/service
  • Your server/service receives the request, understands you want to make a new Terminal Checkout, and calls CreateTerminalCheckout with whatever parameters you need (probably want to pass the amount from your mobile application for example).
  • Once your server makes the request, your terminal would be ready for payment
  • Customer pays on the terminal
  • Your server/service receives a payment.created webhook
  • Do something with the webhook (i.e notify your mobile application that the payment was complete)

Sorry for the repeat, was just eager to find out, but since I can’t store tokens in the mobile app, my app idea is looking near to impossible. Thanks for your time again and sorry for any inconvenience .