Buy credits with a machine payment
curl --request POST \
--url https://www.vidguy.ai/api/v1/credits/topup/{credits} \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.vidguy.ai/api/v1/credits/topup/{credits}"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.vidguy.ai/api/v1/credits/topup/{credits}', 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.vidguy.ai/api/v1/credits/topup/{credits}",
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.vidguy.ai/api/v1/credits/topup/{credits}"
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.vidguy.ai/api/v1/credits/topup/{credits}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.vidguy.ai/api/v1/credits/topup/{credits}")
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{
"creditsAdded": 123,
"newBalance": 123,
"duplicate": true,
"rail": "x402",
"reference": "<string>",
"amountUsd": "<string>",
"network": "<string>",
"method": "<string>"
}{
"error": "Invalid request",
"message": "<string>",
"details": {}
}{
"error": "payment_required",
"credits": 123,
"amountUsd": "<string>",
"rails": [
"x402"
],
"message": "<string>",
"offers": [
{
"credits": 123,
"priceUsd": "<string>",
"url": "<string>"
}
],
"register": "<string>"
}{
"error": "Invalid request",
"message": "<string>",
"details": {}
}{
"error": "Invalid request",
"message": "<string>",
"details": {}
}{
"error": "Invalid request",
"message": "<string>",
"details": {}
}{
"error": "Invalid request",
"message": "<string>",
"details": {}
}Créditos
Buy credits with a machine payment
POST with your API key (X-Api-Key or Authorization: Bearer) and no payment header to receive a 402 that carries an x402 v2 PAYMENT-REQUIRED header (USDC on Base / Solana) and a Stripe MPP WWW-Authenticate: Payment challenge (Shared Payment Token cards, Tempo USDC). Pay with either, then retry the same request with PAYMENT-SIGNATURE (x402) or Payment-Authorization (MPP). Credits are granted on settlement and never expire; a replayed settlement returns the same 200 with duplicate: true. Without an API key and without a payment header the 402 carries the x402 challenge only (this is what the x402 Bazaar indexes); a paid retry without an API key is refused with 401 before anything settles.
POST
/
api
/
v1
/
credits
/
topup
/
{credits}
Buy credits with a machine payment
curl --request POST \
--url https://www.vidguy.ai/api/v1/credits/topup/{credits} \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.vidguy.ai/api/v1/credits/topup/{credits}"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.vidguy.ai/api/v1/credits/topup/{credits}', 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.vidguy.ai/api/v1/credits/topup/{credits}",
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.vidguy.ai/api/v1/credits/topup/{credits}"
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.vidguy.ai/api/v1/credits/topup/{credits}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.vidguy.ai/api/v1/credits/topup/{credits}")
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{
"creditsAdded": 123,
"newBalance": 123,
"duplicate": true,
"rail": "x402",
"reference": "<string>",
"amountUsd": "<string>",
"network": "<string>",
"method": "<string>"
}{
"error": "Invalid request",
"message": "<string>",
"details": {}
}{
"error": "payment_required",
"credits": 123,
"amountUsd": "<string>",
"rails": [
"x402"
],
"message": "<string>",
"offers": [
{
"credits": 123,
"priceUsd": "<string>",
"url": "<string>"
}
],
"register": "<string>"
}{
"error": "Invalid request",
"message": "<string>",
"details": {}
}{
"error": "Invalid request",
"message": "<string>",
"details": {}
}{
"error": "Invalid request",
"message": "<string>",
"details": {}
}{
"error": "Invalid request",
"message": "<string>",
"details": {}
}
