Завершить заказ (отметить как оплаченный или отмененный)
curl --request POST \
--url https://api.every.ru/b2b/esim/order/complete \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": 1234567890,
"status": "paid"
}
'import requests
url = "https://api.every.ru/b2b/esim/order/complete"
payload = {
"id": 1234567890,
"status": "paid"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({id: 1234567890, status: 'paid'})
};
fetch('https://api.every.ru/b2b/esim/order/complete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.every.ru/b2b/esim/order/complete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 1234567890,
'status' => 'paid'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.every.ru/b2b/esim/order/complete"
payload := strings.NewReader("{\n \"id\": 1234567890,\n \"status\": \"paid\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.every.ru/b2b/esim/order/complete")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1234567890,\n \"status\": \"paid\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.every.ru/b2b/esim/order/complete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 1234567890,\n \"status\": \"paid\"\n}"
response = http.request(request)
puts response.read_body{
"order": {
"id": 1234567890,
"country": "RU",
"packet": 1234567890,
"count": 1,
"created_at": "2023-12-01T10:30:00Z",
"expired_at": "2023-12-08T10:30:00Z",
"status": "inited"
},
"esim": {
"iccid": "89882470000012345678",
"name": "US.1",
"smdp": "https://smdp.example.com",
"activation": "LPA:1$smdp.example.com$1234567890",
"provisioned_at": "2023-12-01T10:35:00Z"
}
}{
"error": "Неверный статус заказа или заказ уже завершен"
}{
"code": -32602,
"message": "Заказ не найден",
"data": {
"code": 1
}
}{
"error": "Заказ уже завершен или истек"
}Заказы
Подтверждение заказа
Завершает заказ, устанавливая его статус в ‘paid’ или ‘canceled’.
Для статуса ‘canceled’:
- Статус заказа устанавливается в ‘canceled’
Для статуса ‘paid’:
- Статус заказа устанавливается в ‘paid’
- ICCID выбирается транзакционно, не участвуя в ассоциациях
- Создается ассоциация: order.id / packet.id / iccid
- SIM-карта активируется через API оператора, получается и сохраняется IMSI
- Трафиковый пакет (объем, период, страна) назначается IMSI
POST
/
order
/
complete
Завершить заказ (отметить как оплаченный или отмененный)
curl --request POST \
--url https://api.every.ru/b2b/esim/order/complete \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"id": 1234567890,
"status": "paid"
}
'import requests
url = "https://api.every.ru/b2b/esim/order/complete"
payload = {
"id": 1234567890,
"status": "paid"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({id: 1234567890, status: 'paid'})
};
fetch('https://api.every.ru/b2b/esim/order/complete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.every.ru/b2b/esim/order/complete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'id' => 1234567890,
'status' => 'paid'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.every.ru/b2b/esim/order/complete"
payload := strings.NewReader("{\n \"id\": 1234567890,\n \"status\": \"paid\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.every.ru/b2b/esim/order/complete")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"id\": 1234567890,\n \"status\": \"paid\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.every.ru/b2b/esim/order/complete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": 1234567890,\n \"status\": \"paid\"\n}"
response = http.request(request)
puts response.read_body{
"order": {
"id": 1234567890,
"country": "RU",
"packet": 1234567890,
"count": 1,
"created_at": "2023-12-01T10:30:00Z",
"expired_at": "2023-12-08T10:30:00Z",
"status": "inited"
},
"esim": {
"iccid": "89882470000012345678",
"name": "US.1",
"smdp": "https://smdp.example.com",
"activation": "LPA:1$smdp.example.com$1234567890",
"provisioned_at": "2023-12-01T10:35:00Z"
}
}{
"error": "Неверный статус заказа или заказ уже завершен"
}{
"code": -32602,
"message": "Заказ не найден",
"data": {
"code": 1
}
}{
"error": "Заказ уже завершен или истек"
}Авторизации
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Тело
application/json
⌘I