> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mysubwallet.ng/llms.txt
> Use this file to discover all available pages before exploring further.

# Buy eSIM



## OpenAPI

````yaml POST /api/esim/buy
openapi: 3.1.0
info:
  title: mySubwallet API
  version: 1.0.0
  description: >-
    Buy data, airtime, cable, electricity, exam pins, bulk SMS, betting, eSIM,
    flights, recharge/data cards and more, funded from your wallet. Test
    everything safely with your sandbox (sk_test_) key — no wallet charge.
servers:
  - url: https://api.mysubwallet.ng
    description: Production (live — charges your wallet)
  - url: https://sandbox.mysubwallet.ng
    description: Sandbox (test — simulated, no wallet charge)
security:
  - TokenAuth: []
tags:
  - name: Purchases
  - name: Verification
  - name: Betting
  - name: eSIM
  - name: Flights
  - name: Wallet
  - name: Catalogs
  - name: Account
paths:
  /api/esim/buy:
    post:
      tags:
        - eSIM
      summary: Buy eSIM
      description: >-
        Purchases an eSIM and charges your wallet. The response returns the
        provisioned eSIM directly — including its `id`, `iccid`,
        `universal_link` (the install link / QR payload) and `activation_code` —
        so you do not need to call My eSIMs afterwards. When the vendor
        provisions instantly, `sim_applied` is `true` and the link is ready;
        otherwise the eSIM is created in a provisioning state (`plan_status` 0)
        and the link fills in shortly — poll `GET /api/esim/my/{id}`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - package_id
                - package_type
              properties:
                package_id:
                  type: string
                  example: esim_abc
                package_type:
                  type: string
                  enum:
                    - DATA-ONLY
                    - DATA-VOICE-SMS
                  example: DATA-ONLY
      responses:
        '200':
          description: The purchased eSIM.
          content:
            application/json:
              example:
                status: success
                message: eSIM ready. Install using the QR/link provided.
                data:
                  id: 21
                  transid: ESIM_AB12CD34EF
                  sim_applied: true
                  iccid: '8932042000024889460'
                  universal_link: >-
                    https://esimsetup.apple.com/esim_qrcode_provisioning?carddata=LPA:1$rsp-eu.simlessly.com$7230...
                  activation_code: LPA:1$rsp-eu.simlessly.com$7230...
                  package_name: Spain 1GB - 7 Days
                  sold_price_ngn: 2500
                  plan_status: 1
                  provider: esimaccess
        '402':
          description: Insufficient wallet balance.
          content:
            application/json:
              example:
                status: fail
                message: Insufficient balance. Required ₦2,500.00
components:
  securitySchemes:
    TokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Send your API key as `Token <your_api_key>`.


        Use your **live key** for real transactions, or your **sandbox key**
        (`sk_test_…`) to test — sandbox calls return a realistic simulated
        result and never touch your wallet. Add `"sandbox_status": "fail"` to
        any sandbox request to simulate a failure.

````