Buy credits with the saved card or bank account
Charges the company’s saved card or bank account off-session and grants the credits, and the bonus its tier gives, once Stripe reports the money received: at once for a card that succeeds, else when the payment settles. The server prices every purchase: expected_credit_cents must equal what it quotes, and terms_version the terms in force, or nothing is charged (409). A repeat of the same purchase_key charges once and returns the first purchase (200). A declined card returns the purchase as failed with its reason. Needs billing.update; never a Droplet token.
curl --request POST \
--url https://api.fluid.app/api/settings/billing/credits/purchases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount_cents": 100000,
"expected_credit_cents": 110000,
"purchase_key": "3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36",
"terms_version": "2026-09-26"
}
'import requests
url = "https://api.fluid.app/api/settings/billing/credits/purchases"
payload = {
"amount_cents": 100000,
"expected_credit_cents": 110000,
"purchase_key": "3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36",
"terms_version": "2026-09-26"
}
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({
amount_cents: 100000,
expected_credit_cents: 110000,
purchase_key: '3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36',
terms_version: '2026-09-26'
})
};
fetch('https://api.fluid.app/api/settings/billing/credits/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://api.fluid.app/api/settings/billing/credits/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([
'amount_cents' => 100000,
'expected_credit_cents' => 110000,
'purchase_key' => '3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36',
'terms_version' => '2026-09-26'
]),
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://api.fluid.app/api/settings/billing/credits/purchases"
payload := strings.NewReader("{\n \"amount_cents\": 100000,\n \"expected_credit_cents\": 110000,\n \"purchase_key\": \"3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36\",\n \"terms_version\": \"2026-09-26\"\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://api.fluid.app/api/settings/billing/credits/purchases")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount_cents\": 100000,\n \"expected_credit_cents\": 110000,\n \"purchase_key\": \"3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36\",\n \"terms_version\": \"2026-09-26\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/settings/billing/credits/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 \"amount_cents\": 100000,\n \"expected_credit_cents\": 110000,\n \"purchase_key\": \"3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36\",\n \"terms_version\": \"2026-09-26\"\n}"
response = http.request(request)
puts response.read_body{
"credit_purchase": {
"id": 7342,
"origin": "manual",
"status": "succeeded",
"instrument_type": "card",
"failure_message": null,
"amount_cents": 100000,
"bonus_percent": 10,
"bonus_cents": 10000,
"credit_cents": 110000,
"refunded_cents": 0,
"credits_expire_at": "2027-09-12T16:20:05Z",
"created_at": "2026-09-12T16:19:58Z",
"succeeded_at": "2026-09-12T16:20:05Z",
"failed_at": null
},
"balance_cents": 185500,
"duplicate": true,
"status": 200,
"meta": {
"request_id": "f3b8c2d1-6a4e-4f7b-9c1d-2e5a8b7c4d90",
"timestamp": "2026-09-30T14:05:11Z"
}
}{
"credit_purchase": {
"id": 7342,
"origin": "manual",
"status": "succeeded",
"instrument_type": "card",
"failure_message": null,
"amount_cents": 100000,
"bonus_percent": 10,
"bonus_cents": 10000,
"credit_cents": 110000,
"refunded_cents": 0,
"credits_expire_at": "2027-09-12T16:20:05Z",
"created_at": "2026-09-12T16:19:58Z",
"succeeded_at": "2026-09-12T16:20:05Z",
"failed_at": null
},
"balance_cents": 185500,
"duplicate": false,
"status": 201,
"meta": {
"request_id": "f3b8c2d1-6a4e-4f7b-9c1d-2e5a8b7c4d90",
"timestamp": "2026-09-30T14:05:11Z"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}Authorizations
Bearer token authentication
Body
Response
A repeat of the purchase key; the first purchase
One purchase of credits: what was paid, what it granted, and where its money stands. succeeded means the credits were granted; processing means the payment is still settling.
Show child attributes
Show child attributes
The credit balance after the purchase
Whether this returns a purchase already made with the same key.
curl --request POST \
--url https://api.fluid.app/api/settings/billing/credits/purchases \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount_cents": 100000,
"expected_credit_cents": 110000,
"purchase_key": "3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36",
"terms_version": "2026-09-26"
}
'import requests
url = "https://api.fluid.app/api/settings/billing/credits/purchases"
payload = {
"amount_cents": 100000,
"expected_credit_cents": 110000,
"purchase_key": "3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36",
"terms_version": "2026-09-26"
}
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({
amount_cents: 100000,
expected_credit_cents: 110000,
purchase_key: '3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36',
terms_version: '2026-09-26'
})
};
fetch('https://api.fluid.app/api/settings/billing/credits/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://api.fluid.app/api/settings/billing/credits/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([
'amount_cents' => 100000,
'expected_credit_cents' => 110000,
'purchase_key' => '3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36',
'terms_version' => '2026-09-26'
]),
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://api.fluid.app/api/settings/billing/credits/purchases"
payload := strings.NewReader("{\n \"amount_cents\": 100000,\n \"expected_credit_cents\": 110000,\n \"purchase_key\": \"3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36\",\n \"terms_version\": \"2026-09-26\"\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://api.fluid.app/api/settings/billing/credits/purchases")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount_cents\": 100000,\n \"expected_credit_cents\": 110000,\n \"purchase_key\": \"3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36\",\n \"terms_version\": \"2026-09-26\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/settings/billing/credits/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 \"amount_cents\": 100000,\n \"expected_credit_cents\": 110000,\n \"purchase_key\": \"3f7a2c91-8e4d-4b6a-9c15-e2d8b0f47a36\",\n \"terms_version\": \"2026-09-26\"\n}"
response = http.request(request)
puts response.read_body{
"credit_purchase": {
"id": 7342,
"origin": "manual",
"status": "succeeded",
"instrument_type": "card",
"failure_message": null,
"amount_cents": 100000,
"bonus_percent": 10,
"bonus_cents": 10000,
"credit_cents": 110000,
"refunded_cents": 0,
"credits_expire_at": "2027-09-12T16:20:05Z",
"created_at": "2026-09-12T16:19:58Z",
"succeeded_at": "2026-09-12T16:20:05Z",
"failed_at": null
},
"balance_cents": 185500,
"duplicate": true,
"status": 200,
"meta": {
"request_id": "f3b8c2d1-6a4e-4f7b-9c1d-2e5a8b7c4d90",
"timestamp": "2026-09-30T14:05:11Z"
}
}{
"credit_purchase": {
"id": 7342,
"origin": "manual",
"status": "succeeded",
"instrument_type": "card",
"failure_message": null,
"amount_cents": 100000,
"bonus_percent": 10,
"bonus_cents": 10000,
"credit_cents": 110000,
"refunded_cents": 0,
"credits_expire_at": "2027-09-12T16:20:05Z",
"created_at": "2026-09-12T16:19:58Z",
"succeeded_at": "2026-09-12T16:20:05Z",
"failed_at": null
},
"balance_cents": 185500,
"duplicate": false,
"status": 201,
"meta": {
"request_id": "f3b8c2d1-6a4e-4f7b-9c1d-2e5a8b7c4d90",
"timestamp": "2026-09-30T14:05:11Z"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"error": "<string>",
"error_message": "<string>",
"errors": "<string>",
"meta": {
"request_id": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
}