LogoLogo
  • Platform Overview
  • 🗺️Guides
    • Getting Started
    • Users
      • Integrate the User SDK
      • Registration
      • Authentication
      • SDK Releases
      • API Reference
    • Entitlements
      • Administrative API
        • Integrating the Administrative API
        • Entitlement Definitions
        • Managing Entitlements Sets
        • Managing Entitlements Sequences
        • Managing User Entitlements
        • API Schema
      • End-user API
        • Integrate the Entitlements SDK
        • Redeeming Entitlements
        • Retrieving Entitlements
        • SDK Releases
        • API Reference
    • Sudos
      • Integrate the Sudo Profiles SDK
      • Sudo Entitlements
      • Manage Sudos
      • SDK Releases
      • API Reference
    • Telephony
      • Integrate the Telephony SDK
      • Manage Phone Numbers
      • Text Messaging
      • Voice Calling
      • Telephony Simulator
      • SDK Releases
      • API Reference
    • Email
      • Integrate the Email SDK
      • Email Entitlements
      • Manage Email Addresses
      • Sending & Receiving Email
      • Manage Email Folders
      • Draft Email Messages
      • Schedule Send
      • Manage Email Address Blocklists
      • Email Address Public Information
      • Pagination
      • Caching
      • Configuration Data
      • Email Notifications
      • SDK Releases
      • API Reference
    • Decentralized Identity
      • Edge Agent
        • Relay SDK
          • Integrate the Relay SDK
          • Relay Entitlements
          • Manage Relay Postboxes
          • Manage Relay Messages
          • Receiving Messages
          • SDK Releases
        • Edge Agent SDK
          • Integrate the Edge Agent SDK
          • Agent Management
          • Manage Wallets
          • Establishing Connections
          • Manage Connections
          • Messaging
          • Manage DIDs
          • Accepting New Credentials
          • Manage Credentials
          • Present Credentials for Verification
          • Utilize Alternative Cryptography Providers
          • SDK Releases
          • Standards and Protocols
      • Cloud Agent
        • Cloud Agent Admin API
          • Integrate the Cloud Agent Admin API
          • Aries Interop Profile (AIP)
            • Connection Exchanges
            • Credential Exchanges
            • Proof Exchanges
          • Connections
          • Basic Messages
          • Credentials
            • Anoncreds Credentials
              • Schemas
              • Credential Definitions
            • W3C Credentials
          • Audit Logs
          • API Schema
          • Error Codes
          • Standards and Protocols
    • Virtual Cards
      • Integrate the Virtual Cards SDK
      • Virtual Cards Entitlements
      • Virtual Cards Transaction Velocity Constraints
      • Key Management
      • Manage Funding Sources
      • Manage Virtual Cards
      • Manage Transactions
      • Configuration Data
      • Pagination
      • Caching
      • SDK Releases
      • API Reference
    • Virtual Cards Simulator
      • Integrate the Virtual Cards Simulator SDK
      • Simulate Authorizations
      • Simulate Debits
      • Simulate Refunds
      • Simulate Reversals
      • Merchants and Currencies
      • SDK Releases
      • API Reference
    • Virtual Private Network
      • Integrate the VPN SDK
      • VPN Entitlements
      • Manage Servers
      • Manage Connection
      • Observe VPN Related Events
      • SDK Releases
      • API Reference
      • Frequently Asked Questions
    • Secure ID Verification
      • Integrate the Secure ID Verification SDK
      • List Supported Countries
      • Verify an Identity
      • Check Secure ID Verification Status
      • Use the Secure ID Verification Simulator
      • SDK Releases
      • API Reference
    • Password Manager
      • Integrate the Password Manager SDK
      • Accessing the Password Manager
      • Managing Password Vaults
      • Managing Password Vault Items
      • Vault Import and Export
      • Password Utilities
      • Password Manager Entitlements
      • Password Vault Security
      • SDK Releases
      • API Reference
    • Ad/Tracker Blocker
      • Integrate the Ad/Tracker Blocker SDK
      • Manage Rulesets
      • Blocking Ads and Trackers
      • Manage Exceptions
      • SDK Releases
      • API Reference
    • Site Reputation
      • Integrate the Site Reputation SDK
      • Use the Site Reputation SDK
      • SDK Releases
      • API Reference
  • 💡Concepts
    • Sudo Digital Identities
  • 🧱Development
    • Versioning
  • 🏢Administration
    • Admin Console Roles
  • ❓Get Help
    • Request a Demo
    • Report an Issue
Powered by GitBook
On this page
  • List the Simulator Merchants
  • List the Simulator Conversion Rates
  1. Guides
  2. Virtual Cards Simulator

Merchants and Currencies

The Virtual Cards Simulator comes pre-configured with a number of merchants and currency conversion rates.

The Virtual Cards Simulator comes pre-configured with a number of merchants that have a variety of characteristics that allow you to simulate different transactions. It also contains a small number of currency conversion rates.

Some merchants have specific behaviors that will cause particular decline codes to be generated when an authorization is requested. The returned SimulatorMerchant objects have a description field that provides a brief description of any special behavior of that merchant.

List the Simulator Merchants

The merchants that are defined in the simulator can be fetched by calling the getSimulatorMerchants API.

There are only a small number of merchants defined in the simulator, so this API does not require the results to be paged.

An example implementation of listing the merchants is:

try {
  const result = await simulatorClient.listSimulatorMerchants()
} catch (error) {
  // Handle error
}
do {
    let response = try await simulatorClient.getSimulatorMerchants()
    // Find a hotel or motel
    let hotel = try response.get().first { $0.mcc == "7011" }
} catch let error {
    // Handle/notify the user of error
}
launch {
    try {
        val merchants = withContext(Dispatchers.IO) {
            simulatorClient.getSimulatorMerchants()
        }
        // Find a hotel or motel
        val hotel = merchants.find { it.mcc == "7011" }
    } catch (e: GetSimulatorMerchantsException) {
        // Handle/notify the user of exception
    }
}

If an exception occurs, the error or exception will contain a description of the fault that caused the exception.

List the Simulator Conversion Rates

The currency conversion rates that are defined in the simulator can be fetched by calling the getSimulatorConversionRates API.

There are only a small number of conversion rates defined in the simulator, so this API does not require the results to be paged.

An example implementation of listing the conversion rates is:

try {
  const rates = await simulatorClient.listSimulatorMerchants()
  const usd = rates.find((r) => { r.currency == "USD" })
  const aud = rates.find((r) => { r.currency == "AUD" })
  if (usd && aud) {
    const usdToAud = Number(aud.amount) / Number(usd.amount)
    console.log(`USD to AUD ${usdToAud}`)
  }
} catch (error) {
  // Handle error
}
do {
    let response = try await simulatorClient.getSimulatorConversionRates()
    let rates = try response.get()
    let usd = rates.first { $0.currency == "USD" }
    let aud = rates.first { $0.currency == "AUD" }
    if usd != nil && aud != nil {
        let usdToAud = Double(aud!.amount) / Double(usd!.amount)
        print("USD to AUD \(usdToAud)")
    }
} catch let error {
    // Handle/notify the user of error
}
launch {
    try {
        val rates = withContext(Dispatchers.IO) {
            simulatorClient.getSimulatorConversionRates()
        }
        // Find the rate of USD to AUD
        val usd = rates.find { it.currency == "USD" }
        val aud = rates.find { it.currency == "AUD" }
        val usdToAud = aud.amount.toDouble() /
            usd.amount.toDouble() 
        println("USD to AUD $usdToAud")
    } catch (e: GetSimulatorConversionRatesException) {
        // Handle/notify the user of exception
    }
}

The list of CurrencyAmount classes returned contain the currency code and the conversion rate amount expressed as an Int. To convert between two currencies find the CurrencyAmount class for each currency, convert the amount to a Double then divide the two rates. If an exception occurs, the error or exception will contain a description of the fault that caused the exception.

PreviousSimulate ReversalsNextSDK Releases

Last updated 7 months ago

🗺️