Simulate Reversals
Simulate the reversal of an authorization to charge a virtual card.
Create a Simulated Reversal
try {
const result = await simulatorClient.simulateReversal({
authorizationId: authorization.id,
amount: 4200,
})
} catch (error) {
// Handle error
}do {
let reversalInput = SimulateReversalInput(
amount: 4200,
authorizationId: authorization.id
)
let response = try await simulatorClient.simulateReversalWithInput(
reversalInput
)
// Reversal has been applied
} catch let error {
// Handle/notify the user of error
}val reversalInput = SimulateReversalInput(
authorizationId = authorization.id,
amount = 4200
)
launch {
try {
val reversal = withContext(Dispatchers.IO) {
simulatorClient.simulateReversal(reversalInput)
}
// Reversal has been applied
} catch (e: ReversalException) {
// Handle/notify the user of exception
}
}Last updated