---
title: "Cancel an attachment (payments-api provider contract)"
method: POST
path: "/v1/attachments/attach_attempt/{attach_attempt_id}/cancel"
tags: ["Attachments"]
---

# Cancel an attachment (payments-api provider contract)

`POST /v1/attachments/attach_attempt/{attach_attempt_id}/cancel`

## Request

- Base URL: `https://ewallets-api.paymongo.com`
- URL: `https://ewallets-api.paymongo.com/v1/attachments/attach_attempt/{attach_attempt_id}/cancel`
- Auth: HTTP bearer

Called when an intent is cancelled or an attempt is displaced or expired. Withdraws a pending redirect: the attachment is closed here first, then what the wallet still holds for it is taken back — a one-time payment the payer has not completed is cancelled at the wallet, an unfinished activation's wallet link is deleted and its instrument ended, a renewal holds nothing. A wallet that will not or cannot let go does not undo the cancel: nothing charges a closed attachment, and the refusal is logged for reconciliation. Answers the attachment as it stands: cancelled, or the final state that got there first (a paid attachment stays succeeded; a late payment after a cancel is still reported as payment_intent.payment_created). Idempotent. An attachment of another account, or of the other mode, is 404.

## Path parameters

- `attach_attempt_id` string, required

## Headers

- `PayMongo-Livemode` 'true' | 'false', required
- `PayMongo-Correlation-Id` string

## Response `200`

OK

- AttachmentsResponse
  - `data` AttachmentsAttachment
    - `error_code` 'generic_decline' | 'blocked' | 'insufficient_funds' | 'limit_exceeded' | 'attempts_exceeded' | 'instrument_restricted' | 'customer_cancelled' | 'provider_unavailable' | 'provider_timeout' | 'processing_error' | 'internal_error' | 'provider_not_configured' | 'amount_invalid' | 'mode_mismatch' | 'suspected_fraud' | 'instrument_not_supported' | 'duplicate_transaction' | 'authorization_expired' | 'authentication_failed' | 'payment_expired' | 'instrument_invalid'
    - `error_detail` string
    - `expires_at` string
    - `id` string
    - `next_action` object
    - `payment` AttachmentsCreateAttachmentPayment
      - `authorized_amount` integer
      - `authorized_at` string
      - `captured_amount` integer
      - `captured_at` string
      - `metadata` object
      - `provider_transaction_reference` string
      - `status` 'paid' | 'failed'
    - `status` 'processing' | 'succeeded' | 'failed' | 'cancelled' | 'expired'

## Other responses

- `401`: Missing or invalid service token
- `404`: not_found: no such attachment for this account and mode
- `500`: Internal server error

---

[API](https://skmtc.dev/paymongo/apis/ewallets.md) - [All operations](https://skmtc.dev/paymongo/apis/ewallets/llms.txt) - [OpenAPI document](https://skmtc.dev/paymongo/apis/ewallets/revisions/a445ca65c132?raw)
