# 购买eSIM

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/v3/esim/purchase:
    post:
      summary: 购买eSIM
      deprecated: false
      description: |
        错误码：
        503016 - 重复订单号。返回这个错误的时候可以通过查询eSIM订单详情接口获取结果。
        45109 - 找不到eSIM商品
        45110 - eSIM 商品库存不足
        45112 - 账户余额不足
      tags:
        - API接口/卡业务接口
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                appkey:
                  type: string
                timestamp:
                  type: integer
                nonce:
                  type: integer
                sign:
                  type: string
                eSIMGoodsCode:
                  type: string
                  description: eSIM商品编码
                  minLength: 1
                  maxLength: 255
                outTradeNo:
                  type: string
                  description: 客户订单号
              required:
                - appkey
                - timestamp
                - nonce
                - sign
                - eSIMGoodsCode
                - outTradeNo
              x-apifox-orders:
                - appkey
                - timestamp
                - nonce
                - sign
                - eSIMGoodsCode
                - outTradeNo
            example:
              appkey: string
              timestamp: 0
              nonce: 0
              sign: string
              eSIMGoodsCode: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  data:
                    type: object
                    properties:
                      iccid:
                        type: string
                        description: 卡号
                      activationCode:
                        type: string
                        description: 激活码
                      orderId:
                        type: string
                        description: 平台订单号
                    required:
                      - iccid
                      - activationCode
                      - orderId
                    x-apifox-orders:
                      - orderId
                      - iccid
                      - activationCode
                  message:
                    type: string
                required:
                  - code
                  - data
                  - message
                x-apifox-orders:
                  - code
                  - data
                  - message
              example:
                code: 0
                data:
                  orderId: ''
                  iccid: ''
                  activationCode: ''
                message: string
          headers: {}
          x-apifox-name: 成功
      security: []
      x-apifox-folder: API接口/卡业务接口
      x-apifox-status: developing
      x-run-in-apifox: https://app.apifox.com/web/project/2330898/apis/api-261353809-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://oapi.eiotclub.com
    description: 生产环境
security: []

```
