Checkout a project using account credit
curl --request POST \
--url https://www.postable.com/api/v1/cart/checkout/{projectUuid} \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.postable.com/api/v1/cart/checkout/{projectUuid}"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.postable.com/api/v1/cart/checkout/{projectUuid}', 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://www.postable.com/api/v1/cart/checkout/{projectUuid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.postable.com/api/v1/cart/checkout/{projectUuid}"
req, _ := http.NewRequest("POST", 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))
}HttpResponse<String> response = Unirest.post("https://www.postable.com/api/v1/cart/checkout/{projectUuid}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.postable.com/api/v1/cart/checkout/{projectUuid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"order_id": 123,
"credit_charged": 123,
"remaining_credit": 123
}
}{
"message": "No account credit available to process order",
"credit_available": 123,
"order_total": 123
}{
"message": "Project not found"
}Cart
Checkout Project
Process an order for a project using account credit
POST
/
cart
/
checkout
/
{projectUuid}
Checkout a project using account credit
curl --request POST \
--url https://www.postable.com/api/v1/cart/checkout/{projectUuid} \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.postable.com/api/v1/cart/checkout/{projectUuid}"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.postable.com/api/v1/cart/checkout/{projectUuid}', 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://www.postable.com/api/v1/cart/checkout/{projectUuid}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.postable.com/api/v1/cart/checkout/{projectUuid}"
req, _ := http.NewRequest("POST", 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))
}HttpResponse<String> response = Unirest.post("https://www.postable.com/api/v1/cart/checkout/{projectUuid}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.postable.com/api/v1/cart/checkout/{projectUuid}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"order_id": 123,
"credit_charged": 123,
"remaining_credit": 123
}
}{
"message": "No account credit available to process order",
"credit_available": 123,
"order_total": 123
}{
"message": "Project not found"
}Overview
Checkout a project and process the order using your account credit. This endpoint will:- Add the project to your cart
- Process the order using your available account credit
- Return the order details including the amount charged
Requirements
- The project must have at least one recipient
- You must have sufficient account credit to cover the order total
- Your cart must be empty or only contain this project
Credit Handling
If you have insufficient credit, the response will include:credit_available: Your current account credit balanceorder_total: The total amount needed to process the order
Example Response
{
"data": {
"order_id": 12345,
"credit_charged": 25.50,
"remaining_credit": 74.50
}
}