Edit Batch Discount Template
curl --request POST \
--url https://api.unibee.dev/merchant/discount/batch/template/edit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"codePrefix": "<string>",
"id": 123,
"advance": true,
"billingType": 123,
"currency": "<string>",
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"discountType": 123,
"endTime": 123,
"metadata": {},
"name": "<string>",
"planApplyGroup": {
"currency": [
"<string>"
],
"groupPlanIntervalSelector": [
{
"intervalCount": 123,
"intervalUnit": "<string>"
}
],
"type": [
123
]
},
"planApplyType": 123,
"planIds": [
123
],
"quantity": 123,
"startTime": 123,
"subscriptionLimit": 123,
"upgradeLongPlanOnly": true,
"upgradeOnly": true,
"userLimit": 123,
"userScope": 123
}
'import requests
url = "https://api.unibee.dev/merchant/discount/batch/template/edit"
payload = {
"codePrefix": "<string>",
"id": 123,
"advance": True,
"billingType": 123,
"currency": "<string>",
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"discountType": 123,
"endTime": 123,
"metadata": {},
"name": "<string>",
"planApplyGroup": {
"currency": ["<string>"],
"groupPlanIntervalSelector": [
{
"intervalCount": 123,
"intervalUnit": "<string>"
}
],
"type": [123]
},
"planApplyType": 123,
"planIds": [123],
"quantity": 123,
"startTime": 123,
"subscriptionLimit": 123,
"upgradeLongPlanOnly": True,
"upgradeOnly": True,
"userLimit": 123,
"userScope": 123
}
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({
codePrefix: '<string>',
id: 123,
advance: true,
billingType: 123,
currency: '<string>',
cycleLimit: 123,
discountAmount: 123,
discountPercentage: 123,
discountType: 123,
endTime: 123,
metadata: {},
name: '<string>',
planApplyGroup: {
currency: ['<string>'],
groupPlanIntervalSelector: [{intervalCount: 123, intervalUnit: '<string>'}],
type: [123]
},
planApplyType: 123,
planIds: [123],
quantity: 123,
startTime: 123,
subscriptionLimit: 123,
upgradeLongPlanOnly: true,
upgradeOnly: true,
userLimit: 123,
userScope: 123
})
};
fetch('https://api.unibee.dev/merchant/discount/batch/template/edit', 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.unibee.dev/merchant/discount/batch/template/edit",
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([
'codePrefix' => '<string>',
'id' => 123,
'advance' => true,
'billingType' => 123,
'currency' => '<string>',
'cycleLimit' => 123,
'discountAmount' => 123,
'discountPercentage' => 123,
'discountType' => 123,
'endTime' => 123,
'metadata' => [
],
'name' => '<string>',
'planApplyGroup' => [
'currency' => [
'<string>'
],
'groupPlanIntervalSelector' => [
[
'intervalCount' => 123,
'intervalUnit' => '<string>'
]
],
'type' => [
123
]
],
'planApplyType' => 123,
'planIds' => [
123
],
'quantity' => 123,
'startTime' => 123,
'subscriptionLimit' => 123,
'upgradeLongPlanOnly' => true,
'upgradeOnly' => true,
'userLimit' => 123,
'userScope' => 123
]),
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.unibee.dev/merchant/discount/batch/template/edit"
payload := strings.NewReader("{\n \"codePrefix\": \"<string>\",\n \"id\": 123,\n \"advance\": true,\n \"billingType\": 123,\n \"currency\": \"<string>\",\n \"cycleLimit\": 123,\n \"discountAmount\": 123,\n \"discountPercentage\": 123,\n \"discountType\": 123,\n \"endTime\": 123,\n \"metadata\": {},\n \"name\": \"<string>\",\n \"planApplyGroup\": {\n \"currency\": [\n \"<string>\"\n ],\n \"groupPlanIntervalSelector\": [\n {\n \"intervalCount\": 123,\n \"intervalUnit\": \"<string>\"\n }\n ],\n \"type\": [\n 123\n ]\n },\n \"planApplyType\": 123,\n \"planIds\": [\n 123\n ],\n \"quantity\": 123,\n \"startTime\": 123,\n \"subscriptionLimit\": 123,\n \"upgradeLongPlanOnly\": true,\n \"upgradeOnly\": true,\n \"userLimit\": 123,\n \"userScope\": 123\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.unibee.dev/merchant/discount/batch/template/edit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"codePrefix\": \"<string>\",\n \"id\": 123,\n \"advance\": true,\n \"billingType\": 123,\n \"currency\": \"<string>\",\n \"cycleLimit\": 123,\n \"discountAmount\": 123,\n \"discountPercentage\": 123,\n \"discountType\": 123,\n \"endTime\": 123,\n \"metadata\": {},\n \"name\": \"<string>\",\n \"planApplyGroup\": {\n \"currency\": [\n \"<string>\"\n ],\n \"groupPlanIntervalSelector\": [\n {\n \"intervalCount\": 123,\n \"intervalUnit\": \"<string>\"\n }\n ],\n \"type\": [\n 123\n ]\n },\n \"planApplyType\": 123,\n \"planIds\": [\n 123\n ],\n \"quantity\": 123,\n \"startTime\": 123,\n \"subscriptionLimit\": 123,\n \"upgradeLongPlanOnly\": true,\n \"upgradeOnly\": true,\n \"userLimit\": 123,\n \"userScope\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.unibee.dev/merchant/discount/batch/template/edit")
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 \"codePrefix\": \"<string>\",\n \"id\": 123,\n \"advance\": true,\n \"billingType\": 123,\n \"currency\": \"<string>\",\n \"cycleLimit\": 123,\n \"discountAmount\": 123,\n \"discountPercentage\": 123,\n \"discountType\": 123,\n \"endTime\": 123,\n \"metadata\": {},\n \"name\": \"<string>\",\n \"planApplyGroup\": {\n \"currency\": [\n \"<string>\"\n ],\n \"groupPlanIntervalSelector\": [\n {\n \"intervalCount\": 123,\n \"intervalUnit\": \"<string>\"\n }\n ],\n \"type\": [\n 123\n ]\n },\n \"planApplyType\": 123,\n \"planIds\": [\n 123\n ],\n \"quantity\": 123,\n \"startTime\": 123,\n \"subscriptionLimit\": 123,\n \"upgradeLongPlanOnly\": true,\n \"upgradeOnly\": true,\n \"userLimit\": 123,\n \"userScope\": 123\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"data": {
"template": {
"advance": true,
"billingType": 123,
"childCodeCount": 123,
"code": "<string>",
"codePrefix": "<string>",
"createTime": 123,
"currency": "<string>",
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"discountType": 123,
"endTime": 123,
"id": 123,
"isDeleted": 123,
"merchantId": 123,
"metadata": {},
"name": "<string>",
"planApplyGroup": {
"currency": [
"<string>"
],
"groupPlanIntervalSelector": [
{
"intervalCount": 123,
"intervalUnit": "<string>"
}
],
"type": [
123
]
},
"planApplyType": 123,
"planIds": [
123
],
"quantity": 123,
"startTime": 123,
"status": 123,
"type": 123,
"upgradeLongerOnly": true,
"upgradeOnly": true,
"usedChildCodeCount": 123,
"userIds": [
123
],
"userLimit": 123,
"userScope": 123
}
},
"merchantId": 123,
"message": "<string>",
"redirect": "<string>",
"requestId": "<string>"
}Batch Discount
Edit Batch Discount Template
Edit batch discount template. CodePrefix cannot be modified. Quantity can only be increased after activation.
POST
/
merchant
/
discount
/
batch
/
template
/
edit
Edit Batch Discount Template
curl --request POST \
--url https://api.unibee.dev/merchant/discount/batch/template/edit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"codePrefix": "<string>",
"id": 123,
"advance": true,
"billingType": 123,
"currency": "<string>",
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"discountType": 123,
"endTime": 123,
"metadata": {},
"name": "<string>",
"planApplyGroup": {
"currency": [
"<string>"
],
"groupPlanIntervalSelector": [
{
"intervalCount": 123,
"intervalUnit": "<string>"
}
],
"type": [
123
]
},
"planApplyType": 123,
"planIds": [
123
],
"quantity": 123,
"startTime": 123,
"subscriptionLimit": 123,
"upgradeLongPlanOnly": true,
"upgradeOnly": true,
"userLimit": 123,
"userScope": 123
}
'import requests
url = "https://api.unibee.dev/merchant/discount/batch/template/edit"
payload = {
"codePrefix": "<string>",
"id": 123,
"advance": True,
"billingType": 123,
"currency": "<string>",
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"discountType": 123,
"endTime": 123,
"metadata": {},
"name": "<string>",
"planApplyGroup": {
"currency": ["<string>"],
"groupPlanIntervalSelector": [
{
"intervalCount": 123,
"intervalUnit": "<string>"
}
],
"type": [123]
},
"planApplyType": 123,
"planIds": [123],
"quantity": 123,
"startTime": 123,
"subscriptionLimit": 123,
"upgradeLongPlanOnly": True,
"upgradeOnly": True,
"userLimit": 123,
"userScope": 123
}
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({
codePrefix: '<string>',
id: 123,
advance: true,
billingType: 123,
currency: '<string>',
cycleLimit: 123,
discountAmount: 123,
discountPercentage: 123,
discountType: 123,
endTime: 123,
metadata: {},
name: '<string>',
planApplyGroup: {
currency: ['<string>'],
groupPlanIntervalSelector: [{intervalCount: 123, intervalUnit: '<string>'}],
type: [123]
},
planApplyType: 123,
planIds: [123],
quantity: 123,
startTime: 123,
subscriptionLimit: 123,
upgradeLongPlanOnly: true,
upgradeOnly: true,
userLimit: 123,
userScope: 123
})
};
fetch('https://api.unibee.dev/merchant/discount/batch/template/edit', 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.unibee.dev/merchant/discount/batch/template/edit",
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([
'codePrefix' => '<string>',
'id' => 123,
'advance' => true,
'billingType' => 123,
'currency' => '<string>',
'cycleLimit' => 123,
'discountAmount' => 123,
'discountPercentage' => 123,
'discountType' => 123,
'endTime' => 123,
'metadata' => [
],
'name' => '<string>',
'planApplyGroup' => [
'currency' => [
'<string>'
],
'groupPlanIntervalSelector' => [
[
'intervalCount' => 123,
'intervalUnit' => '<string>'
]
],
'type' => [
123
]
],
'planApplyType' => 123,
'planIds' => [
123
],
'quantity' => 123,
'startTime' => 123,
'subscriptionLimit' => 123,
'upgradeLongPlanOnly' => true,
'upgradeOnly' => true,
'userLimit' => 123,
'userScope' => 123
]),
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.unibee.dev/merchant/discount/batch/template/edit"
payload := strings.NewReader("{\n \"codePrefix\": \"<string>\",\n \"id\": 123,\n \"advance\": true,\n \"billingType\": 123,\n \"currency\": \"<string>\",\n \"cycleLimit\": 123,\n \"discountAmount\": 123,\n \"discountPercentage\": 123,\n \"discountType\": 123,\n \"endTime\": 123,\n \"metadata\": {},\n \"name\": \"<string>\",\n \"planApplyGroup\": {\n \"currency\": [\n \"<string>\"\n ],\n \"groupPlanIntervalSelector\": [\n {\n \"intervalCount\": 123,\n \"intervalUnit\": \"<string>\"\n }\n ],\n \"type\": [\n 123\n ]\n },\n \"planApplyType\": 123,\n \"planIds\": [\n 123\n ],\n \"quantity\": 123,\n \"startTime\": 123,\n \"subscriptionLimit\": 123,\n \"upgradeLongPlanOnly\": true,\n \"upgradeOnly\": true,\n \"userLimit\": 123,\n \"userScope\": 123\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.unibee.dev/merchant/discount/batch/template/edit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"codePrefix\": \"<string>\",\n \"id\": 123,\n \"advance\": true,\n \"billingType\": 123,\n \"currency\": \"<string>\",\n \"cycleLimit\": 123,\n \"discountAmount\": 123,\n \"discountPercentage\": 123,\n \"discountType\": 123,\n \"endTime\": 123,\n \"metadata\": {},\n \"name\": \"<string>\",\n \"planApplyGroup\": {\n \"currency\": [\n \"<string>\"\n ],\n \"groupPlanIntervalSelector\": [\n {\n \"intervalCount\": 123,\n \"intervalUnit\": \"<string>\"\n }\n ],\n \"type\": [\n 123\n ]\n },\n \"planApplyType\": 123,\n \"planIds\": [\n 123\n ],\n \"quantity\": 123,\n \"startTime\": 123,\n \"subscriptionLimit\": 123,\n \"upgradeLongPlanOnly\": true,\n \"upgradeOnly\": true,\n \"userLimit\": 123,\n \"userScope\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.unibee.dev/merchant/discount/batch/template/edit")
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 \"codePrefix\": \"<string>\",\n \"id\": 123,\n \"advance\": true,\n \"billingType\": 123,\n \"currency\": \"<string>\",\n \"cycleLimit\": 123,\n \"discountAmount\": 123,\n \"discountPercentage\": 123,\n \"discountType\": 123,\n \"endTime\": 123,\n \"metadata\": {},\n \"name\": \"<string>\",\n \"planApplyGroup\": {\n \"currency\": [\n \"<string>\"\n ],\n \"groupPlanIntervalSelector\": [\n {\n \"intervalCount\": 123,\n \"intervalUnit\": \"<string>\"\n }\n ],\n \"type\": [\n 123\n ]\n },\n \"planApplyType\": 123,\n \"planIds\": [\n 123\n ],\n \"quantity\": 123,\n \"startTime\": 123,\n \"subscriptionLimit\": 123,\n \"upgradeLongPlanOnly\": true,\n \"upgradeOnly\": true,\n \"userLimit\": 123,\n \"userScope\": 123\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"data": {
"template": {
"advance": true,
"billingType": 123,
"childCodeCount": 123,
"code": "<string>",
"codePrefix": "<string>",
"createTime": 123,
"currency": "<string>",
"cycleLimit": 123,
"discountAmount": 123,
"discountPercentage": 123,
"discountType": 123,
"endTime": 123,
"id": 123,
"isDeleted": 123,
"merchantId": 123,
"metadata": {},
"name": "<string>",
"planApplyGroup": {
"currency": [
"<string>"
],
"groupPlanIntervalSelector": [
{
"intervalCount": 123,
"intervalUnit": "<string>"
}
],
"type": [
123
]
},
"planApplyType": 123,
"planIds": [
123
],
"quantity": 123,
"startTime": 123,
"status": 123,
"type": 123,
"upgradeLongerOnly": true,
"upgradeOnly": true,
"usedChildCodeCount": 123,
"userIds": [
123
],
"userLimit": 123,
"userScope": 123
}
},
"merchantId": 123,
"message": "<string>",
"redirect": "<string>",
"requestId": "<string>"
}Endpoint Overview
POSThttps://api.unibee.dev/merchant/discount/batch/template/edit
Edit batch discount template. CodePrefix cannot be modified. Quantity can only be increased after activation.
Authorization
All UniBee Merchant API requests require authentication via API key.| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <your_api_key> |
Content-Type | Yes | application/json (for request body) |
Parameters
Parameters for this endpoint are listed below. The schema is also shown in the Try it panel.Request body
| Name | Type | Required | Description |
|---|---|---|---|
advance | boolean | No | AdvanceConfig, enable advanced configurations |
billingType | integer | No | The billing type, 1-one-time, 2-recurring |
codePrefix | string | Yes | The code prefix, must match existing value, cannot be modified |
currency | string | No | The discount currency |
cycleLimit | integer | No | The count limitation of subscription cycle, 0-no limit |
discountAmount | integer | No | The discount amount, available when discount_type is fixed_amount |
discountPercentage | integer | No | The discount percentage, 100=1% |
discountType | integer | No | The discount type, 1-percentage, 2-fixed_amount |
endTime | integer | No | The end time, editable after activate, utc timestamp in seconds |
id | integer | Yes | The template’s Id |
metadata | object | No | Metadata, custom key-value pairs |
name | string | No | The batch template’s display name |
planApplyGroup | string | No | |
planApplyType | integer | No | Plan apply type, 0-apply for all, 1-specified, 2-exclude, 3-by groups, 4-except groups |
planIds | array | No | Ids of plan which discount code can effect |
quantity | integer | No | Target number of child codes, can only increase after activation, max 10000 |
startTime | integer | No | The start time, editable after activate, utc timestamp in seconds |
subscriptionLimit | integer | No | The limit of every subscription apply, 0-unlimited |
upgradeLongPlanOnly | boolean | No | AdvanceConfig, true-only for upgrade to longer plan |
upgradeOnly | boolean | No | AdvanceConfig, true-only for same interval upgrade |
userLimit | integer | No | AdvanceConfig, Per customer limit, 0-unlimited |
userScope | integer | No | AdvanceConfig, Apply user scope, 0-all, 1-new user, 2-renewals |
Request examples
cURL
curl -X POST "https://api.unibee.dev/merchant/discount/batch/template/edit" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"advance": false,
"billingType": 0,
"codePrefix": "",
"currency": "",
"cycleLimit": 0,
"discountAmount": 0,
"discountPercentage": 0,
"discountType": 0,
"endTime": 0,
"id": 0,
"metadata": {},
"name": "",
"planApplyGroup": "",
"planApplyType": 0,
"planIds": [],
"quantity": 0,
"startTime": 0,
"subscriptionLimit": 0,
"upgradeLongPlanOnly": false,
"upgradeOnly": false,
"userLimit": 0,
"userScope": 0
}'
Sandbox
curl -X POST "https://api-sandbox.unibee.top/merchant/discount/batch/template/edit" \
-H "Authorization: Bearer YOUR_SANDBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"advance": false,
"billingType": 0,
"codePrefix": "",
"currency": "",
"cycleLimit": 0,
"discountAmount": 0,
"discountPercentage": 0,
"discountType": 0,
"endTime": 0,
"id": 0,
"metadata": {},
"name": "",
"planApplyGroup": "",
"planApplyType": 0,
"planIds": [],
"quantity": 0,
"startTime": 0,
"subscriptionLimit": 0,
"upgradeLongPlanOnly": false,
"upgradeOnly": false,
"userLimit": 0,
"userScope": 0
}'
Response
Success responses return a JSON envelope withcode, data, message, redirect, and requestId. code 0 indicates success.
| Field | Type | Description |
|---|---|---|
code | integer | Response code. 0 = success |
data | object | Response payload |
data.template | object | |
message | string | Human-readable message |
requestId | string | Request ID for support |
Error handling
| HTTP status | Meaning |
|---|---|
| 400 | Bad request — invalid or missing parameters. Check message in the body. |
| 401 | Unauthorized — missing or invalid API key. |
| 404 | Not found — invalid path or resource. |
| 500 | Server error — retry with backoff. |
code in the response body is non-zero, check message for details. Use requestId when contacting support.Authorizations
Body
application/json
Edit batch discount template. CodePrefix cannot be modified. Quantity can only be increased after activation.

