---
title: "Refund the payment an attach attempt took"
method: POST
path: "/v1/attachments/attach_attempt/{attach_attempt_id}/refunds"
tags: ["Attachments"]
---

# Refund the payment an attach attempt took

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

## Request

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

Called by refunds-api. The attachment names the wallet that took the payment, the payment's id there, its amount and when it was paid. For Maya the payment is voided on the day it was paid (Philippine time) and refunded afterwards. Each reference_id reaches the wallet at most once: a repeat returns the first outcome. A refusal by the wallet, an error or no answer from it, is returned as status failed with a code in provider_error. A 4xx means nothing was reversed; any 5xx means the outcome is not final and the refund must stay pending. In test mode the wallet is not called.

## Path parameters

- `attach_attempt_id` string, required

## Headers

- `PayMongo-Livemode` 'true' | 'false', required

## Request body

- AttachmentRefundRequestDTO: Refund of the payment an attach attempt took. Which wallet took it, the payment's id there, its amount and its paid time come from the attachment.
  - `amount` integer, required
  - `currency` 'PHP', required
  - `metadata` object
  - `reason` 'duplicate' | 'fraudulent' | 'others' | 'requested_by_customer', required
  - `reference_id` string, required

## Response `200`

The wallet reversed the payment, the wallet refused, or a repeat of an earlier outcome

- object: Standard response containing data and its metadata if any
  - `data` AttachmentRefundResponseDTO: Outcome of a refund. A refusal by the wallet is an outcome (status failed), not an error.
    - `provider_error` string
    - `reference_id` string
    - `status` 'succeeded' | 'failed'
  - `has_more` boolean

## Other responses

- `400`: Invalid JSON body, validation errors, or a missing PayMongo-Livemode header
- `401`: Missing or invalid service token
- `404`: No attachment for this attach attempt under the token's organization and mode
- `422`: Not sent to the wallet: the payment isn't paid, its wallet isn't refunded here, or its currency differs; a same-day partial refund, an amount over what is refundable, an in-flight refund on the payment, or a reused reference_id
- `500`: Internal server error
- `502`: The wallet answered but its outcome could not be recorded; the payment may have been reversed
- `503`: The same reference_id is still being sent to the wallet

---

[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)
