Get a purchase
curl --request GET \
--url https://api.kit.com/v4/purchases/{id} \
--header 'Authorization: Bearer <token>'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/purchases/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyconst options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.kit.com/v4/purchases/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.kit.com/v4/purchases/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kit.com/v4/purchases/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.kit.com/v4/purchases/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"purchase": {
"id": 14,
"transaction_id": "796-92-4892",
"subscriber_id": 24,
"status": "paid",
"email_address": "pru.magoo@convertkit.dev",
"currency": "USD",
"transaction_time": "2023-02-17T11:43:55Z",
"subtotal": 78.66,
"discount": 5,
"tax": 7.87,
"total": 81.53,
"products": [
{
"quantity": 1,
"lid": "811-75-7900",
"unit_price": 23.22,
"sku": null,
"name": "Phantom Hourglass",
"pid": "804-02-4430"
},
{
"quantity": 1,
"lid": "766-49-1241",
"unit_price": 32.22,
"sku": null,
"name": "Twilight Princess",
"pid": "833-51-1151"
}
],
"source": "Gumroad"
}
}{
"errors": [
"The access token is invalid"
]
}{
"errors": [
"Not Found"
]
}Purchases
Get a purchase
Returns a single purchase’s details: transaction_id, status, source, the buyer’s email_address and subscriber_id, monetary breakdown (subtotal, discount, tax, total, currency), transaction_time, and the purchased products with quantities and unit prices.
GET
/
v4
/
purchases
/
{id}
Get a purchase
curl --request GET \
--url https://api.kit.com/v4/purchases/{id} \
--header 'Authorization: Bearer <token>'require 'uri'
require 'net/http'
url = URI("https://api.kit.com/v4/purchases/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_bodyconst options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.kit.com/v4/purchases/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.kit.com/v4/purchases/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.kit.com/v4/purchases/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://api.kit.com/v4/purchases/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text){
"purchase": {
"id": 14,
"transaction_id": "796-92-4892",
"subscriber_id": 24,
"status": "paid",
"email_address": "pru.magoo@convertkit.dev",
"currency": "USD",
"transaction_time": "2023-02-17T11:43:55Z",
"subtotal": 78.66,
"discount": 5,
"tax": 7.87,
"total": 81.53,
"products": [
{
"quantity": 1,
"lid": "811-75-7900",
"unit_price": 23.22,
"sku": null,
"name": "Phantom Hourglass",
"pid": "804-02-4430"
},
{
"quantity": 1,
"lid": "766-49-1241",
"unit_price": 32.22,
"sku": null,
"name": "Twilight Princess",
"pid": "833-51-1151"
}
],
"source": "Gumroad"
}
}{
"errors": [
"The access token is invalid"
]
}{
"errors": [
"Not Found"
]
}Was this page helpful?
⌘I