교환 코드 구매(Python)
교환 코드 구매에 대한 완전한 Python 요청으로, AuthKey 및 Certification 헤더를 포함합니다. 자리 표시자 AuthKey와 AuthSecret을 API 키 페이지의 값으로 바꾸세요.
코드 참조
교환 코드 구매(Python)
import requests
import json
import hashlib
# URL for the request
url = "https://api.iroamly.shop/openapi/purchaseCode"
# Provided AuthKey and AuthSecret, remember to replace them with real values
auth_key = "YOUR_AUTH_KEY_HERE"
auth_secret = "YOUR_AUTH_SECRET_HERE"
# Calculating Certification
combined = auth_key + auth_secret
certification = hashlib.sha256(combined.encode()).hexdigest()
# Header parameters for the request
headers = {
"Content-Type": "application/json",
"AuthKey": auth_key,
"Certification": certification
}
# Example data for the request body
data = {
"email": "2m827n32d@gmail.com",
"productList": [
{
"productCode": "m8hed7h2fed2398dsnh",
"quantity": 2
},
{
"productCode": "cn88beg9edjdfj2sj0a",
"quantity": 1
}
]
}
# Sending POST request
response = requests.post(url, headers=headers, data=json.dumps(data))
# Printing the response content
print(response.text)
# Example of response
{
"code":1,
"msg":"success",
"orderId":"xxx-xxxx-sd9hn8df333"
}
API 엔드포인트
교환 코드 구매
요청 URL:
https://api.iroamly.shop/openapi/purchaseCode요청 메서드:
POST요청 파라미터:
파라미터설명유형
email이메일String
productList상품 모음Object[]
productList 필드:
필드설명유형
plan요금제 이름. plan 또는 productCode 중 하나를 입력하세요.String
productCode요금제 ID(지역별 요금제 목록 조회의 productCode). productCode 또는 plan 중 하나를 입력하세요.String
quantity수량Int
테스트 요금제:
iRoamly-Test-10GB{
"email": "2m827n32d@gmail.com",
"productList": [
{
"plan": "United States-eSIM-10GB-10 Days-Total",
"quantity": 2
},
{
"plan": "Albania-10GB-15 Days-Total",
"quantity": 1
}
]
}{
"code": 1,
"msg": "success",
"orderId": "xxx-xxxx-sd9hn8df333" // Order number, can be used to query redeem code
}코드 참조