eSIM API Reference

Getting Started

<!-- Include the eSIM Script -->
<script src="https://script.viserlab.com/esim/esim.js"></script>
<link rel="stylesheet" href="https://script.viserlab.com/esim/esim.css">

Initialize the ESIM object after including the script.

ESIM.checkout()

Opens the payment modal for eSIM purchase.

ESIM.checkout({
  plan: 'Regional 3GB',
  price: 12,
  currency: 'USD',
  onSuccess: function(data) {
    // Handle successful purchase
  },
  onError: function(error) {
    // Handle error
  }
});

Parameters

  • plan - The name of the plan being purchased
  • price - The price of the plan
  • currency - Currency code (default: USD)
  • onSuccess - Callback when purchase completes
  • onError - Callback when error occurs

ESIM.showPlans()

Displays available plans in a modal.

ESIM.showPlans({
  region: 'global',
  onSelect: function(plan) {
    // Handle selected plan
  }
});

Parameters

  • region - Filter plans by region (global, europe, asia, etc.)
  • onSelect - Callback when user selects a plan

Event Callbacks

onSuccess

Called when payment is successfully processed.

function(data) {
  // data contains:
  // - orderId
  // - planName
  // - qrCodeUrl
  // - activationCode
}

onError

Called when an error occurs during payment.

function(error) {
  // error contains:
  // - code
  // - message
  // - details
}
Back to Home