Skip to main content
POST
/
payments
/
items
/
{customer_type}
/
{customer_id}
/
{item_id}
/
update-quantity
Update Item Quantity
curl --request POST \
  --url https://api.hexclave.com/api/v1/payments/items/{customer_type}/{customer_id}/{item_id}/update-quantity \
  --header 'Content-Type: application/json' \
  --data '
{
  "delta": 100,
  "expires_at": "2024-12-31T23:59:59Z",
  "description": "Monthly subscription renewal"
}
'
import requests

url = "https://api.hexclave.com/api/v1/payments/items/{customer_type}/{customer_id}/{item_id}/update-quantity"

payload = {
"delta": 100,
"expires_at": "2024-12-31T23:59:59Z",
"description": "Monthly subscription renewal"
}
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({
delta: 100,
expires_at: '2024-12-31T23:59:59Z',
description: 'Monthly subscription renewal'
})
};

fetch('https://api.hexclave.com/api/v1/payments/items/{customer_type}/{customer_id}/{item_id}/update-quantity', 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.hexclave.com/api/v1/payments/items/{customer_type}/{customer_id}/{item_id}/update-quantity",
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([
'delta' => 100,
'expires_at' => '2024-12-31T23:59:59Z',
'description' => 'Monthly subscription renewal'
]),
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://api.hexclave.com/api/v1/payments/items/{customer_type}/{customer_id}/{item_id}/update-quantity"

payload := strings.NewReader("{\n \"delta\": 100,\n \"expires_at\": \"2024-12-31T23:59:59Z\",\n \"description\": \"Monthly subscription renewal\"\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://api.hexclave.com/api/v1/payments/items/{customer_type}/{customer_id}/{item_id}/update-quantity")
.header("Content-Type", "application/json")
.body("{\n \"delta\": 100,\n \"expires_at\": \"2024-12-31T23:59:59Z\",\n \"description\": \"Monthly subscription renewal\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.hexclave.com/api/v1/payments/items/{customer_type}/{customer_id}/{item_id}/update-quantity")

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 \"delta\": 100,\n \"expires_at\": \"2024-12-31T23:59:59Z\",\n \"description\": \"Monthly subscription renewal\"\n}"

response = http.request(request)
puts response.read_body
{}

Path Parameters

customer_type
enum<string>
required

The type of customer

Available options:
user,
team,
custom
Example:

"user"

customer_id
string
required

The ID of the customer

Example:

"user_1234567890abcdef"

item_id
string
required

The ID of the item to update

Example:

"credits"

Query Parameters

allow_negative
enum<string>
required

Whether to allow the quantity to go negative

Available options:
true,
false
Example:

"false"

Body

application/json
delta
integer
required

The amount to change the quantity by (positive to increase, negative to decrease)

Example:

100

expires_at
string

Optional expiration date for this quantity change (ISO 8601 format)

Example:

"2024-12-31T23:59:59Z"

description
string

Optional description for this quantity change

Example:

"Monthly subscription renewal"

Response

200 - application/json

Successful response

The response is of type object.