<!--
{
  "documentType" : "article",
  "framework" : "StoreKit",
  "identifier" : "/documentation/StoreKit/testing-refund-requests",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Testing refund requests"
}
-->

# Testing refund requests

Test your app’s implementation of refund requests, and your app’s and server’s handling of approved and declined refunds.

## Discussion

The sandbox environment and StoreKit Testing in Xcode both support testing refund requests, which enable your customers to request a refund from within your app. Your app displays the refund request sheet by calling any of these methods: [`beginRefundRequest(for:in:)`](/documentation/StoreKit/Transaction/beginRefundRequest(for:in:)-65tph) , [`beginRefundRequest(in:)`](/documentation/StoreKit/Transaction/beginRefundRequest(in:)-63bvd), [`beginRefundRequest(for:in:)`](/documentation/StoreKit/Transaction/beginRefundRequest(for:in:)-9mscy), [`beginRefundRequest(in:)`](/documentation/StoreKit/Transaction/beginRefundRequest(in:)-9k0pj), or <doc://com.apple.documentation/documentation/SwiftUI/View/refundRequestSheet(for:isPresented:onDismiss:)>. While you’re testing your app, you fill out the sheet to submit the request.

Depending on your testing setup, the App Store automatically approves or declines the refund request in the testing environment. Note that the App Store doesn’t send emails for refund requests in testing environments.

### Test approved refunds

To set up a test for approved refunds, select any refund reason on the refund request sheet, and submit the sheet. The App Store automatically approves the refund request in the testing environment.

Your app receives a [`Transaction`](/documentation/StoreKit/Transaction) with refund information in the [`revocationDate`](/documentation/StoreKit/Transaction/revocationDate) and [`revocationReason`](/documentation/StoreKit/Transaction/revocationReason-swift.property) properties. If you’re testing in the sandbox environment and your server receives <doc://com.apple.documentation/documentation/AppStoreServerNotifications/App-Store-Server-Notifications-V2> for the sandbox, it gets a notification with a `REFUND` <doc://com.apple.documentation/documentation/AppStoreServerNotifications/notificationType>.

### Test declined refunds

To set up a test for declined refunds, follow these steps on the refund request sheet with your app running in the sandbox environment:

1. Under Issue, select Other.
2. In the text box, type DECLINE.
3. Tap Request Refund.

The App Store automatically rejects the refund request in the testing environment.

If your server receives <doc://com.apple.documentation/documentation/AppStoreServerNotifications/App-Store-Server-Notifications-V2> for the sandbox environment, it gets a notification with a `REFUND_DECLINED` <doc://com.apple.documentation/documentation/AppStoreServerNotifications/notificationType>.

### Test prorated refunds

To set up a test for prorated refunds, follow these steps on the refund request sheet with your app running in the sandbox environment:

1. Under Issue, select Other.
2. In the text box, type GRANT_PRORATED.
3. Tap Request Refund.

The testing environment determines the prorated percentages as follows:

- For auto-renewable subscriptions, it calculates the proration based on the time that remains on the subscription
- For consumables, non-consumables, and non-renewing subscriptions, it uses a default proration of 50%

In the testing environment, the App Store automatically approves the prorated refund.

Your app receives a [`Transaction`](/documentation/StoreKit/Transaction) with refund information in the [`revocationDate`](/documentation/StoreKit/Transaction/revocationDate) and [`revocationReason`](/documentation/StoreKit/Transaction/revocationReason-swift.property) properties. If you’re testing in the sandbox environment and your server receives <doc://com.apple.documentation/documentation/AppStoreServerNotifications/App-Store-Server-Notifications-V2> for the sandbox, it gets a notification with a `REFUND` <doc://com.apple.documentation/documentation/AppStoreServerNotifications/notificationType>. For prorated refunds, the transaction data includes the `revocationType` field with a value of `REFUND_PRORATED` and the `revocationPercentage` field.

### Test prorated refunds with information from your server

Another way to test prorated refunds is to provide the refund information by calling the <doc://com.apple.documentation/documentation/AppStoreServerAPI/Send-Consumption-Information>, following these steps:

1. In your app, select any refund reason on the refund request sheet, and submit the sheet.
2. The App Store server sends a `CONSUMPTION_REQUEST` notification to your <doc://com.apple.documentation/documentation/AppStoreServerNotifications/App-Store-Server-Notifications-V2> for the sandbox environment.
3. Respond by calling <doc://com.apple.documentation/documentation/AppStoreServerAPI/Send-Consumption-Information>. Note that in the sandbox environment you need to respond to the notification within five minutes for the system to apply your consumption information to the refund request.

The values you provide in the <doc://com.apple.documentation/documentation/AppStoreServerAPI/ConsumptionRequest> determine the outcome of the refund in the testing environment:

- Specify the `GRANT_PRORATED` value as the refund preference to get a prorated refund
- Specify a valid `consumptionPercentage`. The testing environment approves the prorated refund using your consumption percentage.

For more information on receiving server notifications for the sandbox environment, see [Enabling App Store Server Notifications](/documentation/StoreKit/enabling-app-store-server-notifications). For more information on testing, see [Testing at all stages of development with Xcode and the sandbox](/documentation/StoreKit/testing-at-all-stages-of-development-with-xcode-and-the-sandbox) and <doc://com.apple.documentation/documentation/Xcode/setting-up-storekit-testing-in-xcode>.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)