# Refunds
source: https://developer.mastercard.com/account-to-account-commerce-for-dsp/documentation/testing/refunds/index.md

## Pre-requisites {#pre-requisites}

The following pre-requisites are applied to all the use cases:  

1. The client and signing keys have been exchanged.   
2. The outbound notification is set up at the participant's end.   
3. The debtor service provider onboarding completed and the DSPId shared.   
4. Successful connectivity testing.   

The following are the debtor service provider's responsibilities:

* Ensure that the debtor app or website is available, stable, and ready to be tested with these test cases.  
* The debtor service provider should also have tested debtors and accounts for testing some of these test cases.   

## Test Cases {#test-cases}

### Test Case 1: Refund Account Request {#test-case-1-refund-account-request}

|                            |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Test Title**             | Refund Account Request                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| **Description**            | The debtor requests a refund, and the creditor service provider requests the debtor's account details from Mastercard. Mastercard sends a request to the debtor service provider and forwards the account to the creditor service provider.                                                                                                                                                                                                                                                                                                                                                                          |
| **Pre-Requisite**          | The debtor service provider has been onboarded. A payment has been successful.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **Test Steps**             | **Step 1:** Use the Postman pack to execute the refund account request `(POST /payment-requests/{payment_request_lifecycle_id}/refunds)`. **Step 2:** Mastercard forwards the refund account to the debtor service provider. **Step 3:** The debtor service provider receives the refund account request\< code\>(POST /payment-requests/{payment_request_lifecycle_id}/refundsresource path caret icon) and responds with either the debtor's account details or the debtor service provider holding account details. **Step 4:** Mastercard forwards the refund account response to the creditor service provider. |
| **Postman Setup Scenario** | The CSPId and the CreditorId should be populated in the environment variables.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **Expected Result**        | **Step 1:** Mastercard responds with response code 200 in the Postman for the refund account details. **Step 2:** The debtor service provider receives the refund account request from Mastercard and responds with either the debtor account details or the debtor service provider holding account details.                                                                                                                                                                                                                                                                                                        |
| **Level of Necessity**     | Mandatory                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

### Test Case 2: Refund Confirmation {#test-case-2-refund-confirmation}

|                        |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Test Title**         | Refund Confirmation                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| **Description**        | The creditor service provider confirms the payment to Mastercard. Mastercard forwards the confirmation to the debtor service provider.                                                                                                                                                                                                                                                                                                                                                                                                               |
| **Pre-Requisite**      | The debtor service provider has been onboarded. A payment has been successful. The refund account request has been successful.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **Test Steps**         | **Step 1:** Use the Postman pack to execute the refund payment confirmation `(POST /payment-requests/{payment_request_lifecycle_id}/refunds/{refund_request_lifecycle_id}/payment-confirmations)`using the paymentRequestLifecycleId from the payment response and the refundRequestLifecycleId from the refund account request response. **Step 2:** Mastercard sends the refund confirmation to the debtor service provider `(POST /payment-requests/{payment_request_lifecycle_id}/refunds/{refund_request_lifecycle_id}/payment-confirmations)`. |
| **Expected Result**    | **Step 1:** Mastercard responds with 200 in the postman for the refund payment confirmation. **Step 2:** The debtor service provider receives the refund confirmation advice from Mastercard and responds with 200.                                                                                                                                                                                                                                                                                                                                  |
| **Level of Necessity** | Mandatory                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

