Send Payment
curl --request POST \
--url https://api.zbdpay.com/v0/payments \
--header 'Content-Type: application/json' \
--header 'apikey: <apikey>' \
--data '
{
"invoice": "<string>",
"description": "<string>",
"amount": "<string>",
"internalId": "<string>",
"callbackUrl": "<string>"
}
'import requests
url = "https://api.zbdpay.com/v0/payments"
payload = {
"invoice": "<string>",
"description": "<string>",
"amount": "<string>",
"internalId": "<string>",
"callbackUrl": "<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({
invoice: '<string>',
description: '<string>',
amount: '<string>',
internalId: '<string>',
callbackUrl: '<string>'
})
};
fetch('https://api.zbdpay.com/v0/payments', 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/payments",
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([
'invoice' => '<string>',
'description' => '<string>',
'amount' => '<string>',
'internalId' => '<string>',
'callbackUrl' => '<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/payments"
payload := strings.NewReader("{\n \"invoice\": \"<string>\",\n \"description\": \"<string>\",\n \"amount\": \"<string>\",\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<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/payments")
.header("apikey", "<apikey>")
.header("Content-Type", "application/json")
.body("{\n \"invoice\": \"<string>\",\n \"description\": \"<string>\",\n \"amount\": \"<string>\",\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zbdpay.com/v0/payments")
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 \"invoice\": \"<string>\",\n \"description\": \"<string>\",\n \"amount\": \"<string>\",\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Payment done.",
"data": {
"id": "caafd318-527c-466b-81f2-441d3a092aae",
"fee": "2000",
"unit": "msats",
"amount": "101000",
"invoice": "lnbc1010n1p3mt8akpp5uyxhllflux2fvl36wjxh80wtqzdh2vjmu8cdyzuap578az80v74qdqcd3hzucmpwd5zqurp09kk2mn5cqzpgxqzjhsp550s770zy4puj76wqnua0hmym883gr07dhuast5ygcm44grl6z7ns9qyyssqgf7sumdmxwzgkq2m0h9lcv530sqs0m4t4shlu98djrrckrtulcmr8rear70dyftdm67jvgncxgz4jmd6ksx87jvnj88e39un48ssk4gp8vs4u5",
"preimage": "8a14f6da89d4a8ffd09677f585b7c377de72744b7c3713d3c115fa71ca4fc290",
"internalId": "11af01d092444a317cb33faa6b8304b8",
"status": "completed"
"processedAt": "2023-01-04T15:48:29.805Z",
"confirmedAt": "2023-01-04T15:48:29.805Z",
"description": "Custom Payment Description",
}
}
Lightning Payments
Send Payment
Start sending instant Bitcoin payments through the ZBD API.
POST
/
v0
/
payments
Send Payment
curl --request POST \
--url https://api.zbdpay.com/v0/payments \
--header 'Content-Type: application/json' \
--header 'apikey: <apikey>' \
--data '
{
"invoice": "<string>",
"description": "<string>",
"amount": "<string>",
"internalId": "<string>",
"callbackUrl": "<string>"
}
'import requests
url = "https://api.zbdpay.com/v0/payments"
payload = {
"invoice": "<string>",
"description": "<string>",
"amount": "<string>",
"internalId": "<string>",
"callbackUrl": "<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({
invoice: '<string>',
description: '<string>',
amount: '<string>',
internalId: '<string>',
callbackUrl: '<string>'
})
};
fetch('https://api.zbdpay.com/v0/payments', 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/payments",
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([
'invoice' => '<string>',
'description' => '<string>',
'amount' => '<string>',
'internalId' => '<string>',
'callbackUrl' => '<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/payments"
payload := strings.NewReader("{\n \"invoice\": \"<string>\",\n \"description\": \"<string>\",\n \"amount\": \"<string>\",\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<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/payments")
.header("apikey", "<apikey>")
.header("Content-Type", "application/json")
.body("{\n \"invoice\": \"<string>\",\n \"description\": \"<string>\",\n \"amount\": \"<string>\",\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zbdpay.com/v0/payments")
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 \"invoice\": \"<string>\",\n \"description\": \"<string>\",\n \"amount\": \"<string>\",\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Payment done.",
"data": {
"id": "caafd318-527c-466b-81f2-441d3a092aae",
"fee": "2000",
"unit": "msats",
"amount": "101000",
"invoice": "lnbc1010n1p3mt8akpp5uyxhllflux2fvl36wjxh80wtqzdh2vjmu8cdyzuap578az80v74qdqcd3hzucmpwd5zqurp09kk2mn5cqzpgxqzjhsp550s770zy4puj76wqnua0hmym883gr07dhuast5ygcm44grl6z7ns9qyyssqgf7sumdmxwzgkq2m0h9lcv530sqs0m4t4shlu98djrrckrtulcmr8rear70dyftdm67jvgncxgz4jmd6ksx87jvnj88e39un48ssk4gp8vs4u5",
"preimage": "8a14f6da89d4a8ffd09677f585b7c377de72744b7c3713d3c115fa71ca4fc290",
"internalId": "11af01d092444a317cb33faa6b8304b8",
"status": "completed"
"processedAt": "2023-01-04T15:48:29.805Z",
"confirmedAt": "2023-01-04T15:48:29.805Z",
"description": "Custom Payment Description",
}
}
Description
This endpoint sends a payment on the Bitcoin Lightning Network. This is one of the main APIs which allow you to pay any Charge in the network.The words Charge, Payment Request, and Invoice can be seen as equivalent in the context of requesting funds in the Bitcoin Lightning Network.
Usage
All payments in the Lightning Network are asynchronous. Though possible, most payments will not settle immediately on the API invocation. They do however tend to settle immediately thereafter, which means you MUST to provide thecallbackUrl to receive updates about your app’s payments.
If the Charge does not have a predefined amount (e.g. an
amountless invoice), you can pass an amount property with a defined value to this API call.Configuration
Header Parameters
Body
Amount to be paid to this Charge/Invoice -> in millisatoshis (only valid if Amountless Invoice)
{
"success": true,
"message": "Payment done.",
"data": {
"id": "caafd318-527c-466b-81f2-441d3a092aae",
"fee": "2000",
"unit": "msats",
"amount": "101000",
"invoice": "lnbc1010n1p3mt8akpp5uyxhllflux2fvl36wjxh80wtqzdh2vjmu8cdyzuap578az80v74qdqcd3hzucmpwd5zqurp09kk2mn5cqzpgxqzjhsp550s770zy4puj76wqnua0hmym883gr07dhuast5ygcm44grl6z7ns9qyyssqgf7sumdmxwzgkq2m0h9lcv530sqs0m4t4shlu98djrrckrtulcmr8rear70dyftdm67jvgncxgz4jmd6ksx87jvnj88e39un48ssk4gp8vs4u5",
"preimage": "8a14f6da89d4a8ffd09677f585b7c377de72744b7c3713d3c115fa71ca4fc290",
"internalId": "11af01d092444a317cb33faa6b8304b8",
"status": "completed"
"processedAt": "2023-01-04T15:48:29.805Z",
"confirmedAt": "2023-01-04T15:48:29.805Z",
"description": "Custom Payment Description",
}
}
Was this page helpful?