Create Static Charge
curl --request POST \
--url https://api.zbdpay.com/v0/static-charges \
--header 'Content-Type: application/json' \
--header 'apikey: <apikey>' \
--data '
{
"minAmount": "<string>",
"maxAmount": "<string>",
"description": "<string>",
"successMessage": "<string>",
"allowedSlots": 123,
"internalId": "<string>",
"callbackUrl": "<string>",
"identifier": "<string>"
}
'import requests
url = "https://api.zbdpay.com/v0/static-charges"
payload = {
"minAmount": "<string>",
"maxAmount": "<string>",
"description": "<string>",
"successMessage": "<string>",
"allowedSlots": 123,
"internalId": "<string>",
"callbackUrl": "<string>",
"identifier": "<string>"
}
headers = {
"apikey": "<apikey>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<apikey>', 'Content-Type': 'application/json'},
body: JSON.stringify({
minAmount: '<string>',
maxAmount: '<string>',
description: '<string>',
successMessage: '<string>',
allowedSlots: 123,
internalId: '<string>',
callbackUrl: '<string>',
identifier: '<string>'
})
};
fetch('https://api.zbdpay.com/v0/static-charges', 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.zbdpay.com/v0/static-charges",
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([
'minAmount' => '<string>',
'maxAmount' => '<string>',
'description' => '<string>',
'successMessage' => '<string>',
'allowedSlots' => 123,
'internalId' => '<string>',
'callbackUrl' => '<string>',
'identifier' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <apikey>"
],
]);
$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.zbdpay.com/v0/static-charges"
payload := strings.NewReader("{\n \"minAmount\": \"<string>\",\n \"maxAmount\": \"<string>\",\n \"description\": \"<string>\",\n \"successMessage\": \"<string>\",\n \"allowedSlots\": 123,\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"identifier\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<apikey>")
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.zbdpay.com/v0/static-charges")
.header("apikey", "<apikey>")
.header("Content-Type", "application/json")
.body("{\n \"minAmount\": \"<string>\",\n \"maxAmount\": \"<string>\",\n \"description\": \"<string>\",\n \"successMessage\": \"<string>\",\n \"allowedSlots\": 123,\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"identifier\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zbdpay.com/v0/static-charges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<apikey>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"minAmount\": \"<string>\",\n \"maxAmount\": \"<string>\",\n \"description\": \"<string>\",\n \"successMessage\": \"<string>\",\n \"allowedSlots\": 123,\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"identifier\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message":"Successfully created Static Charge.",
"data":{
"id":"45c225b1-022b-4a37-98d6-5a5568f78d11",
"unit":"msats",
"slots":0,
"minAmount":"10000",
"maxAmount":"100000",
"createdAt":"2023-03-07T20:07:06.910Z",
"expiresAt":null,
"internalId":"myInternalId",
"description":"Static Charge API Ref",
"callbackUrl":"https://my-website/zbd-callback",
"allowedSlots":1000,
"successMessage":"Congratulations your payment was successful!",
"status":"active",
"invoice":{
"request":"lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9aex2ut4v4ehgttnw3shg6tr943ksctjvajhxte5x43nyv34vgcj6vpjxf3z6drpxvmj6wfcvsmz6dtpx56nvwrxxuuxgvf3uzvpfy",
"uri":"lightning:lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9aex2ut4v4ehgttnw3shg6tr943ksctjvajhxte5x43nyv34vgcj6vpjxf3z6drpxvmj6wfcvsmz6dtpx56nvwrxxuuxgvf3uzvpfy"
}
}
}
Lightning Charges
Create Static Charge
Start accepting payments on Lightning with Static QR codes.
POST
/
v0
/
static-charges
Create Static Charge
curl --request POST \
--url https://api.zbdpay.com/v0/static-charges \
--header 'Content-Type: application/json' \
--header 'apikey: <apikey>' \
--data '
{
"minAmount": "<string>",
"maxAmount": "<string>",
"description": "<string>",
"successMessage": "<string>",
"allowedSlots": 123,
"internalId": "<string>",
"callbackUrl": "<string>",
"identifier": "<string>"
}
'import requests
url = "https://api.zbdpay.com/v0/static-charges"
payload = {
"minAmount": "<string>",
"maxAmount": "<string>",
"description": "<string>",
"successMessage": "<string>",
"allowedSlots": 123,
"internalId": "<string>",
"callbackUrl": "<string>",
"identifier": "<string>"
}
headers = {
"apikey": "<apikey>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<apikey>', 'Content-Type': 'application/json'},
body: JSON.stringify({
minAmount: '<string>',
maxAmount: '<string>',
description: '<string>',
successMessage: '<string>',
allowedSlots: 123,
internalId: '<string>',
callbackUrl: '<string>',
identifier: '<string>'
})
};
fetch('https://api.zbdpay.com/v0/static-charges', 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.zbdpay.com/v0/static-charges",
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([
'minAmount' => '<string>',
'maxAmount' => '<string>',
'description' => '<string>',
'successMessage' => '<string>',
'allowedSlots' => 123,
'internalId' => '<string>',
'callbackUrl' => '<string>',
'identifier' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <apikey>"
],
]);
$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.zbdpay.com/v0/static-charges"
payload := strings.NewReader("{\n \"minAmount\": \"<string>\",\n \"maxAmount\": \"<string>\",\n \"description\": \"<string>\",\n \"successMessage\": \"<string>\",\n \"allowedSlots\": 123,\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"identifier\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("apikey", "<apikey>")
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.zbdpay.com/v0/static-charges")
.header("apikey", "<apikey>")
.header("Content-Type", "application/json")
.body("{\n \"minAmount\": \"<string>\",\n \"maxAmount\": \"<string>\",\n \"description\": \"<string>\",\n \"successMessage\": \"<string>\",\n \"allowedSlots\": 123,\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"identifier\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zbdpay.com/v0/static-charges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["apikey"] = '<apikey>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"minAmount\": \"<string>\",\n \"maxAmount\": \"<string>\",\n \"description\": \"<string>\",\n \"successMessage\": \"<string>\",\n \"allowedSlots\": 123,\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\",\n \"identifier\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message":"Successfully created Static Charge.",
"data":{
"id":"45c225b1-022b-4a37-98d6-5a5568f78d11",
"unit":"msats",
"slots":0,
"minAmount":"10000",
"maxAmount":"100000",
"createdAt":"2023-03-07T20:07:06.910Z",
"expiresAt":null,
"internalId":"myInternalId",
"description":"Static Charge API Ref",
"callbackUrl":"https://my-website/zbd-callback",
"allowedSlots":1000,
"successMessage":"Congratulations your payment was successful!",
"status":"active",
"invoice":{
"request":"lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9aex2ut4v4ehgttnw3shg6tr943ksctjvajhxte5x43nyv34vgcj6vpjxf3z6drpxvmj6wfcvsmz6dtpx56nvwrxxuuxgvf3uzvpfy",
"uri":"lightning:lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9aex2ut4v4ehgttnw3shg6tr943ksctjvajhxte5x43nyv34vgcj6vpjxf3z6drpxvmj6wfcvsmz6dtpx56nvwrxxuuxgvf3uzvpfy"
}
}
}
Description
Static Charges are static Payment Requests in the Bitcoin Lightning Network. Whereas Charges create fixed-amount and single-use Payment Requests that expire, Static Charges provide you a lot more flexibility & capabilities, including:-
Variable Amounts -> Static Charges have both
minAmountandmaxAmountproperties, allowing for variable amounts set by the payer. - Multi-use -> By default Static Charges have no expiration time, making them usable for any N payers/payments.
- Success Message -> When a payer completes the payment flow for this Static Charge, a Success Message is displayed to them.
-
Slots -> Static Charges can also have the notion of
allowedSlots. This means only N payments will be accepted at this Static Charge before disabling them.
internalId and callbackUrl.
Usage
Use this API endpoint to create advanced Payment Requests on the Bitcoin Lightning Network. Enjoy static QR codes that can accept any number of payments, for various amounts, with additional metadata in the payment flow.You can create a
multi-use Static Charge with a fixed amount too, simply by setting minAmount and maxAmount to the same amount.Configuration
Header Parameters
Body
{
"message":"Successfully created Static Charge.",
"data":{
"id":"45c225b1-022b-4a37-98d6-5a5568f78d11",
"unit":"msats",
"slots":0,
"minAmount":"10000",
"maxAmount":"100000",
"createdAt":"2023-03-07T20:07:06.910Z",
"expiresAt":null,
"internalId":"myInternalId",
"description":"Static Charge API Ref",
"callbackUrl":"https://my-website/zbd-callback",
"allowedSlots":1000,
"successMessage":"Congratulations your payment was successful!",
"status":"active",
"invoice":{
"request":"lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9aex2ut4v4ehgttnw3shg6tr943ksctjvajhxte5x43nyv34vgcj6vpjxf3z6drpxvmj6wfcvsmz6dtpx56nvwrxxuuxgvf3uzvpfy",
"uri":"lightning:lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9aex2ut4v4ehgttnw3shg6tr943ksctjvajhxte5x43nyv34vgcj6vpjxf3z6drpxvmj6wfcvsmz6dtpx56nvwrxxuuxgvf3uzvpfy"
}
}
}
Was this page helpful?