Decode Charge
curl --request POST \
--url https://api.zbdpay.com/v0/decode-invoice \
--header 'Content-Type: application/json' \
--header 'apikey: <apikey>' \
--data '
{
"invoice": "<string>"
}
'import requests
url = "https://api.zbdpay.com/v0/decode-invoice"
payload = { "invoice": "<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>'})
};
fetch('https://api.zbdpay.com/v0/decode-invoice', 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/decode-invoice",
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>'
]),
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/decode-invoice"
payload := strings.NewReader("{\n \"invoice\": \"<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/decode-invoice")
.header("apikey", "<apikey>")
.header("Content-Type", "application/json")
.body("{\n \"invoice\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zbdpay.com/v0/decode-invoice")
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}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"amount": "212325000",
"lnRequest": "lnbc2123250n1pjpr2qmpp526234tljpx5756pa2fyj2zrdmn2tnz9rhj54km2s7dv0pap3vtkqhp5extcuyp2x0ydfwnfhrc5cwx8azxeen2g7hxr29464ezvn3k6w2fqcqzpgxqzjcsp5xzelh2w3twt4ysvva2ugu2klurmrl7nk8h46x2hcthf9cvee24jq9qyyssq6an9tjftjymjeklerjmw8cv4ccpsvd2vzuzxn5upt9s37hnw2r0z0n5cd8cqq8jq5ems00tugt5jnw5jn03tr84945nd6j4hsfsu7kqp9hptk2",
"lnExpiresAt": "2023-03-15T11:22:27.000Z",
"network": "bitcoin",
"description": "Paying for Master Sword #5546",
"descriptionHash": "c9978e102a33c8d4ba69b8f14c38c7e88d9ccd48f5cc3516baae44c9c6da7292",
"paymentHash": "56951aaff209a9ea683d524925086ddcd4b988a3bca95b6d50f358f0f43162ec",
"paymentSecret": "30b3fba9d15b9752418ceab88e2adfe0f63ffa763deba32af85dd25c33395564",
"payee": "036ff83834666d3ebfe61c2a7d1f8fc5d6b339a26559a61819e2b0d1b5f540fdfc",
"signature": "d76655c92b91372cdbf91cb6e3e195c60306354c170469d38159611f5e6e50de27ce9869f0001e40a67707bd7c42e929ba929be2b19ea5ad26dd4ab78261cf58"
}
}
Lightning Charges
Decode Charge
Understand the inner properties of a Charge QR code.
POST
/
v0
/
decode-invoice
Decode Charge
curl --request POST \
--url https://api.zbdpay.com/v0/decode-invoice \
--header 'Content-Type: application/json' \
--header 'apikey: <apikey>' \
--data '
{
"invoice": "<string>"
}
'import requests
url = "https://api.zbdpay.com/v0/decode-invoice"
payload = { "invoice": "<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>'})
};
fetch('https://api.zbdpay.com/v0/decode-invoice', 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/decode-invoice",
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>'
]),
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/decode-invoice"
payload := strings.NewReader("{\n \"invoice\": \"<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/decode-invoice")
.header("apikey", "<apikey>")
.header("Content-Type", "application/json")
.body("{\n \"invoice\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zbdpay.com/v0/decode-invoice")
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}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"amount": "212325000",
"lnRequest": "lnbc2123250n1pjpr2qmpp526234tljpx5756pa2fyj2zrdmn2tnz9rhj54km2s7dv0pap3vtkqhp5extcuyp2x0ydfwnfhrc5cwx8azxeen2g7hxr29464ezvn3k6w2fqcqzpgxqzjcsp5xzelh2w3twt4ysvva2ugu2klurmrl7nk8h46x2hcthf9cvee24jq9qyyssq6an9tjftjymjeklerjmw8cv4ccpsvd2vzuzxn5upt9s37hnw2r0z0n5cd8cqq8jq5ems00tugt5jnw5jn03tr84945nd6j4hsfsu7kqp9hptk2",
"lnExpiresAt": "2023-03-15T11:22:27.000Z",
"network": "bitcoin",
"description": "Paying for Master Sword #5546",
"descriptionHash": "c9978e102a33c8d4ba69b8f14c38c7e88d9ccd48f5cc3516baae44c9c6da7292",
"paymentHash": "56951aaff209a9ea683d524925086ddcd4b988a3bca95b6d50f358f0f43162ec",
"paymentSecret": "30b3fba9d15b9752418ceab88e2adfe0f63ffa763deba32af85dd25c33395564",
"payee": "036ff83834666d3ebfe61c2a7d1f8fc5d6b339a26559a61819e2b0d1b5f540fdfc",
"signature": "d76655c92b91372cdbf91cb6e3e195c60306354c170469d38159611f5e6e50de27ce9869f0001e40a67707bd7c42e929ba929be2b19ea5ad26dd4ab78261cf58"
}
}
Usage
This API is used for further decyphering the details of a Charge. The idea is to use this API endpoint if you have to validate any of the specific properties of this Payment Request.Any Lightning Network Charge can be used as a property here, even those not generated by the ZBD API.
Configuration
Header Parameters
Body
{
"success": true,
"data": {
"amount": "212325000",
"lnRequest": "lnbc2123250n1pjpr2qmpp526234tljpx5756pa2fyj2zrdmn2tnz9rhj54km2s7dv0pap3vtkqhp5extcuyp2x0ydfwnfhrc5cwx8azxeen2g7hxr29464ezvn3k6w2fqcqzpgxqzjcsp5xzelh2w3twt4ysvva2ugu2klurmrl7nk8h46x2hcthf9cvee24jq9qyyssq6an9tjftjymjeklerjmw8cv4ccpsvd2vzuzxn5upt9s37hnw2r0z0n5cd8cqq8jq5ems00tugt5jnw5jn03tr84945nd6j4hsfsu7kqp9hptk2",
"lnExpiresAt": "2023-03-15T11:22:27.000Z",
"network": "bitcoin",
"description": "Paying for Master Sword #5546",
"descriptionHash": "c9978e102a33c8d4ba69b8f14c38c7e88d9ccd48f5cc3516baae44c9c6da7292",
"paymentHash": "56951aaff209a9ea683d524925086ddcd4b988a3bca95b6d50f358f0f43162ec",
"paymentSecret": "30b3fba9d15b9752418ceab88e2adfe0f63ffa763deba32af85dd25c33395564",
"payee": "036ff83834666d3ebfe61c2a7d1f8fc5d6b339a26559a61819e2b0d1b5f540fdfc",
"signature": "d76655c92b91372cdbf91cb6e3e195c60306354c170469d38159611f5e6e50de27ce9869f0001e40a67707bd7c42e929ba929be2b19ea5ad26dd4ab78261cf58"
}
}
Was this page helpful?