Create Terminal action from custom Swift application

I am building a custom checkout application that will use the Square Terminal. I have registered the application on my Square Developer account and followed the tutorial steps to connect the terminal to this application. I want to be able to send an amount of money to charge to my square terminal so that it can complete the transaction on behalf of my app.

I am looking at this documentation

If you go to the above link it gives code example of how to send a transaction in cURL. This code is the following:
-H ‘Square-Version: 2022-06-16’
-H ‘Authorization: Bearer ACCESS_TOKEN’
-H ‘Content-Type: application/json’
-d ‘{
“idempotency_key”: “thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e”,
“action”: {
“device_id”: “{{DEVICE_ID}}”,
“type”: “SAVE_CARD”,
“deadline_duration”: “PT5M”,
“save_card_options”: {
“customer_id”: “{{CUSTOMER_ID}}”,
“reference_id”: “user-id-1”

It also gives the code to make this request in Ruby, Python, C#, Java, PHP and Node.js. My question is what would the equivalent code look like for Swift?

For context, the app I’m developing is for a supervised self-checkout kiosk. It will run on an Ipad that has access to the internet. My app will determine the final amount to charge and that amount will be sent to the terminal to complete the payment.

:wave: Are you wanting to charge the card or store the card on file. What you provided is for storing the card on file. If you want to charge a card you’ll need to call CreateTerminalCheckout.

Also these call to create either a Terminal checkout or action to save a card on file are server side API calls which is why the examples are in Ruby, Python, C#, Java, PHP and Node.js. You’ll need to have your Swift client side app make a request to your server which will make the call to Square and handle any response. :slightly_smiling_face: