Create
curl --request POST \
--url https://{defaultHost}/v1/purchases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"purchase": {
"customer_id": "5ff39da4-b809-4732-8961-027716f35d85",
"price_id": "b0d96b99-d340-4599-b360-c16a95371e67",
"revoke_at": "2026-11-18 07:50:37 UTC"
}
}
'import requests
url = "https://{defaultHost}/v1/purchases"
payload = { "purchase": {
"customer_id": "5ff39da4-b809-4732-8961-027716f35d85",
"price_id": "b0d96b99-d340-4599-b360-c16a95371e67",
"revoke_at": "2026-11-18 07:50:37 UTC"
} }
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({
purchase: {
customer_id: '5ff39da4-b809-4732-8961-027716f35d85',
price_id: 'b0d96b99-d340-4599-b360-c16a95371e67',
revoke_at: '2026-11-18 07:50:37 UTC'
}
})
};
fetch('https://{defaultHost}/v1/purchases', 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://{defaultHost}/v1/purchases",
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([
'purchase' => [
'customer_id' => '5ff39da4-b809-4732-8961-027716f35d85',
'price_id' => 'b0d96b99-d340-4599-b360-c16a95371e67',
'revoke_at' => '2026-11-18 07:50:37 UTC'
]
]),
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://{defaultHost}/v1/purchases"
payload := strings.NewReader("{\n \"purchase\": {\n \"customer_id\": \"5ff39da4-b809-4732-8961-027716f35d85\",\n \"price_id\": \"b0d96b99-d340-4599-b360-c16a95371e67\",\n \"revoke_at\": \"2026-11-18 07:50:37 UTC\"\n }\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://{defaultHost}/v1/purchases")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"purchase\": {\n \"customer_id\": \"5ff39da4-b809-4732-8961-027716f35d85\",\n \"price_id\": \"b0d96b99-d340-4599-b360-c16a95371e67\",\n \"revoke_at\": \"2026-11-18 07:50:37 UTC\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/purchases")
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 \"purchase\": {\n \"customer_id\": \"5ff39da4-b809-4732-8961-027716f35d85\",\n \"price_id\": \"b0d96b99-d340-4599-b360-c16a95371e67\",\n \"revoke_at\": \"2026-11-18 07:50:37 UTC\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "c706c71d-c112-43ce-8519-e34b3366811d",
"object": "purchase",
"live_mode": true,
"quantity": 1,
"revoked": false,
"revoked_at": null,
"revoke_at": 1794988237,
"customer": "5ff39da4-b809-4732-8961-027716f35d85",
"initial_order": null,
"license": null,
"price": "b0d96b99-d340-4599-b360-c16a95371e67",
"product": "71f2c2de-f1e0-46dd-a4d6-a2386b5b150c",
"subscription": null,
"variant": null,
"review": null,
"created_at": 1794901837,
"updated_at": 1794901837
}Purchases
Create
Creates a new purchase.
POST
/
v1
/
purchases
Create
curl --request POST \
--url https://{defaultHost}/v1/purchases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"purchase": {
"customer_id": "5ff39da4-b809-4732-8961-027716f35d85",
"price_id": "b0d96b99-d340-4599-b360-c16a95371e67",
"revoke_at": "2026-11-18 07:50:37 UTC"
}
}
'import requests
url = "https://{defaultHost}/v1/purchases"
payload = { "purchase": {
"customer_id": "5ff39da4-b809-4732-8961-027716f35d85",
"price_id": "b0d96b99-d340-4599-b360-c16a95371e67",
"revoke_at": "2026-11-18 07:50:37 UTC"
} }
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({
purchase: {
customer_id: '5ff39da4-b809-4732-8961-027716f35d85',
price_id: 'b0d96b99-d340-4599-b360-c16a95371e67',
revoke_at: '2026-11-18 07:50:37 UTC'
}
})
};
fetch('https://{defaultHost}/v1/purchases', 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://{defaultHost}/v1/purchases",
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([
'purchase' => [
'customer_id' => '5ff39da4-b809-4732-8961-027716f35d85',
'price_id' => 'b0d96b99-d340-4599-b360-c16a95371e67',
'revoke_at' => '2026-11-18 07:50:37 UTC'
]
]),
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://{defaultHost}/v1/purchases"
payload := strings.NewReader("{\n \"purchase\": {\n \"customer_id\": \"5ff39da4-b809-4732-8961-027716f35d85\",\n \"price_id\": \"b0d96b99-d340-4599-b360-c16a95371e67\",\n \"revoke_at\": \"2026-11-18 07:50:37 UTC\"\n }\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://{defaultHost}/v1/purchases")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"purchase\": {\n \"customer_id\": \"5ff39da4-b809-4732-8961-027716f35d85\",\n \"price_id\": \"b0d96b99-d340-4599-b360-c16a95371e67\",\n \"revoke_at\": \"2026-11-18 07:50:37 UTC\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{defaultHost}/v1/purchases")
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 \"purchase\": {\n \"customer_id\": \"5ff39da4-b809-4732-8961-027716f35d85\",\n \"price_id\": \"b0d96b99-d340-4599-b360-c16a95371e67\",\n \"revoke_at\": \"2026-11-18 07:50:37 UTC\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "c706c71d-c112-43ce-8519-e34b3366811d",
"object": "purchase",
"live_mode": true,
"quantity": 1,
"revoked": false,
"revoked_at": null,
"revoke_at": 1794988237,
"customer": "5ff39da4-b809-4732-8961-027716f35d85",
"initial_order": null,
"license": null,
"price": "b0d96b99-d340-4599-b360-c16a95371e67",
"product": "71f2c2de-f1e0-46dd-a4d6-a2386b5b150c",
"subscription": null,
"variant": null,
"review": null,
"created_at": 1794901837,
"updated_at": 1794901837
}Authorizations
Response
200 - application/json
Success
Expandable – The associated customer ID.
The first order that initiated this purchase.
Expandable – The associated order ID.
Expandable – The associated license ID.
Expandable – Property not returned unless expanded.
Expandable – Property not returned unless expanded.
Expandable – The associated price ID.
Expandable – The associated product ID.
Expandable – The associated subscription ID.
Expandable – The associated variant ID.
Expandable – The associated review ID.
Was this page helpful?