Skip to main content
POST
/
v1
/
subscription_items
/
{id}
Update a subscription item
curl --request POST \
  --url https://api.yorlet.com/v1/subscription_items/{id} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "price_data": {
    "amount": 123,
    "tax_percent": 123
  },
  "description": "<string>",
  "metadata": {},
  "schedule": [
    {
      "amount": 123,
      "effective_at": 123
    }
  ],
  "tax_rate": "<string>",
  "transfer_destination": "<string>"
}
'
import requests

url = "https://api.yorlet.com/v1/subscription_items/{id}"

payload = {
    "price_data": {
        "amount": 123,
        "tax_percent": 123
    },
    "description": "<string>",
    "metadata": {},
    "schedule": [
        {
            "amount": 123,
            "effective_at": 123
        }
    ],
    "tax_rate": "<string>",
    "transfer_destination": "<string>"
}
headers = {
    "Authorization": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    price_data: {amount: 123, tax_percent: 123},
    description: '<string>',
    metadata: {},
    schedule: [{amount: 123, effective_at: 123}],
    tax_rate: '<string>',
    transfer_destination: '<string>'
  })
};

fetch('https://api.yorlet.com/v1/subscription_items/{id}', 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.yorlet.com/v1/subscription_items/{id}",
  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([
    'price_data' => [
        'amount' => 123,
        'tax_percent' => 123
    ],
    'description' => '<string>',
    'metadata' => [
        
    ],
    'schedule' => [
        [
                'amount' => 123,
                'effective_at' => 123
        ]
    ],
    'tax_rate' => '<string>',
    'transfer_destination' => '<string>'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: <api-key>",
    "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.yorlet.com/v1/subscription_items/{id}"

	payload := strings.NewReader("{\n  \"price_data\": {\n    \"amount\": 123,\n    \"tax_percent\": 123\n  },\n  \"description\": \"<string>\",\n  \"metadata\": {},\n  \"schedule\": [\n    {\n      \"amount\": 123,\n      \"effective_at\": 123\n    }\n  ],\n  \"tax_rate\": \"<string>\",\n  \"transfer_destination\": \"<string>\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<api-key>")
	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.yorlet.com/v1/subscription_items/{id}")
  .header("Authorization", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"price_data\": {\n    \"amount\": 123,\n    \"tax_percent\": 123\n  },\n  \"description\": \"<string>\",\n  \"metadata\": {},\n  \"schedule\": [\n    {\n      \"amount\": 123,\n      \"effective_at\": 123\n    }\n  ],\n  \"tax_rate\": \"<string>\",\n  \"transfer_destination\": \"<string>\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.yorlet.com/v1/subscription_items/{id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"price_data\": {\n    \"amount\": 123,\n    \"tax_percent\": 123\n  },\n  \"description\": \"<string>\",\n  \"metadata\": {},\n  \"schedule\": [\n    {\n      \"amount\": 123,\n      \"effective_at\": 123\n    }\n  ],\n  \"tax_rate\": \"<string>\",\n  \"transfer_destination\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "created": 123,
  "object": "subscription_item",
  "description": "<string>",
  "price": "<string>",
  "price_data": {
    "amount": 123,
    "currency": "gbp",
    "recurring": {
      "interval": "<string>",
      "interval_count": 123
    },
    "tax_percent": 123
  },
  "schedule": [
    {
      "amount": 123,
      "effective_at": 123
    }
  ],
  "subscription": "<string>",
  "tax_rate": "<string>",
  "transfer_destination": "<string>",
  "unit": "<string>",
  "account": "<string>",
  "deleted": false,
  "metadata": {}
}

Authorizations

Authorization
string
header
required

API Key authentication. Use "Bearer YOUR_API_KEY".

Path Parameters

id
string
required

The id identifier.

Body

application/json
price_data
object
required

The price data for the subscription item.

description
string

The description of the subscription item.

metadata
object | null

Set of key-value pairs to attach to the subscription item.

proration_behavior
enum<string>

Whether to create prorations when updating the subscription item.

Available options:
create_prorations,
none
schedule
object[] | null

The schedule for the subscription item.

tax_rate
string

The identifier of the tax rate for the subscription item.

transfer_behavior
enum<string>

The transfer behavior for the subscription item.

Available options:
automatic,
owner,
none
transfer_destination
string

The identifier of the connected account to transfer funds to.

Response

200 - application/json

Update a subscription item

id
string
required

Unique identifier for the object.

created
number
required

Time at which the object was created. Measured in seconds since the Unix epoch.

object
enum<string>
required
Available options:
subscription_item
description
string | null
required

The description of the subscription item.

price
string | null
required

The identifier of the price for the subscription item.

Pattern: ^[a-zA-Z0-9_]+$
price_data
object
required

The price data for the subscription item.

schedule
object[] | null
required

The schedule for the subscription item.

subscription
string
required

The identifier of the subscription the item belongs to.

Pattern: ^[a-zA-Z0-9_]+$
tax_rate
string | null
required

The identifier of the tax rate for the subscription item.

Pattern: ^[a-zA-Z0-9_]+$
transfer_behavior
enum<string> | null
required

The transfer behavior for the subscription item.

Available options:
automatic,
owner,
none,
null
transfer_destination
string | null
required

The identifier of the connected account to transfer funds to.

Pattern: ^[a-zA-Z0-9_]+$
type
enum<string>
required

The type of the subscription item.

Available options:
charge,
rent,
product
unit
string | null
required

The identifier of the unit associated with the subscription item.

Pattern: ^[a-zA-Z0-9_]+$
account
string

The account that the object belongs to. Only returned if the request is made with a valid Yorlet-Context header.

deleted
boolean
default:false

Only returned if the object has been deleted.

metadata
object | null

Set of key-value pairs attached to the subscription item.