Development
  • Guides
  • API Reference
  • API Explorer
  • SDKs
  • Sample apps
  • System status
Support
  • Developer forums
  • Developer blog
  • YouTube
  • X
More
  • Square Home
  • Square Developer
  • App Marketplace
  • Partner with Square
  • Solutions Partner Program
  • Pricing
  • Sales

© 2026 Square, Inc.

  • Developer terms of service
  • Developer Integration and Marketing Agreement
  • Privacy policy
  • Partnerships
  • Sign In
  • Sign In

    Payments

  • List payments

  • Create payment

  • Cancel payment by idempotency key

  • Get payment

  • Update payment

  • Cancel payment

  • Complete payment

  • Webhooks

  • payment.created

  • payment.updated

<- Payments API

Payments API

All versions ->

Cancel payment by idempotency key

POST

 /v2/payments/cancel

Cancels (voids) a payment identified by the idempotency key that is specified in the request.

Use this method when the status of a CreatePayment request is unknown (for example, after you send a CreatePayment request, a network error occurs and you do not get a response). In this case, you can direct Square to cancel the payment using this endpoint. In the request, you provide the same idempotency key that you provided in your CreatePayment request that you want to cancel. After canceling the payment, you can submit your CreatePayment request again.

Note that if no payment with the specified idempotency key is found, no action is taken and the endpoint returns successfully.

Permissions:PAYMENTS_WRITE
Try in API Explorer
Link to section

Request body

Example code

Link to section

idempotency_key

string

Required

The idempotency_key identifying the payment to be canceled.

Min Length
1
Max Length
45
Link to section

Response fields

Link to section

errors

Any errors that occurred during the request.

Link to section

Examples

All versions ->

POST /v2/payments/cancel
curl https://connect.squareup.com/v2/payments/cancel \ -X POST \ -H 'Square-Version: 2026-11-18' \ -H 'Authorization: Bearer ACCESS_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "idempotency_key": "a7e36d40-d24b-11e8-b568-0800200c9a66" }'

Response JSON

{}