Square Terminal APP Fee

Hey So I created a OAuth link Sign In

What would be the full accurate curl code to take a fee, do you have to add some stuff in the API?

With our API Explorer you can build API requests which also includes CreateTerminalCheckout. Also here is an example of a request that collects a fee. :slightly_smiling_face:

curl https://connect.squareup.com/v2/terminals/checkouts \
  -X POST \
  -H 'Square-Version: 2022-10-19' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "checkout": {
      "amount_money": {
        "amount": 100,
        "currency": "USD"
      },
      "device_options": {
        "device_id": "{{device_id}}",
        "collect_signature": false,
        "show_itemized_cart": true,
        "skip_receipt_screen": true
      },
      "note": "seller note",
      "payment_options": {
        "autocomplete": true
      },
      "payment_type": "CARD_PRESENT",
      "app_fee_money": {
        "amount": 50,
        "currency": "USD"
      },
      "order_id": "{{order_id}}"
    },
    "idempotency_key": "a784780f-5556-47bf-b891-3aeeac0c3e46"
  }'

But do i have to put anything special in the API? how does the clients square terminal know to send the fee to me if im using my bearer token?

curl https://connect.squareup.com/v2/terminals/checkouts \
  -X POST \
  -H 'Square-Version: 2022-10-19' \
  -H 'Authorization: Bearer EA9PUxqIhuIwyluEc9OEl[NOT REAL TOKEN] 1rckY2AlV_L1Pw7xePo' \
  -H 'Content-Type: application/json' \
  -d '{
    "checkout": {
      "amount_money": {
        "amount": 100,
        "currency": "USD"
      },
      "device_options": {
        "device_id": "229CS149SB1001099",
        "collect_signature": false,
        "skip_receipt_screen": true
      },
      "note": "seller note",
      "payment_options": {
        "autocomplete": true
      },
      "payment_type": "CARD_PRESENT",
      "app_fee_money": {
        "amount": 50,
        "currency": "USD"
      }
    },
    "idempotency_key": "a784780f-5556-47bf-b8w91-3aeeac0c3e46"
  }'

this reurns this error

{
    "errors": [{
        "category": "AUTHENTICATION_ERROR",
        "code": "UNAUTHORIZED",
        "detail": "This request could not be authorized."
    }]
}

What am i supposed to do? Which account bearer token am i supposed to use? mine or the clients account?

And for Signin code, do i generate that using my bearer token or my clients bearer token? there is no clear documentation

You’ll need to use OAuth to have the customer authorize your application which will give you an access token that you can use to take payments on the customers behalf. :slightly_smiling_face: