That payment is COMPLETED
. It is not canceled. Here is the payment from the API response:
{
"payment": {
"id": "vpb7DlZ71UbMutwH5rxvnbgsbuSZY",
"created_at": "2024-10-10T21:38:24.273Z",
"updated_at": "2024-10-11T15:55:15.590Z",
"amount_money": {
"amount": 2613,
"currency": "USD"
},
"status": "COMPLETED",
"delay_duration": "PT168H",
"source_type": "CARD",
"card_details": {
"status": "CAPTURED",
"card": {
"card_brand": "DISCOVER",
"last_4": "0004",
"exp_month": 3,
"exp_year": 2028,
"fingerprint": "sq-1-cbVYiJ-h4rRelDRB1wukUWtVs9evi_aHC3xvBD7hx9ITn86wbXde_uexHvBs01uMNA",
"card_type": "CREDIT",
"prepaid_type": "NOT_PREPAID",
"bin": "601100"
},
"entry_method": "KEYED",
"cvv_status": "CVV_ACCEPTED",
"avs_status": "AVS_ACCEPTED",
"statement_description": "SQ *DEFAULT TEST ACCOUNT",
"card_payment_timeline": {
"authorized_at": "2024-10-10T21:38:24.396Z",
"captured_at": "2024-10-11T15:55:14.132Z"
}
},
"location_id": "1042EFC3RVW48",
"order_id": "dLSI08YLZmZvRiXvHd8DeqZnZf4F",
"reference_id": "100466",
"risk_evaluation": {
"created_at": "2024-10-10T21:38:24.397Z",
"risk_level": "NORMAL"
},
"processing_fee": [
{
"effective_at": "2024-10-11T17:55:15.000Z",
"type": "INITIAL",
"amount_money": {
"amount": 106,
"currency": "USD"
}
}
],
"buyer_email_address": "[email protected]",
"billing_address": {
"address_line_1": "83 Bay St",
"address_line_2": "",
"locality": "Manchesterлы",
"administrative_district_level_1": "NH",
"postal_code": "03104",
"country": "US",
"first_name": "Matthewшел",
"last_name": "Baerлы"
},
"shipping_address": {
"address_line_1": "83 Bay St",
"locality": "Manchester",
"administrative_district_level_1": "CO",
"postal_code": "03104",
"country": "US"
},
"note": "sandbox.foreseeing.com: Bibliopolis Order #100466",
"total_money": {
"amount": 2613,
"currency": "USD"
},
"approved_money": {
"amount": 2613,
"currency": "USD"
},
"receipt_number": "vpb7",
"receipt_url": "https://squareupsandbox.com/receipt/preview/vpb7DlZ71UbMutwH5rxvnbgsbuSZY",
"delay_action": "CANCEL",
"delayed_until": "2024-10-17T21:38:24.273Z",
"application_details": {
"square_product": "ECOMMERCE_API",
"application_id": "sandbox-sq0idb-ebTnngKOH4ne39ifBFJltg"
},
"version_token": "hOSbtWTwNUCkf6ihviJykA069NJY1HGqWlMSuXXrFRz6o"
}
}
If you try to call CancelPayment
with a COMPLETED
payment you’ll get this error:
{
"errors": [
{
"code": "BAD_REQUEST",
"detail": "Payment vpb7DlZ71UbMutwH5rxvnbgsbuSZY is in inflight state COMPLETED, which is invalid for the requested operation",
"category": "INVALID_REQUEST_ERROR"
}
]
}
Do you have an example of an AUTHORIZED
payment your trying to call CancelPayment
with that is failing?