API Keys
Retrieve or create yur API Key from the dashboard. Learn more about it here.
Create a payment
Use this simple payment intent payload to create a payment for any arbitrary amount.Example payload used; metadata can be changed (or removed) to any key-value items of your choice.
Currencies
Your customers can pay you with any currency of their choice, we automatically settle it for you.
Idempotency
We support idempotent requests to help you retry safely without creating duplicate payments.
Payment schema
The create invoice API supports many more parameters to adapt to your business needs, read more here.
Redirect your customer
You can pass
redirect_url to send your customers to a custom link. It supports dynamic data as well.POST https://api.bitgpt.xyz/invoices
{
customer_email: "example@gmail.com",
items: [
{
type: "PAYMENT_INTENT",
currency: "GBP",
price: "10"
}
],
metadata: {
any_custom_key_1: "any_custom_value_1",
any_custom_key_2: "any_custom_value_2"
}
}
cURL
curl -X POST https://api.bitgpt.xyz/invoices \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"customer_email": "example@gmail.com",
"items": [
{
"type": "PAYMENT_INTENT",
"currency": "GBP",
"price": "10"
}
],
"metadata": {
"any_custom_key_1": "any_custom_value_1",
"any_custom_key_2": "any_custom_value_2"
}
}'
const { v4: uuidv4 } = require('uuid');
const fetch = require('node-fetch');
const idempotencyKey = uuidv4();
fetch('https://api.bitgpt.xyz/invoices', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
'Idempotency-Key': idempotencyKey
},
body: JSON.stringify({
customer_email: "example@gmail.com",
items: [
{
type: "PAYMENT_INTENT",
currency: "GBP",
price: "10"
}
],
metadata: {
any_custom_key_1: "any_custom_value_1",
any_custom_key_2: "any_custom_value_2"
}
})
})
.then(res => res.json())
.then(data => console.log(data));
import fetch from 'node-fetch';
import { v4 as uuidv4 } from 'uuid';
const payload = {
customer_email: "example@gmail.com",
items: [
{
type: "PAYMENT_INTENT",
currency: "GBP",
price: "10"
}
],
metadata: {
any_custom_key_1: "any_custom_value_1",
any_custom_key_2: "any_custom_value_2"
}
};
async function createInvoice() {
const res = await fetch("https://api.bitgpt.xyz/invoices", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
"Idempotency-Key": uuidv4()
},
body: JSON.stringify(payload)
});
const data = await res.json();
console.log(data);
}
createInvoice();
<?php
$payload = json_encode([
"customer_email" => "example@gmail.com",
"items" => [
[
"type" => "PAYMENT_INTENT",
"currency" => "GBP",
"price" => "10"
]
],
"metadata" => [
"any_custom_key_1" => "any_custom_value_1",
"any_custom_key_2" => "any_custom_value_2"
]
]);
$idempotencyKey = bin2hex(random_bytes(16));
$ch = curl_init('https://api.bitgpt.xyz/invoices');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
'Idempotency-Key: ' . $idempotencyKey
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
import requests
import uuid
payload = {
"customer_email": "example@gmail.com",
"items": [
{
"type": "PAYMENT_INTENT",
"currency": "GBP",
"price": "10"
}
],
"metadata": {
"any_custom_key_1": "any_custom_value_1",
"any_custom_key_2": "any_custom_value_2"
}
}
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
"Idempotency-Key": str(uuid.uuid4())
}
response = requests.post("https://api.bitgpt.xyz/invoices", json=payload, headers=headers)
print(response.json())
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.UUID;
public class CreateInvoice {
public static void main(String[] args) throws Exception {
URL url = new URL("https://api.bitgpt.xyz/invoices");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Authorization", "Bearer YOUR_API_KEY");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Idempotency-Key", UUID.randomUUID().toString());
con.setDoOutput(true);
String jsonInputString = """
{
"customer_email": "example@gmail.com",
"items": [
{
"type": "PAYMENT_INTENT",
"currency": "GBP",
"price": "10"
}
],
"metadata": {
"any_custom_key_1": "any_custom_value_1",
"any_custom_key_2": "any_custom_value_2"
}
}
""";
try (OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
java.io.InputStream is = con.getInputStream();
byte[] response = is.readAllBytes();
System.out.println(new String(response));
}
}
package main
import (
"bytes"
"crypto/rand"
"encoding/hex"
"fmt"
"io"
"net/http"
)
func generateUUIDv4() string {
b := make([]byte, 16)
rand.Read(b)
b[6] = (b[6] & 0x0f) | 0x40 // Version 4
b[8] = (b[8] & 0x3f) | 0x80 // Variant
return fmt.Sprintf("%08x-%04x-%04x-%04x-%012x",
b[0:4], b[4:6], b[6:8], b[8:10], b[10:16])
}
func main() {
jsonStr := []byte(`{
"customer_email": "example@gmail.com",
"items": [
{
"type": "PAYMENT_INTENT",
"currency": "GBP",
"price": "10"
}
],
"metadata": {
"any_custom_key_1": "any_custom_value_1",
"any_custom_key_2": "any_custom_value_2"
}
}`)
req, err := http.NewRequest("POST", "https://api.bitgpt.xyz/invoices", bytes.NewBuffer(jsonStr))
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Idempotency-Key", generateUUIDv4())
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
use reqwest::blocking::Client;
use serde_json::json;
use uuid::Uuid;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let payload = json!({
"customer_email": "example@gmail.com",
"items": [
{
"type": "PAYMENT_INTENT",
"currency": "GBP",
"price": "10"
}
],
"metadata": {
"any_custom_key_1": "any_custom_value_1",
"any_custom_key_2": "any_custom_value_2"
}
});
let idempotency_key = Uuid::new_v4().to_string();
let res = client
.post("https://api.bitgpt.xyz/invoices")
.header("Authorization", "Bearer YOUR_API_KEY")
.header("Content-Type", "application/json")
.header("Idempotency-Key", idempotency_key)
.json(&payload)
.send()?
.text()?;
println!("{}", res);
Ok(())
}
Redirect to checkout
Redirect the customer to
https://pay.bitgpt.xyz/{response.data.id}The invoice id at
response.data.id will look like this: invoice_0197c626-8ab2-7ab6-8a20-78ae53a606d3Handle webhooks
Webhook handling recipe
Use the recipe for webhook handling to listen to status changes and invoice completion.

