> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slm.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Account.reversePayment

The `reversePayment` method allows merchants to reverse payments made using the `makePayment` method. This method may only be used against payments made using the `MerchantAcceptedPayment` payment method.

## Input

*srd*: sparse response description, a SOAP string (which must be a JSON object), in which you specify the elements you want returned.This parameter enables the calling system to constrain a `method` call to return only components you specify. This gives you greater control over returned content, and improves response time within the Vindicia platform by reducing the processing needed for the call.

Some fields are required, either practically or in the WSDL, and will be returned regardless of the *srd*. A null *srd* returns the complete response.

*account*: the `Account` to which this reversal applies.

*timestamp*: the time that payment reversal occurred. Set `timestamp` for record keeping purposes, to record when the payment reversal was accepted, rather than when it was recorded in Subscribe. Subscribe will reverse payments immediately, regardless of when `timestamp` is set.

*paymentId*: the `paymentId` of the `MerchantAcceptedPayment` used for this Payment. Either the `paymentId`, or the `invoiceId` (and optional `indexNumber`) must be specified.

The `paymentId` is automatically set by Subscribe when a payment is made to an`Invoice` , `AutoBill`, or `Account`. In reversing a payment, you must reference the appropriate `paymentId`.

*invoiceId*: the ID of the Invoice associated with the payment reversal. Either the `paymentId`, or the `invoiceId` (and optional `indexNumber`) must be specified.

*indexNumber*: the `indexNumber` of the payment item (on the `invoiceId` invoice) that is being reversed.

*note*: an optional memo regarding the payment reversal.

## Output

*return*: an object of type `Return` that indicates the success or failure of the call.

## Returns

In addition to those listed in [The Return Object](The_Return_Object), this call returns:

| Return Code | Return String |
| - | - |
| `400` | One of the following: - `Account not found.` - `Neither paymentId nor invoiceId: *indexNumber* provided for reversal attempt.` - `Failed to add reverse payment: *error-description*.` |

## Example

```

// to reverse a payment made using the makePayment method

$acct = new Account();
$acct->setMerchantAccountId('xyz123');

$paymentMethod = new PaymentMethod();
$paymentMethod->setMerchantPaymentMethodId($pmId); // for some $pmId
$paymentId = $paymentMethod->merchantAcceptedPayment->paymentId;

$response = $acct->reversePayment(
   $now,
   $paymentId,
   undef,
   undef,
   'Changed my mind.'
);

// check $response
```

**Parent topic:**[Account Methods](../topics/Account_Methods)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.