Complete a delayed transaction by capturing all authorized card payments.
Reader SDK

Capture a Transaction

Complete a delayed transaction by capturing all authorized card payments.

Delayed payments can be taken on a mobile device by using the Reader SDK. However, to capture a delayed payment, you need the Transactions API called from an application running on a backend server. Your mobile payment application must be able to provide the backend with the transaction ID of a delayed payment.

For example, a seller might want to authorize funds at the time of purchase and capture funds when an item ships from the warehouse. After the checkout successfully completes, the seller's Reader SDK mobile application associates an order number with the Square transaction ID and location ID and sends this information to a backend server.

When the warehouse notifies the backend that the item has shipped, the backend looks up the order number, retrieves the transaction ID and location ID, and passes both IDs to the CaptureTransaction endpoint to capture the transaction.

  • You need an access token. If you are using OAuth, you need PAYMENTS_WRITE permission.

  • You need to create a delayed payment using the Reader SDK on a mobile device. For more information about creating a delayed payment, see Delay the Capture of Payments.

  • You need a valid location ID and the transaction ID of a delayed payment.

Authorized transactions are voided automatically after 6 days. Sometime within the next 6 days, capture the funds using the transactionID and locationID of the delayed capture transaction and the CaptureTransaction endpoint. CaptureTransaction responds with an empty JavaScript object, {}, on success. To view the finalized transaction, use the RetrieveTransaction endpoint with the saved transaction ID.

Capture Transaction
  • 1
  • 2
  • 3
  • 4
  • 5
curl https://connect.squareup.com/v2/locations/LOCATION_ID/transactions/TRANSACTION_ID/capture \
  -X POST \
  -H 'Square-Version: 2022-11-16' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json'

Fill the order_ids array with the transaction IDs for payments that you want to capture.

Batch Retrieve Orders
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
curl https://connect.squareup.com/v2/orders/batch-retrieve \
  -X POST \
  -H 'Square-Version: 2022-11-16' \
  -H 'Authorization: Bearer SELLER_ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "location_id": "{LOCATION_ID}",
    "order_ids": [
      "jGsodmQCXwftf8SSAFwJftMF",
      "xhUpgH9xst3vd1lL4PLS7sMF"
    ]
  }'

If you need more assistance, contact Developer Support or ask for help in the Developer Forums.