Simulate Authorizations
Simulate a request from a merchant to authorize a charge to a virtual card.
Create a Simulated Authorization
try {
const result = await simulatorClient.simulateAuthorization({
pan: "4242424242424242",
amount: 4200,
merchantId: "000000001",
expiry: { mm: "2", yyyy: "2024" },
billingAddress: undefined,
csc: "123",
})
} catch (error) {
// Handle error
}do {
let authInput = SimulateAuthorizationInput(
pan: "4242424242424242",
amount: 4200,
merchantId: "000000001",
expiry: Expiry(mm: 2, yyyy: 2024),
billingAddress: nil,
csc: "123"
)
let response = try await simulatorClient.simulateAuthorizationWithInput(
authInput
)
if (response.approved) {
// Authorization has been approved
} else {
// Handle the authorization being declined
// see result.declineReason for why
}
} catch let error {
// Handle/notify the user of error
}Increase the Value of an Authorization
Simulate the Expiry of an Authorization
Last updated