eSIM Exchange Business Integration API Specification v1.2

purchaseCode

python
1import requests
2import json
3import hashlib
4
5# URL for the request
6url = "https://api.iroamly.shop/openapi/purchaseCode"
7
8# Provided AuthKey and AuthSecret, remember to replace them with real values
9auth_key = "YOUR_AUTH_KEY_HERE"
10auth_secret = "YOUR_AUTH_SECRET_HERE" 
11
12
13# Calculating Certification
14combined = auth_key + auth_secret
15certification = hashlib.sha256(combined.encode()).hexdigest()
16
17# Header parameters for the request
18headers = {
19    "Content-Type": "application/json",
20    "AuthKey": auth_key,
21    "Certification": certification
22}
23
24# Example data for the request body
25data = {
26    "email": "2m827n32d@gmail.com",
27    "productList": [
28        {
29            "productCode": "m8hed7h2fed2398dsnh",
30            "quantity": 2
31        },
32        {
33            "productCode": "cn88beg9edjdfj2sj0a",
34            "quantity": 1
35        }
36    ]
37}
38
39# Sending POST request
40response = requests.post(url, headers=headers, data=json.dumps(data))
41
42# Printing the response content
43print(response.text)
44
45# Example of response
46{
47    "code":1,
48    "msg":"success",
49    "orderId":"xxx-xxxx-sd9hn8df333"
50}
51