Add a one-time item to a subscription's next order
Plans a one-time item on the subscription’s next renewal order. The server sets the price: catalog is the variant’s one-time price in the subscription’s market and currency at the tier the subscription bills at, read now; gift is free. The client never sends an amount. The item lands on the next sealed renewal order once. When it is out of stock it waits one order, then is skipped. Requires the subscriptions update permission and an admin, and the milestone_items feature to work for the company.
curl --request POST \
--url https://api.fluid.app/api/subscriptions/{token}/milestone_items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"variant_id": 9012,
"quantity": 1,
"pricing": "gift",
"volume_policy": "zero"
}
'import requests
url = "https://api.fluid.app/api/subscriptions/{token}/milestone_items"
payload = {
"variant_id": 9012,
"quantity": 1,
"pricing": "gift",
"volume_policy": "zero"
}
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({variant_id: 9012, quantity: 1, pricing: 'gift', volume_policy: 'zero'})
};
fetch('https://api.fluid.app/api/subscriptions/{token}/milestone_items', 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.fluid.app/api/subscriptions/{token}/milestone_items",
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([
'variant_id' => 9012,
'quantity' => 1,
'pricing' => 'gift',
'volume_policy' => 'zero'
]),
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.fluid.app/api/subscriptions/{token}/milestone_items"
payload := strings.NewReader("{\n \"variant_id\": 9012,\n \"quantity\": 1,\n \"pricing\": \"gift\",\n \"volume_policy\": \"zero\"\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.fluid.app/api/subscriptions/{token}/milestone_items")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"variant_id\": 9012,\n \"quantity\": 1,\n \"pricing\": \"gift\",\n \"volume_policy\": \"zero\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/subscriptions/{token}/milestone_items")
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 \"variant_id\": 9012,\n \"quantity\": 1,\n \"pricing\": \"gift\",\n \"volume_policy\": \"zero\"\n}"
response = http.request(request)
puts response.read_body{
"milestone_item": {
"id": 123,
"subscription_token": "<string>",
"source": "rule",
"status": "planned",
"deferral_reason": "gate_closed",
"rule_id": 123,
"rule_name": "<string>",
"occurrence_key": "<string>",
"item_key": "<string>",
"variant_id": 123,
"variant_title": "<string>",
"main_variant_id": 123,
"substituted": true,
"quantity": 2,
"unit_price": "<string>",
"currency_code": "<string>",
"volume_policy": "zero",
"removable": true,
"order_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}Authorizations
Bearer token authentication
Path Parameters
Body
The variant to send. It must belong to the company.
1 <= x <= 100catalog charges the variant's one-time price in the subscription's market; gift is free.
catalog, gift Whether the line earns the variant's catalog volume. Defaults to catalog for catalog pricing and zero for a gift.
zero, catalog curl --request POST \
--url https://api.fluid.app/api/subscriptions/{token}/milestone_items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"variant_id": 9012,
"quantity": 1,
"pricing": "gift",
"volume_policy": "zero"
}
'import requests
url = "https://api.fluid.app/api/subscriptions/{token}/milestone_items"
payload = {
"variant_id": 9012,
"quantity": 1,
"pricing": "gift",
"volume_policy": "zero"
}
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({variant_id: 9012, quantity: 1, pricing: 'gift', volume_policy: 'zero'})
};
fetch('https://api.fluid.app/api/subscriptions/{token}/milestone_items', 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.fluid.app/api/subscriptions/{token}/milestone_items",
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([
'variant_id' => 9012,
'quantity' => 1,
'pricing' => 'gift',
'volume_policy' => 'zero'
]),
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.fluid.app/api/subscriptions/{token}/milestone_items"
payload := strings.NewReader("{\n \"variant_id\": 9012,\n \"quantity\": 1,\n \"pricing\": \"gift\",\n \"volume_policy\": \"zero\"\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.fluid.app/api/subscriptions/{token}/milestone_items")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"variant_id\": 9012,\n \"quantity\": 1,\n \"pricing\": \"gift\",\n \"volume_policy\": \"zero\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/subscriptions/{token}/milestone_items")
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 \"variant_id\": 9012,\n \"quantity\": 1,\n \"pricing\": \"gift\",\n \"volume_policy\": \"zero\"\n}"
response = http.request(request)
puts response.read_body{
"milestone_item": {
"id": 123,
"subscription_token": "<string>",
"source": "rule",
"status": "planned",
"deferral_reason": "gate_closed",
"rule_id": 123,
"rule_name": "<string>",
"occurrence_key": "<string>",
"item_key": "<string>",
"variant_id": 123,
"variant_title": "<string>",
"main_variant_id": 123,
"substituted": true,
"quantity": 2,
"unit_price": "<string>",
"currency_code": "<string>",
"volume_policy": "zero",
"removable": true,
"order_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"code": "<string>",
"payment_uuid": "<string>",
"error_details": [
{
"code": "<string>",
"field": "<string>",
"payment": "not_attempted",
"message": "<string>"
}
],
"coded_recovery": true
}
}