refundTransaction(identifier:)
Simulates a refund for an in-app purchase that completes outside of the app.
Declaration
func refundTransaction(identifier: Int) throwsParameters
- identifier:
The transaction Identifier of an in-app purchase to get a refund.
Discussion
In the testing environment, the system always approves refund requests, and processes them immediately. You can choose the reason for the refund by using beginRefundRequest(in:) in your app and selecting a reason. (Your app may also use beginRefundRequest(for:in:), beginRefundRequest(in:), or beginRefundRequest(in:). If your app uses SwiftUI, it may use refundRequestSheet(for:isPresented:onDismiss:).) Otherwise, the refund reason defaults to other.
After calling this function, handle the new transaction in updates or in your payment queue. Look for the revocationDate and revocationReason properties, which indicate the refund.