Search…
Simulate Reversals
Simulate the reversal of an authorization to charge a virtual card.
A reversal is a request to reverse or undo the effect of an authorization.

Create a Simulated Reversal

A simulated reversal is created by calling the simulate reversal API and supplying the identifier of the authorization and the amount to reverse.
The authorizationId is the identifier of an authorization that was created by calling the Create a Simulated Authorization API. The amount supplied as input is expressed as a multiple of the smallest unit of currency the merchant accepts. For example if the currency is US dollar then the amount is the number of US cents.
An example implementation of creating a simulated reversal is:
TypeScript
Swift
Kotlin
1
try {
2
const result = await simulatorClient.simulateReversal({
3
authorizationId: authorization.id,
4
amount: 4200,
5
})
6
} catch (error) {
7
// Handle error
8
}
Copied!
1
let reversalInput = SimulateReversalInput(
2
amount: 4200,
3
authorizationId: authorization.id
4
)
5
simulatorClient.simulateReversalWithInput(reversalInput) { result in
6
switch result {
7
case .success:
8
// Reversal has been applied
9
case .failure:
10
// Handle/notify the user of exception
11
}
12
}
Copied!
1
val reversalInput = SimulateReversalInput(
2
authorizationId = authorization.id,
3
amount = 4200
4
)
5
launch {
6
try {
7
val reversal = withContext(Dispatchers.IO) {
8
simulatorClient.simulateReversal(reversalInput)
9
}
10
// Reversal has been applied
11
} catch (e: ReversalException) {
12
// Handle/notify the user of exception
13
}
14
}
Copied!
This API call reverses the effect of the authorization against a virtual card. If an exception occurs, the error or exception will contain a description of the fault that caused the exception.
Last modified 14d ago