Cancel Order
curl --request POST \
--url https://app.sosmednext.com/api/v1/cancel \
--header 'Content-Type: application/json' \
--data '
{
"orders": "<string>"
}
'import requests
url = "https://app.sosmednext.com/api/v1/cancel"
payload = { "orders": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({orders: '<string>'})
};
fetch('https://app.sosmednext.com/api/v1/cancel', 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://app.sosmednext.com/api/v1/cancel",
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([
'orders' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://app.sosmednext.com/api/v1/cancel"
payload := strings.NewReader("{\n \"orders\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://app.sosmednext.com/api/v1/cancel")
.header("Content-Type", "application/json")
.body("{\n \"orders\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.sosmednext.com/api/v1/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"orders\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAPI Endpoints
Cancel Order
Membatalkan pesanan yang sedang berjalan dan mengembalikan saldo secara otomatis.
POST
/
api
/
v1
/
cancel
Cancel Order
curl --request POST \
--url https://app.sosmednext.com/api/v1/cancel \
--header 'Content-Type: application/json' \
--data '
{
"orders": "<string>"
}
'import requests
url = "https://app.sosmednext.com/api/v1/cancel"
payload = { "orders": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({orders: '<string>'})
};
fetch('https://app.sosmednext.com/api/v1/cancel', 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://app.sosmednext.com/api/v1/cancel",
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([
'orders' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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://app.sosmednext.com/api/v1/cancel"
payload := strings.NewReader("{\n \"orders\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://app.sosmednext.com/api/v1/cancel")
.header("Content-Type", "application/json")
.body("{\n \"orders\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.sosmednext.com/api/v1/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"orders\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyGunakan endpoint ini untuk membatalkan satu atau beberapa pesanan yang masih dalam status
pending atau processing. Saldo akan dikembalikan (refund) secara otomatis jika pembatalan berhasil diproses oleh provider.
Catatan: Tidak semua layanan mendukung pembatalan. Pesanan dengan statussuccessataucanceledtidak dapat dibatalkan.
Body Parameters (JSON)
string
required
ID Order yang ingin dibatalkan, dipisahkan koma. Maksimal 100 ID per request. Contoh:
"9210,9211"Contoh Request
curl -X POST \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"orders": "9210,9211"}' \
"https://app.sosmednext.com/api/v1/cancel"
Response
Response Sukses (200 OK)
[
{ "order": 9210, "cancel": 1 },
{ "order": 9211, "cancel": { "error": "Order already success" } }
]
Penjelasan Response:
| Field | Keterangan |
|---|---|
cancel: 1 | Pembatalan berhasil, saldo telah dikembalikan. |
cancel: { error: "..." } | Pembatalan gagal dengan pesan error. |
Kemungkinan Pesan Error:
Order not found— ID order tidak ditemukan atau bukan milik Anda.Order already success— Pesanan sudah selesai, tidak bisa dibatalkan.Order already canceled— Pesanan sudah dibatalkan sebelumnya.No provider data— Pesanan belum dikirim ke provider.
