• Example searches: “transaction”, “CreateOrder”, “/v2/locations”, “inventory”, “delete customer”

You are viewing an old version of the API
Cancel payment

POST /v2/payments/{payment_id}/cancel

Cancels (voids) a payment.

You can use this endpoint to cancel a payment with the APPROVED status.


Permissions
PAYMENTS_WRITE
Guide
Delayed capture
Try in API Explorer
Name Description
payment_id
string

Required

The ID of the payment to cancel.

Response Fields

Name Description
errors
Error [ ]

Information about errors encountered during the request.

payment
Payment

The successfully canceled Payment object.

Examples

You are viewing an old version of the API
POST /v2/payments/{payment_id}/cancel
cURL
  • cURL
  • Ruby
  • Python
  • C#
  • Java
  • PHP
  • Node.js
curl https://connect.squareup.com/v2/payments/1QjqpBVyrI9S4H9sTGDWU9JeiWdZY/cancel \
  -X POST \
  -H 'Square-Version: 2021-11-17' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json'
Response JSON
{
  "payment": {
    "id": "1QjqpBVyrI9S4H9sTGDWU9JeiWdZY",
    "created_at": "2021-10-13T20:26:44.191Z",
    "updated_at": "2021-10-13T20:31:21.597Z",
    "amount_money": {
      "amount": 1000,
      "currency": "USD"
    },
    "tip_money": {
      "amount": 100,
      "currency": "USD"
    },
    "status": "CANCELED",
    "delay_duration": "PT168H",
    "source_type": "CARD",
    "card_details": {
      "status": "VOIDED",
      "card": {
        "card_brand": "VISA",
        "last_4": "1111",
        "exp_month": 11,
        "exp_year": 2022,
        "fingerprint": "sq-1-Hxim77tbdcbGejOejnoAklBVJed2YFLTmirfl8Q5XZzObTc8qY_U8RkwzoNL8dCEcQ",
        "card_type": "DEBIT",
        "prepaid_type": "NOT_PREPAID",
        "bin": "411111"
      },
      "entry_method": "ON_FILE",
      "cvv_status": "CVV_ACCEPTED",
      "avs_status": "AVS_ACCEPTED",
      "auth_result_code": "68aLBM",
      "statement_description": "SQ *EXAMPLE TEST GOSQ.C",
      "card_payment_timeline": {
        "authorized_at": "2021-10-13T20:26:44.364Z",
        "voided_at": "2021-10-13T20:31:21.597Z"
      }
    },
    "location_id": "L88917AVBK2S5",
    "order_id": "nUSN9TdxpiK3SrQg3wzmf6r8LP9YY",
    "risk_evaluation": {
      "created_at": "2021-10-13T20:26:45.271Z",
      "risk_level": "NORMAL"
    },
    "note": "Example Note",
    "customer_id": "W92WH6P11H4Z77CTET0RNTGFW8",
    "total_money": {
      "amount": 1100,
      "currency": "USD"
    },
    "approved_money": {
      "amount": 1000,
      "currency": "USD"
    },
    "delay_action": "CANCEL",
    "delayed_until": "2021-10-20T20:26:44.191Z",
    "application_details": {
      "square_product": "ECOMMERCE_API",
      "application_id": "sq0ids-TcgftTEtKxJTRF1lCFJ9TA"
    },
    "version_token": "N8AGYgEjCiY9Q57Jw7aVHEpBq8bzGCDCQMRX8Vs56N06o"
  }
}