Create Charge
curl --request POST \
--url https://api.zbdpay.com/v0/gamertag/charges \
--header 'Content-Type: application/json' \
--header 'apikey: <apikey>' \
--data '
{
"amount": "<string>",
"gamertag": "<string>",
"description": "<string>",
"expiresIn": 123,
"internalId": "<string>",
"callbackUrl": "<string>"
}
'import requests
url = "https://api.zbdpay.com/v0/gamertag/charges"
payload = {
"amount": "<string>",
"gamertag": "<string>",
"description": "<string>",
"expiresIn": 123,
"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({
amount: '<string>',
gamertag: '<string>',
description: '<string>',
expiresIn: 123,
internalId: '<string>',
callbackUrl: '<string>'
})
};
fetch('https://api.zbdpay.com/v0/gamertag/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/gamertag/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([
'amount' => '<string>',
'gamertag' => '<string>',
'description' => '<string>',
'expiresIn' => 123,
'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/gamertag/charges"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"gamertag\": \"<string>\",\n \"description\": \"<string>\",\n \"expiresIn\": 123,\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/gamertag/charges")
.header("apikey", "<apikey>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"gamertag\": \"<string>\",\n \"description\": \"<string>\",\n \"expiresIn\": 123,\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zbdpay.com/v0/gamertag/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 \"amount\": \"<string>\",\n \"gamertag\": \"<string>\",\n \"description\": \"<string>\",\n \"expiresIn\": 123,\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"unit": "msats",
"status": "CHARGE_PENDING",
"amount": "15000",
"createdAt": "2023-03-14T19:40:13.880Z",
"internalId": "test",
"callbackUrl": "https://my-website.ngrok.io/callback",
"description": "Requesting Charge for Gamertag",
"invoiceRequest": "lnbc10n1pjppnvapp5camc852ky0et9g46gyey9mnv5xgux6tnkkq5qc6cexrr65xw2j9sdps2fjhzat9wd6xjmn8yppksctjvajjqen0wgsywctdv4e8gct8cqzpgxqzjcsp5jgs84mxjwk8n9r7xmp7ulzycy7882f5m8zagk45s2qp23p7rprqq9qyyssq3ysvdsgg5qvx0nwtlz46hcrucs7m6nkvsffcze5nhes40hqrnnes3xjcq0a4wtpqvvrdqlyqy3sz5yhqh6944unan4d32py2azq38zgq4c5ysu",
"invoiceExpiresAt": "2023-03-14T19:50:13.859Z",
"invoiceDescriptionHash": null
}
}
Gamertags
Create Charge
Generate a payment request for a ZBD User.
POST
/
v0
/
gamertag
/
charges
Create Charge
curl --request POST \
--url https://api.zbdpay.com/v0/gamertag/charges \
--header 'Content-Type: application/json' \
--header 'apikey: <apikey>' \
--data '
{
"amount": "<string>",
"gamertag": "<string>",
"description": "<string>",
"expiresIn": 123,
"internalId": "<string>",
"callbackUrl": "<string>"
}
'import requests
url = "https://api.zbdpay.com/v0/gamertag/charges"
payload = {
"amount": "<string>",
"gamertag": "<string>",
"description": "<string>",
"expiresIn": 123,
"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({
amount: '<string>',
gamertag: '<string>',
description: '<string>',
expiresIn: 123,
internalId: '<string>',
callbackUrl: '<string>'
})
};
fetch('https://api.zbdpay.com/v0/gamertag/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/gamertag/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([
'amount' => '<string>',
'gamertag' => '<string>',
'description' => '<string>',
'expiresIn' => 123,
'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/gamertag/charges"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"gamertag\": \"<string>\",\n \"description\": \"<string>\",\n \"expiresIn\": 123,\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/gamertag/charges")
.header("apikey", "<apikey>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"gamertag\": \"<string>\",\n \"description\": \"<string>\",\n \"expiresIn\": 123,\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zbdpay.com/v0/gamertag/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 \"amount\": \"<string>\",\n \"gamertag\": \"<string>\",\n \"description\": \"<string>\",\n \"expiresIn\": 123,\n \"internalId\": \"<string>\",\n \"callbackUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"unit": "msats",
"status": "CHARGE_PENDING",
"amount": "15000",
"createdAt": "2023-03-14T19:40:13.880Z",
"internalId": "test",
"callbackUrl": "https://my-website.ngrok.io/callback",
"description": "Requesting Charge for Gamertag",
"invoiceRequest": "lnbc10n1pjppnvapp5camc852ky0et9g46gyey9mnv5xgux6tnkkq5qc6cexrr65xw2j9sdps2fjhzat9wd6xjmn8yppksctjvajjqen0wgsywctdv4e8gct8cqzpgxqzjcsp5jgs84mxjwk8n9r7xmp7ulzycy7882f5m8zagk45s2qp23p7rprqq9qyyssq3ysvdsgg5qvx0nwtlz46hcrucs7m6nkvsffcze5nhes40hqrnnes3xjcq0a4wtpqvvrdqlyqy3sz5yhqh6944unan4d32py2azq38zgq4c5ysu",
"invoiceExpiresAt": "2023-03-14T19:50:13.859Z",
"invoiceDescriptionHash": null
}
}
Description
While you can use the Pay to ZBD Gamertag endpoint to make a direct Bitcoin payment to a given ZBD user, if for whatever reason you’d want to create a general Lightning Network Charge / Payment Request QR code, you can use this endpoint.The response payload will include a
invoiceRequest which is the contents of the Charge / Payment Request QR code. Do note that Charges have defined expiration times. After a Charge expires it cannot be paid, simply create another Charge.Important: ZBD Gamertags are mutable and can be changed by users at any time. If you’re implementing user-specific limits (e.g., 1 withdrawal per day) or tracking balances, do not use Gamertags as identifiers. Instead, use the Get ID by ZBD Gamertag endpoint to retrieve the immutable User ID for each Gamertag, then track limits and balances using that User ID. Otherwise, users can bypass your limits simply by changing their Gamertag.
Configuration
Header Parameters
ZBD Project API Key
Content Type
Body
The amount for the Payment -> in millisatoshis
Destination ZBD Gamertag
Note or comment for this Payment (visible to recipient)
Time until Charge expiration -> in seconds
Open metadata string property
The endpoint ZBD will POST Charge updates to
{
"success": true,
"data": {
"unit": "msats",
"status": "CHARGE_PENDING",
"amount": "15000",
"createdAt": "2023-03-14T19:40:13.880Z",
"internalId": "test",
"callbackUrl": "https://my-website.ngrok.io/callback",
"description": "Requesting Charge for Gamertag",
"invoiceRequest": "lnbc10n1pjppnvapp5camc852ky0et9g46gyey9mnv5xgux6tnkkq5qc6cexrr65xw2j9sdps2fjhzat9wd6xjmn8yppksctjvajjqen0wgsywctdv4e8gct8cqzpgxqzjcsp5jgs84mxjwk8n9r7xmp7ulzycy7882f5m8zagk45s2qp23p7rprqq9qyyssq3ysvdsgg5qvx0nwtlz46hcrucs7m6nkvsffcze5nhes40hqrnnes3xjcq0a4wtpqvvrdqlyqy3sz5yhqh6944unan4d32py2azq38zgq4c5ysu",
"invoiceExpiresAt": "2023-03-14T19:50:13.859Z",
"invoiceDescriptionHash": null
}
}
Was this page helpful?
⌘I