# ZBD Documentation
Source: https://docs.zbdpay.com/get-started
Global Payment Service Provider for Gaming and Interactive Entertainment
export const Footer = () => {
return
Need help?{" "}
Contact Support
.
Check out our{" "}
changelog
.
Questions?{" "}
Contact Sales
.
LLM?{" "}
Read llms.txt
.
;
};
The global payment infrastructure built for the speed and scale of gaming. Process thousands of transactions per second, enable true micropayments, and unlock new monetization models – all through a single API.
Lightning-fast global settlements that keep pace with gameplay
Finally make 1 cent transactions profitable with fees under \$0.0001
One API for global payments. No banking relationships needed.
## Why Developers Choose ZBD
**Built for Gaming Scale**
* Handle millions of transactions for players
* Microtransactions that actually make economical sense
**New Monetization Models**
* Pay-per-minute gameplay
* Real-money tournaments
* Cross-game economies
* Player-to-player trading
**Modern Payment Infrastructure**
* Instant global settlements
* Multi-currency support (USD, EUR, BTC, USDC)
* 99.99% uptime SLA
* Developer-first APIs
**Use Cases**
* Streaming payments
* Creator economy
* API usage billing
* International payouts
**Increase Revenue**
* Higher conversion with lower payment friction
* Unlock previously unprofitable price points
* Expand to Tier 1 global markets compliantly instantly
**Reduce Costs**
* 90% lower fees than cards for small payments
* Eliminate chargeback losses
## Products
### 💳 Payments
Enable instant global payments in your apps and games with multi-currency support for Bitcoin, Lightning Network, USD, EUR and Stablecoins. We handle the complexity of payments infrastructure so you can focus on building amazing experiences.
Let users buy Bitcoin and USDC directly in your app. First widget with Lightning Address support.
Send and receive instant payments globally. Lightning, on-chain, and fiat settlements.
Production-ready SDK with TypeScript examples and starter templates.
Enable AI agents and LLMs to process payments autonomously.
Getting started with ZBD Payments is as simple as:
```bash TypeScript / Node.js
pnpm install @zbddev/payments-sdk
```
```bash Rust
cargo add zebedee-rust
```
```bash HTTP
curl -X GET https://api.zebedee.io/v0/wallet \
-H "apikey: YOUR_API_KEY"
```
### 🎮 Rewards
Drive user engagement, boost retention, and unlock new revenue streams by offering real-money rewards and incentives across your experiences.
Unity SDK for adding Bitcoin rewards to your games. Drag, drop, monetize.
Programmatically distribute rewards. Perfect for tournaments and achievements.
OAuth2 authentication with built-in wallet creation and KYC.
White-label wallet app for players to manage and cash out rewards.
## Quick Start Guides
[Schedule a 15-minute call](https://zbd.one/sales) with our team to discuss your use case and get access
Pick the products that fit your needs - Payments, Rewards, or both
Use our comprehensive documentation and SDKs to integrate in hours, not weeks
Go live with production access and our team's support
### Start with These Guides
Send your first payment in minutes
Add fiat-to-crypto in your app
Monetize your Unity game
## Developer Resources
Complete API documentation with examples
TypeScript, Go, Rust, C# and more
## Ready to Transform Your Payment Experience?
**Schedule a Demo** - Talk to our team about your use case and get your API keys. Most developers are up and running within 24 hours.
# Add Funds to your Account
Source: https://docs.zbdpay.com/get-started/add-funds
Fund your ZBD wallet to start processing instant global payments
Your ZBD wallet is the heart of your payment operations. Add funds in seconds and start moving money at the speed of the internet. Multiple funding options ensure you can always keep your wallet topped up.
**Lightning Speed** - Deposits via Lightning Network are instant. As soon as you send funds, they're available in your wallet. No waiting for confirmations.
## Funding Options
Instant deposits from any Lightning wallet or exchange
USD to Lightning coming soon via ZBD Onramp
## Lightning Deposits (Instant)
The fastest way to add funds. Generate an invoice and pay from any Lightning-enabled service.
### How to Generate a Lightning Invoice
Go to your project's Wallet tab in the dashboard
Select "Lightning Invoice" as your deposit method
Specify how many satoshis you want to add
Scan QR code or copy invoice to pay from another Lightning-compatible wallet
## Fiat Onramp (Coming Soon)
**Direct USD Deposits** - Soon you'll be able to buy Bitcoin directly in the Developer Dashboard using ACH bank transfers. Funds will arrive instantly at your project's Lightning address.
### What to Expect
* **Bank Transfer** - Connect your business bank account
* **Instant Conversion** - USD → Bitcoin → Your wallet
* **Competitive Rates** - Better than most exchanges
* **No External Accounts** - Everything within ZBD
Want early access to fiat deposits? [Talk to your success manager](https://zbd.one/sales).
## Welcome Vouchers
New to ZBD? Your Customer Success Manager can provide welcome vouchers to help you get started.
### How It Works
Mention you'd like to test the platform
Get an 8-character code via email
Go to Vouchers and enter code
Use funds to test integrations
### Best Practices
Keep 20% extra for payment spikes
Monitor low balance thresholds
**Contact Support** - Our team can guide you through the funding process and recommend the best approach for your use case.
# API Keys
Source: https://docs.zbdpay.com/get-started/api-keys
Generate and secure your keys to unlock Lightning-fast payments
API keys are your passport to the ZBD platform. With a single key, you can send payments globally, create invoices, manage wallets, and build the future of digital payments.
**Security First** - API keys are server-side only and grant full access to your project's wallet. Never expose them in client-side code, mobile apps, or public repositories.
## Your First API Key
Navigate to your project's **API** tab to view and manage your API keys.
### What You Can Do With API Keys
Pay any Lightning Address or invoice instantly
Generate invoices and process incoming payments
Check balances and transaction history
Issue redeemable payment links
## Quick Start Example
Once you have your API key, you're ready to send your first payment:
```bash cURL
curl -X POST https://api.zebedee.io/v0/payments \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": "1000",
"description": "First payment!",
"internalId": "test-001",
"callbackUrl": "https://myapp.com/webhook"
}'
```
```javascript Node.js
const payment = await fetch('https://api.zebedee.io/v0/payments', {
method: 'POST',
headers: {
'apikey': process.env.ZBD_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '1000',
description: 'First payment!',
internalId: 'test-001'
})
});
```
## Security Best Practices
### 🔐 Secure Storage
```bash
# .env file (never commit this!)
ZBD_API_KEY=your_api_key_here
# Access in code
const apiKey = process.env.ZBD_API_KEY;
```
**Best for**: Local development and deployment platforms
Use dedicated secret management services:
* **AWS Secrets Manager**
* **Google Secret Manager**
* **HashiCorp Vault**
* **Azure Key Vault**
**Best for**: Production environments
Configure secrets in your deployment pipeline:
* **GitHub Actions**: Repository secrets
* **Vercel**: Environment variables
* **Heroku**: Config vars
* **Docker**: Build secrets
**Best for**: Automated deployments
### 🛡️ IP Allowlisting
Restrict API access to specific IP addresses for maximum security:
**How to Configure:**
1. Navigate to your project's API tab
2. Click "API Access Controls"
3. Add your server's IP addresses
4. Save changes
**Dynamic IPs?** If your infrastructure uses dynamic IPs (like serverless functions), consider using a proxy service with static IPs or contact our team for alternative security options.
## Key Rotation & Regeneration
Regular key rotation is a security best practice. Here's when and how to do it:
### When to Rotate Keys
* ⏰ **Scheduled**: Every 90 days as a best practice
* 🚨 **Immediately if**:
* Key exposed in client code
* Committed to version control
* Employee with access leaves
* Suspicious activity detected
### How to Regenerate
**Important**: Regenerating creates a new key and immediately disables the old one. Update your applications before regenerating to avoid downtime.
### Zero-Downtime Rotation Strategy
Schedule during low-traffic period
Test new key in staging environment
Update production with new key
Once deployed, regenerate in dashboard
Watch logs for any failed authentications
## API Key Permissions (Coming Soon)
**Scoped Permissions** - Soon you'll be able to create keys with limited permissions:
* Read-only keys for analytics
* Payment-only keys for point-of-sale
* Receive-only keys for donation pages
## Testing Your API Key
Use this simple test to verify your key is working:
```bash cURL
curl https://api.zebedee.io/v0/wallet \
-H "apikey: YOUR_API_KEY"
```
```javascript Node.js
// Quick test script
const testApiKey = async () => {
const response = await fetch('https://api.zebedee.io/v0/wallet', {
headers: { 'apikey': process.env.ZBD_API_KEY }
});
if (response.ok) {
console.log('✅ API key is valid!');
const wallet = await response.json();
console.log('Balance:', wallet.data.balance, 'sats');
} else {
console.error('❌ API key test failed:', response.status);
}
};
testApiKey();
```
## Ready to Build?
You now have everything needed to start integrating ZBD payments into your application.
Use our SDKs to send your first Lightning payment
Explore all available endpoints
# Create Account
Source: https://docs.zbdpay.com/get-started/create-account
Get started with ZBD in minutes
Creating a ZBD account gives you access to the most advanced payment infrastructure in gaming. Here's how to get started.
## Before You Begin
**Business Account Required** - ZBD is designed for businesses, game studios, and professional developers. You'll need to complete business verification (KYB) to access production features.
### What You'll Need
* Company name and website
* Business registration details
* Tax ID / EIN (US) or equivalent
* UBO (if applicable)
* Your work email address
* Phone number
* Your role at the company
## Account Creation Process
### Step 1: Schedule Your Onboarding Call
**Required First Step** - Our team will guide you through the onboarding process and ensure ZBD is the right fit for your needs. Schedule a quick 15-minute call to get started.
During the call, we'll discuss:
* Your use case and integration needs
* Pricing based on your expected volume
* Compliance requirements for your region
* Timeline to get you live
### Step 2: Create Your Account
After your sales call, you'll receive an invitation to create your account.
1. **Access the Dashboard** - Use the link provided by our team
2. **Enter Your Information** - Fill in your user details
3. **Set a Strong Password** - Must include uppercase, lowercase, numbers, and symbols
4. **Accept Terms** - Review and accept our Terms of Service
### Step 3: Verify Your Email
Check your inbox for a 6-digit verification code.
Verification codes expire after 10 minutes. If yours expires, you can request a new one.
### Step 4: Complete Business Verification
After email verification, you'll be guided through our KYB (Know Your Business) process:
Provide company registration documents
Verify business ownership structure
Describe your intended use of ZBD
**Verification Timeline**: Most businesses are verified within 24 hours. Complex cases may take 2-3 business days.
## After Account Creation
Once verified, you'll have access to:
Set up your first project and get API keys
Fund your wallet to start processing payments
Start integrating with our quickstart guides
## Ready to Transform Your Payments?
**Schedule Your Onboarding Call** - Join thousands of developers building the future of digital payments. Our team is ready to help you get started.
# Create Project
Source: https://docs.zbdpay.com/get-started/create-project
Set up your first ZBD project and unlock the power of Lightning payments
Projects are your gateway to the future of payments. Each project gets its own Lightning wallet, API keys, and analytics – everything you need to integrate ZBD into your app or game.
**One Account, Multiple Projects** - Create separate projects for different apps, environments, or business units. Each project has isolated wallets and permissions.
## Why Projects Matter
Each project has its own Bitcoin Lightning wallet with separate balances
Get your API key per project with specific permissions
Track performance metrics per project independently
## Creating Your First Project
### Step 1: Navigate to Projects
From your dashboard, click **Projects** in the sidebar and then the **+ New Project** button.
### Step 2: Configure Your Project
Fill in your project details in the creation modal:
### Step 3: Create and Explore
Click **Create Project** and you will be redirected to your new project's wallet page.
## What Happens Next
Once your project is created, you instantly get:
A programmable Bitcoin Lightning wallet ready for instant global payments
Head to the API Keys tab to generate your first key
Use our SDKs to send your first payment in minutes
## Project Best Practices
### Environment Strategy
Create separate projects for each environment:
* **MyGame - Development**: Sandbox testing with test transactions
* **MyGame - Staging**: Pre-production testing with real money
* **MyGame - Production**: Live environment for real users
This separation ensures clean analytics and prevents accidental transactions.
Organize projects by application:
* **Mobile Game**: iOS and Android API keys sharing one wallet
* **Web Platform**: Separate wallet with frontend/backend keys
* **Tournament System**: Isolated wallet for prize pools
Each app gets its own analytics and wallet management.
### Common Use Cases
* **Separate projects per game** for isolated economies
* **Shared project for tournaments** across multiple games
* **Dev/staging/prod projects** for each game
* **API product project** for usage-based billing
* **Marketplace project** for user-to-user payments
* **Regional projects** for compliance separation
* **Client projects** with isolated wallets
* **Demo project** for POCs and sales
* **Template projects** for quick starts
## Quick Actions After Creation
Generate your first API key to start integrating
Add funds to start processing payments
Use our SDK to send your first Lightning payment
## Success! You have Created Your First Project 🎉
You are now ready to revolutionize payments in your application. Your Lightning wallet is active and waiting for its first transaction.
**Generate Your API Keys** - Get your API credentials and send your first payment in under 5 minutes.
***
Quick start guides for all languages
Explore all available endpoints
# Developer Dashboard
Source: https://docs.zbdpay.com/get-started/dev-dashboard
Your command center for global payments and real-money rewards
The ZBD Developer Dashboard is where you manage everything – from API keys to real-time analytics. One dashboard to power payments across your entire platform.
## What You Get
Create multiple projects with isolated wallets and API keys
Track transactions, volumes, and user activity live
Generate and manage API keys to control the Project Wallet
Programmable Lightning wallets with instant settlement
Sandbox environment and testing utilities
KYB verification and transaction monitoring included
## Dashboard Features
### 🚀 Quick Actions
* **Send Payments** - Pay any Lightning Address instantly
* **Create Charges** - Generate payment requests with QR codes
* **Issue Vouchers** - Create redeemable payment links
* **Download Reports** - Export transaction data
### 🔧 Developer Tools
* API playground for testing endpoints
* Webhook management and logs
* SDK quick-start guides
* Code examples in multiple languages
## Who Uses the Dashboard?
**Power Your Game Economy**
* Manage in-game currencies and rewards
* Track player transactions in real-time
* Set up tournament prize pools
* Monitor cross-game economies
**Scale Global Payments**
* Multi-project support for different products
* Compliance and regulatory tools built-in
* White-label payment solutions
* Enterprise-grade reliability
Perfect for payment providers serving multiple markets
**Monetize Anything**
* Add payments to any app in minutes
* Usage-based billing for APIs
* Creator monetization tools
* Micropayment capabilities
From social apps to productivity tools
## Getting Access
ZBD requires business verification to ensure platform security and compliance. Individual developers can explore our documentation while preparing for business onboarding.
[Talk to our sales team](https://zbd.one/sales) about your use case
Quick business verification process (usually same day)
Receive your credentials and start building
## What's Next?
Step-by-step account creation guide
Set up your first project and get API keys
**Schedule a Demo** - See the dashboard in action and get your access. Most businesses are verified within 24 hours.
# Login with ZBD
Source: https://docs.zbdpay.com/get-started/login-with-zbd
# Manage Project
Source: https://docs.zbdpay.com/get-started/manage-project
Edit project settings, manage access, and control your project lifecycle
Keep your projects organized and up-to-date. From updating branding to archiving completed projects, here's everything you need to know about project management in ZBD.
**Critical Actions**: Some project management actions (like archiving) are irreversible. Always ensure you understand the implications before proceeding.
## Editing Project Details
Your project's details appear in payment flows and help organize your dashboard. Keep them current and professional.
### What You Can Edit
Appears in payment notifications to users
Internal notes for your team's reference
Your logo shown during payment flows
### How to Edit
Editing a project details is simple:
1. Navigate to **Projects** page
2. Find your project card
3. Click the project card to enter project view
4. Select **Settings** tab
5. Edit the details you want to change
6. Click **Update**
## Archiving Projects
When a project is no longer needed, archiving keeps your dashboard clean while preserving records.
**Immediate Effects of Archiving**:
* API key is permanently disabled
* No new transactions possible
* Wallet funds auto-transfer to main wallet
* Action cannot be undone
### When to Archive
* Project development is cancelled
* App/game has been sunset
* Migrating to a new project
* Cleaning up test projects
### How to Archive
Navigate to the project you want to archive
Click the Settings tab on the top
Scroll down and choose **Archive Project** from advanced options
Read the warning and click **Archive** to confirm
## Next Steps
Secure your API keys and set up IP allowlisting
Track your project's financial activity
Discuss enterprise features for larger teams
***
**Pro Tip**: Set up a project naming convention early. As you scale, having organized projects with clear names like "AppName-Prod-US" and "AppName-Dev-EU" will save hours of confusion.
# Project Wallet
Source: https://docs.zbdpay.com/get-started/project-wallet
Understand how Bitcoin Lightning wallets power your projects
Every ZBD project comes with its own programmable Bitcoin Lightning wallet. This isolated wallet gives you complete control over your project's funds, transactions, and financial operations – all accessible via API.
**Core Architecture**: 1 Project = 1 Wallet = 1 API Key. This separation ensures clean accounting, isolated risk, and granular control.
## How Project Wallets Work
Each project has its own Bitcoin balance, completely separate from other projects
Every transaction through your API key affects only this wallet
Balance changes instantly with Lightning-speed settlements
### Wallet Architecture
```mermaid
graph TB
A[Developer Account] --> B[Main Developer Wallet]
A --> C[Project 1]
A --> D[Project 2]
A --> E[Project 3]
C --> F[Project 1 Wallet]
D --> G[Project 2 Wallet]
E --> H[Project 3 Wallet]
F --> I[API Key 1]
G --> J[API Key 2]
H --> K[API Key 3]
style B fill:#f9f,stroke:#333,stroke-width:2px
style F fill:#bbf,stroke:#333,stroke-width:2px
style G fill:#bbf,stroke:#333,stroke-width:2px
style H fill:#bbf,stroke:#333,stroke-width:2px
```
## Wallet Dashboard
Navigate to your project's **Wallet** tab to access comprehensive financial data:
## Wallet Management Best Practices
**Buffer Recommendation**: Keep 1.5x your daily volume
* Monitor daily burn rate
* Automate top-ups if possible
* Plan for traffic spikes
**Protect Your Funds**
* Use IP allowlisting for API keys
* Enable 2FA on your account
* Regularly audit transactions
* Set up webhook notifications
**When to Use Multiple Projects**
* Different apps/games
* Staging vs production
* Regional separation
* Department budgets
**Financial Tracking**
* Export transactions monthly (talk to your Customer Success Manager)
* Use reference IDs for reconciliation
* Track by project for clean books
* Integrate with accounting software
## Common Wallet Operations
### Check Balance
```javascript Node.js
const wallet = await zbd.getWallet();
console.log(`Balance: ${wallet.balance} sats`);
console.log(`USD Value: $${wallet.balanceUSD}`);
```
```bash cURL
curl https://api.zebedee.io/v0/wallet \
-H "apikey: YOUR_PROJECT_API_KEY"
```
### Transfer Between Projects
```javascript Node.js
// Transfer funds between your projects
const result = await zbd.internalTransfer({
amount: 10000,
receiverWalletId: 'project_abc123',
reference: 'Budget reallocation'
});
```
```bash cURL
curl -X POST https://api.zebedee.io/v0/internal-transfer \
-H "apikey: YOUR_PROJECT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": "10000",
"receiverWalletId": "project_abc123"
}'
```
## Next Steps
Make your first Lightning payment
Monitor transaction updates in real-time
***
**Pro Tip**: Use project wallets to isolate financial risk. If one project has issues, your other projects remain unaffected. This is especially important for testing new features or running experiments.
# Sandbox Projects
Source: https://docs.zbdpay.com/get-started/sandbox-project
Test your integration risk-free with fake Bitcoin in a sandbox environment
Every developer's journey with ZBD starts in the sandbox. It's your risk-free playground where you can test payments, break things, and perfect your integration before touching real money.
**Default Environment**: All new projects start as sandbox projects. This protects you from accidentally spending real Bitcoin while learning the platform.
## What Makes Sandbox Special
10,000 free satoshis to start, top up anytime
Pre-created users with wallets for end-to-end testing
### Visual Indicators
Sandbox projects are clearly marked to prevent confusion:
Look for:
* 🧪 **"Sandbox" label** on project cards
* 🎮 **Test Bitcoin balance** (not real money!)
* 👥 **Test Users tab** only in sandbox
* 🔑 **Sandbox API endpoints** in documentation
## Sandbox Architecture
```mermaid
graph LR
A[Your App] -->|Sandbox API Key| B[ZBD Sandbox]
B --> C[Fake Lightning Network]
B --> D[Test User Wallets]
B --> E[Simulated Payments]
style B fill:#ffeb3b,stroke:#333,stroke-width:2px
style C fill:#fff9c4,stroke:#333,stroke-width:2px
style D fill:#fff9c4,stroke:#333,stroke-width:2px
style E fill:#fff9c4,stroke:#333,stroke-width:2px
```
## Getting Started with Sandbox
### Your First Sandbox Project
When you create your first project, you'll automatically get:
Pre-funded with 10,000 fake satoshis
Works only with sandbox endpoints
5 pre-created users with ZBD gamertags
All payment features available for testing
### Test Users
Click the **Test Users** tab to see your pre-created testing accounts:
Each test user has:
* Unique ZBD Gamertag
* Test wallet with balance
* Ability to receive payments
* Full transaction history
**Example Test Users**:
```
- SandboxUser1#7823
- TestPlayer42#1337
- DevTester99#2024
```
## Topping Up Your Sandbox
Running low on fake satoshis? Add more instantly:
Click "Top Up" for +10,000 sats instantly
No limits - top up as many times as needed
## Sandbox API Endpoints
Sandbox uses separate endpoints to ensure you never accidentally mix test and production:
```
Base URL: https://sandbox.api.zebedee.io
Example endpoints:
- /v0/gamertag/send
```
**Currently Limited**: Only the Send to Gamertag API is available in sandbox. More endpoints coming soon. For full API testing, complete verification for production access.
## Testing Payments in Sandbox
Let's send your first test payment:
### 1. Get Your Sandbox API Key
### 2. Send Test Payment
Use the API Playground or your own code:
```bash cURL
curl -X POST https://sandbox.api.zebedee.io/v0/gamertag/send \
-H "apikey: YOUR_SANDBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"gamertag": "SandboxUser1#7823",
"amount": "100",
"description": "Test payment!"
}'
```
```javascript Node.js
const response = await fetch('https://sandbox.api.zebedee.io/v0/gamertag/send', {
method: 'POST',
headers: {
'apikey': process.env.SANDBOX_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
gamertag: 'SandboxUser1#7823',
amount: '100',
description: 'Test payment!'
})
});
const result = await response.json();
console.log('Payment sent!', result);
```
### 3. Verify Success
Check your sandbox wallet to see the transaction:
Click on the transaction for full details:
## Transitioning to Production
Ready to handle real money? Here's your checklist:
* All payment flows tested
* Error handling verified
* Webhook integration working
* Performance acceptable
Complete KYB process for production access
New project with production API key
* Change API endpoints
* Update API key
* Enable production monitoring
* Set up error alerts
Start with small real transactions
## Troubleshooting Sandbox
Ensure you're using sandbox endpoints with sandbox keys
Test Users tab only appears in sandbox projects
Complete verification for full API access in production
Sandbox webhooks work identically to production
## Next Steps
You've mastered the sandbox! Time to level up:
Complete KYB for production access
Explore all available endpoints
Create your first production project
***
**Remember**: Sandbox is your friend. Test everything here first. Break things, experiment, and learn. That's what it's for! When you're confident everything works, production is just an endpoint change away.
# Identity Verification
Source: https://docs.zbdpay.com/get-started/verify-identity
Complete your profile to unlock production access and higher limits
Identity verification unlocks the full power of ZBD. As a regulated financial institution, we're required to verify all businesses before enabling production access – but we've made it as painless as possible.
**Why Verification Matters** - ZBD is a licensed money transmitter in the US (MSB/MTL) and an Electronic Money Institution (EMI) in the EU under MiCAR. This means your funds are protected and your business is compliant.
## Why We Verify
Get LIVE API keys to process real payments
Increase transaction and wallet balance limits
Operate legally and compliantly in Tier 1 global markets (US, EU, etc)
Your money is safeguarded by regulated entities
### Regulatory Framework
As a global payment provider, ZBD maintains licenses and registrations worldwide:
**Federal Registration**
* FinCEN registered Money Services Business (MSB)
* BSA/AML program in place
**State Licenses**
* Money Transmitter Licenses (MTL) in required states
* Compliance with state-specific regulations
**MiCAR Compliance**
* Electronic Money Institution (EMI) license
* Access to all EU member states
* Segregated customer funds
* Regular audits and reporting
**International Standards**
* FATF compliance guidelines
* Sanctions screening (OFAC, UN, EU)
* SOC 2 Type II
### Individual Verification (KYC)
For authorized representatives and beneficial owners:
* Passport (preferred)
* Driver's license
* National ID card
* Quick selfie
* Automated verification
* Instant results
## Complete Your Profile
Beyond regulatory requirements, a complete profile helps us serve you better:
### 1. Verify Email Address ✅
Already completed during signup, but ensure your business email is verified.
### 2. Choose Your Gamertag
Your ZBD Gamertag appears in payment notifications to users:
**Choose Wisely** - Your Gamertag is visible to anyone you pay. Use your business name or something professional like "AcmeGameStudio" rather than "xXx\_PayMaster\_xXx".
Good examples:
* `YourCompanyName`
* `StudioNameGames`
* `AppNameOfficial`
### 3. Upload Profile Image
Add your company logo for brand recognition in payment flows.
Requirements:
* Square image (1:1 ratio)
* PNG or JPG format
* Under 3MB
* Clear on small screens
### 4. Enable Two-Factor Authentication (2FA)
**Required for Production** - 2FA is mandatory for all accounts with production access. Protect your funds and API keys.
How to enable:
1. Navigate to **Account > Security**
2. Click **Enable 2FA**
3. Scan QR code with authenticator app
4. Enter verification code
5. Save backup codes securely
Recommended authenticator apps:
* Google Authenticator
* Authy
* 1Password
* Microsoft Authenticator
### 5. Complete Identity Verification
The final step to unlock production access:
Go to **Account > Verification** and click **Verify Now**
Take photo of passport or driver's license
Follow on-screen instructions for liveness check
Usually completed within minutes
## What Happens After Verification?
* ✅ **Production API Keys** - Start processing real payments
* ✅ **Increased Limits** - Higher transaction and balance limits
* ✅ **Full Dashboard Access** - All features unlocked
* ✅ **Priority Support** - Dedicated success manager
* 📋 **Transaction Monitoring** - Automated AML checks
* 📋 **Periodic Reviews** - Annual KYB refresh
* 📋 **Sanctions Screening** - Real-time checks
* 📋 **Regulatory Updates** - We handle compliance changes
## Common Verification Issues
Ensure photos are clear, uncropped, and all text is readable
Account name must match ID exactly
Utility bills must be recent (\< 3 months)
Ensure all pages are included and documents are current
## Need Help?
**Having Issues?** - Our compliance team can guide you through verification. Most issues are resolved in one call.
***
**Compliance = Trust** - Our regulatory compliance isn't red tape – it's your protection. It means your funds are safe, your business is legitimate, and you can scale globally without worry.
# Vouchers
Source: https://docs.zbdpay.com/get-started/vouchers
Create shareable Bitcoin gifts and promotional codes that drive engagement
Turn Bitcoin into shareable gift codes. Vouchers are redeemable payment links that let you distribute value without knowing recipients' payment details – perfect for promotions, rewards, and re-engagement campaigns.
Send Bitcoin without knowing Lightning addresses or gamertags
Create bulk codes for promotions, giveaways, and campaigns
Monitor redemption rates and campaign performance
## Why Use Vouchers?
### 🎁 User Acquisition & Retention
**The Problem**: Getting users to try your app is hard
**The Solution**: Give them immediate value
```javascript
// Create welcome bonus vouchers
const voucher = await zbd.createVoucher({
amount: 1000, // sats (~$0.50)
description: "Welcome to GameApp! 🎮"
});
// Send via email/SMS
sendWelcomeEmail(user.email, voucher.code);
```
**Result**: 3x higher activation rates
**Re-engage Dormant Users**
Send personalized vouchers to users who haven't been active:
* "We miss you! Here's 2000 sats"
* "Complete your profile for 5000 sats"
* "Return bonus: 10,000 sats"
**Case Study**: Game studio saw 40% of churned users return
**Viral Growth Mechanics**
```javascript
// Both referrer and referee get rewards
const referralVoucher = await createVoucher({
amount: 5000,
description: "Thanks for sharing!"
});
```
Users share more when they can give real value
### 🎯 Marketing & Promotions
* Twitter/X campaigns: "RT to win!"
* Discord events and contests
* Twitch stream rewards
* Community milestones
* Conference booth traffic
* QR code scavenger hunts
* Workshop attendance rewards
* Beta testing incentives
* Survey completion rewards
* Newsletter signup bonuses
* Tutorial completion gifts
* Review incentives
* Co-marketing vouchers
* Influencer distribution
* Cross-promotion codes
* Sponsor activations
## Creating Vouchers
### Dashboard Method
Navigate to **Vouchers** in your dashboard and click **Create Voucher**:
### API Method
```javascript Node.js
// Single voucher
const voucher = await zbd.createVoucher({
amount: 1000, // satoshis
description: "Thanks for playing!"
});
console.log(`Share this code: ${voucher.code}`);
// Output: Share this code: ABC12345
// Bulk creation for campaigns
const campaign = await Promise.all(
Array(100).fill(null).map(() =>
zbd.createVoucher({
amount: 500,
description: "Launch week special"
})
)
);
```
```python Python
# Create marketing voucher
voucher = zbd.create_voucher(
amount=1000,
description="Welcome bonus"
)
# Generate QR code for easy sharing
qr_url = f"https://zbd.gg/v/{voucher['code']}"
```
```bash cURL
curl -X POST https://api.zebedee.io/v0/vouchers \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": "1000",
"description": "Conference giveaway"
}'
```
## Distribution Strategies
### 📧 Email Campaigns
```html
You've received Bitcoin! 🎉
Redeem your gift with this code:
ABC12345
Redeem now!
```
### 🎮 In-App Distribution
```javascript
// Trigger voucher creation on achievement
async function rewardAchievement(userId, achievement) {
const voucher = await zbd.createVoucher({
amount: achievement.rewardAmount,
description: `Achievement unlocked: ${achievement.name}`
});
// Show in-game notification
showNotification({
title: "Achievement Unlocked! 🏆",
message: `You earned ${achievement.rewardAmount} sats!`,
code: voucher.code,
action: "Tap to redeem"
});
}
```
## Redemption Process
### For End Users
**Quick Redemption** (anywhere in dashboard):
1. Open redemption modal inside Vouchers page
2. Enter 8-character code
3. Click "Redeem Voucher"
4. Funds instantly added to wallet
**Mobile Redemption**:
1. Tap wallet balance in navbar
2. Select "Redeem Voucher"
3. Enter voucher code
4. Confirm redemption
### API Redemption
```javascript
// Programmatic redemption
const result = await zbd.redeemVoucher({
code: 'ABC12345',
});
if (result.success) {
console.log(`Redeemed ${result.amount} sats!`);
}
```
## Managing Vouchers
### Voucher Statuses
| Status | Description | Action Available |
| -------------- | --------------------- | ---------------- |
| 🟢 **Valid** | Active and redeemable | Share, Revoke |
| ✅ **Redeemed** | Successfully claimed | View details |
| ❌ **Revoked** | Cancelled by creator | None |
### Revoke Unused Vouchers
Cancel vouchers and reclaim funds:
```javascript Node.js
// Revoke single voucher
await zbd.revokeVoucher(voucherId);
```
```bash cURL
curl -X POST https://api.zebedee.io/v0/vouchers/voucher_id/revoke \
-H "apikey: YOUR_API_KEY"
```
## Best Practices
Create urgency and prevent long-term liabilities
Track campaign performance with clear descriptions
## Advanced Use Cases
### 🎰 Gamified Redemption
```javascript
// Mystery box vouchers with random amounts
function createMysteryVoucher() {
const amounts = [100, 500, 1000, 5000, 10000];
const random = amounts[Math.floor(Math.random() * amounts.length)];
return zbd.createVoucher({
amount: random,
description: "Mystery Box 📦"
});
}
```
## Common Questions
Yes, vouchers expire and are automatically revoked if not redeemed within 30 days. Unused funds are returned to your wallet.
No, each voucher is single-use only. For recurring rewards, create multiple vouchers.
## Start Your First Campaign
Define goals, audience, and budget
Use dashboard or API for bulk creation
Email, social media, or in-app
Monitor redemption rates and adjust
**Start Creating Vouchers** - Check out our API reference for programmatic voucher creation at scale.
# ZBD App
Source: https://docs.zbdpay.com/get-started/zbd-app
# ZBD MCP Server
Source: https://docs.zbdpay.com/get-started/zbd-mcp-server
# ZBD Onramp
Source: https://docs.zbdpay.com/get-started/zbd-onramp
# ZBD Payments API
Source: https://docs.zbdpay.com/get-started/zbd-payments-api
# ZBD Rewards SDK
Source: https://docs.zbdpay.com/get-started/zbd-rewards-sdk
# ZBD Payments
Source: https://docs.zbdpay.com/payments
Global instant payments infrastructure for apps and games with Bitcoin, Lightning Network, and multi-currency support
Build global payment experiences that actually work. ZBD Payments provides instant, low-cost money movement across major Tier 1 markets (US, EU, etc) using Bitcoin, Lightning Network, and traditional currencies - all through a single API.
Sub-second global payments with Lightning Network. No waiting, no borders.
Accept and send USD, EUR, BTC, and USDC. One API, multiple currencies.
Built for millions of microtransactions. Handle millions of transactions with ease.
Simple APIs, comprehensive SDKs, and documentation that doesn't suck.
## Why ZBD Payments?
### The Problem with Traditional Payments
**Card Networks:**
* Minimum \~\$0.30 fee per transaction
* Can't send 0.10c when fees are 0.30c
* Chargebacks eat profits
* High decline rates
**ZBD Payments:**
* Send amounts as low as \$0.001
* Proportional fees (typically \< 1%)
* No chargebacks
* Near 100% success rate
**Legacy Providers:**
* Complex integration (weeks/months)
* Different APIs per country
* Compliance nightmares
* Poor documentation
**ZBD Payments:**
* Single API globally
* 5-minute quick start
* Compliance built-in
* Stripe-quality docs
**Traditional Systems:**
* 3-5 day settlement times
* \$25-45 fees per transaction
* Limited to banking hours
* Blocked in many countries
**ZBD Payments:**
* Instant settlement (\< 1 second)
* Fees from \$0.0001
* 24/7/365 availability
* Works in globally
## How It Works
```mermaid
graph LR
A[Your App] -->|API Call| B[ZBD Platform]
B --> C{Payment Type}
C -->|Lightning| D[Instant Delivery]
C -->|On-chain| E[Bitcoin Network]
C -->|Fiat| F[Banking Rails]
D --> G[Recipient]
E --> G
F --> G
```
### Core Concepts
Bitcoin's Layer 2 scaling solution enabling instant, low-cost payments. Think of it as the Visa network for Bitcoin - same security, 1000x faster.
**Key Benefits:**
* Instant settlement (\< 1 second)
* Fees typically \< \$0.01
* Millions of TPS capacity
* Perfect for gaming microtransactions
Human-readable payment addresses like `user@zbd.gg`. No more copying long Bitcoin addresses. Works like email for money.
**Why It Matters:**
* Memorable usernames
* No QR codes needed
* Works across all Lightning wallets
* Perfect for in-game identities
## Products & Features
### 🚀 ZBD Onramp
Let users buy Bitcoin and USDC directly in your app. First widget to support Lightning Address delivery.
Embeddable widget • Built-in KYC • Multiple payment methods
### ⚡ Payments API
Send and receive payments globally via our REST API.
Instant settlements • Global reach • Bitcoin Lightning Network
### 🛠️ Developer SDKs
Production-ready SDKs for popular languages and frameworks. Get building in minutes, not weeks.
TypeScript • Go • Rust • C# • More coming
## Use Cases
### Gaming & Virtual Worlds
* Instant item purchases
* No minimum transaction
* Global player base
* Zero chargebacks
* P2P marketplaces
* Instant settlement
* Cross-border trades
* Low fees = more profit
* Instant winner payouts
* Any amount, any country
* No banking details needed
* Automated via API
* Pay mod creators
* Revenue sharing
* Micropayments work
* Global participation
### Apps & Platforms
Pay-per-article, pay-per-view, tips - amounts too small for cards
Instant payouts to workers globally without bank accounts
Send money home instantly with fees under \$0.01
Usage-based billing down to fractions of a cent
## Compliance & Security
### Built-in Compliance
* **KYC/AML**: Automated identity verification where required
* **Sanctions Screening**: Real-time OFAC and international lists
* **Transaction Monitoring**: AI-powered fraud detection
* **Regulatory Licenses**: Money transmission licenses in key markets
### Security First
* **End-to-end Encryption**: All data encrypted in transit and at rest
* **API Key Security**: Scoped permissions and IP allowlisting
* **Webhook Signatures**: Cryptographic verification of all events
* **SOC 2 Type II**: Annual security audits
## Pricing
**Custom Pricing** - We offer competitive rates based on your volume and use case. Schedule a call to discuss pricing that works for your business.
### What Affects Pricing
* Transaction volume
* Average transaction size
* Geographic distribution
* Settlement preferences
* Support level needed
## Start Building
[Schedule a call](https://zbd.one/sales) with our team to get access
Pick between Onramp, Payments API, or both
Use our quick start guides to integrate in minutes
Start processing real payments with production keys
Let users buy Bitcoin & USDC
TypeScript, Go, Rust & more
Complete API documentation
***
## Need Help?
Get API keys and discuss your use case
Technical help from our engineering team
# AI Ingestion
Source: https://docs.zbdpay.com/payments/ai-ingestion
Understand how to use ZBD Payments with LLMs.
export const PreviewButton = ({children, href}) => {
return
{children}
;
};
[docs.zbdpay.com](/) documentation pages are content rich and can be a great source of information for LLMs for AI tools. You can use your documentation to fine-tune a chatbot, answer questions about your product, or use it to generate code.
## /llms.txt
An [industry standard](https://llmstxt.org) that helps general-purpose LLMs index more efficiently (e.g. a sitemap for AI).
Every documentation site automatically hosts a **/llms.txt** file at the root that lists all available pages in your documentation.
Open llms.txt for docs.zbdpay.com
## /llms-full.txt
A markdown file of all your content is automatically available at **/llms-full.txt**.
llms-full.txt contains the entire content of your docs, and is a great way to provide a complete context to AI tools.
Open llms-full.txt for docs.zbdpay.com
## .md extension
Add **.md** to an individual documentation page to see a markdown version of that page. Helps load individual pages into AI tools with better token efficiency & inference time.
Open get-started.md
# Introduction
Source: https://docs.zbdpay.com/payments/api
Understand general API concepts and authentication strategies.
## Overview
ZBD offers a powerful REST API that supports Bitcoin Lightning Network transactions with various payout and payin methods. Our API uses JSON data structures and makes use of industry standard HTTP response codes.
## Base URL
The ZBD API is available on the following base URL:
```bash
https://api.zebedee.io
```
If you're looking for the [Sandbox API](/payments/api/gamertags/send), that's available at `https://sandbox-api.zebedee.io`.
## Authentication
All ZBD endpoints are protected by an API Key. To make requests against these endpoints you must pass a header property called `apikey` with your [ZBD Project API Key](/get-started/api-keys).
```json
apikey: "1PnXYRdcm13gJrHZVzctgCAUIEniVomQR"
```
## SSL / HTTPS Access
**ZBD only provides a secure interface over HTTPS with SSL certificate support**. Any requests that attempt to reach the ZBD API in an insecure fashion (plain-text over HTTP requests) will be rejected.
Secure Sockets Layer (SSL) is the standard security technology for establishing an encrypted link between a server and a client. SSL allows sensitive information such as credit card numbers, social security numbers, and login credentials to be transmitted securely.
## Resources
Links to help you get the most out of your ZBD development experience:
# Callbacks
Source: https://docs.zbdpay.com/payments/api/callbacks
Receive secure payment status updates from ZBD servers.
**Every payment in the Bitcoin Lightning Network is asynchronous.**
**Therefore, every payment inside of ZBD Payments API is asynchronous.**
## Payment Lifecycle
Although it may be that 99% of the time you use the ZBD Payments API to send a payment it settles immediately, this is NOT a certainty. All payments are asynchronous so there's still chances they will not succeed.
The Lightning Network is a decentralized organism / network and therefore there are many factors and circumstances that are outside of ZBD's control. Whether it is another provider going offline, or improper management of Bitcoin liquidity on the network, payments in Lightning can fail and you as a developer must understand how to react to these failures.
### Receiving Bitcoin
To receive payments, you normally create [Charges](/payments/api/lightning-charges/create) (or [Static Charges](/payments/api/lightning-charges/create-static)). These are created and remain in a `pending` status until someone successfully scans and pays the Charge, at which point it becomes `completed`. If enough time is elapsed, the Charge can also `expire` making it impossible to be paid.
### Sending Bitcoin
On the other hand, to send Bitcoin you must use one of the many [Payment APIs](/payments#instant-bitcoin-payouts). Payments through the Lightning Network can always fail, due to a myriad of reasons (e.g. network connectivity, size of payment, destination or receipient, etc). Because of that, every payment starts in a `processing` state, and only when it's settled or failed does it receive the `completed` or `failed` status' respectively.
As you can understand now, **it is important that you subscribe to updates on all your Charges and Payments when using the ZBD Payments API**.
**ZBD Payments API retains a 97% payment success rate for all time payments in the Lightning Network.**
## Callback URL
In order to properly receive updates to any Payments, Charges, and Withdrawals created through the ZBD Payments API, you should always pass along the `callbackUrl` property.
This `callbackUrl` should point to an HTTP server that you control/manage and should expose a POST HTTP call on this endpoint. It could look like this:
```bash
https://yourserver.com/api/v1/zbd/callback
```
**Callback URLs MUST be HTTPS**. HTTP calls are ignored. The server must be reachable to the public internet and not require any additional means of authentication.
We are in the process of adding `retry` functionality for these callback payloads, in case your server happens to be offline when a payment settles.
### Payloads
Below is a set of example payloads for the main APIs available:
#### Charges
```json
{
"amount":"1000",
"callbackUrl":"",
"internalId":null,
"status":"expired",
"unit":"msats"
}
```
#### Payments
```json
{
"amount":"10000",
"confirmedAt":"2024-02-06T11:51:26.985Z",
"description":"Test payment",
"fee":"0",
"id":"",
"internalId":null,
"invoice":"",
"preimage":"",
"processedAt":"2024-02-06T11:51:26.985Z",
"status":"completed",
"unit":"msats"
}
```
#### Withdrawals
```json
{
"amount":"10000",
"callbackUrl":"",
"createdAt":"2024-02-06T12:02:08.166Z",
"description":"Test withdrawal",
"expiresAt":"2024-02-06T12:05:08.164Z",
"fee":"0",
"id":"",
"internalId":null,
"invoice":
{
"fastRequest":"",
"fastUri":"",
"uri":""
},
"status":"completed",
"unit":"msats"
}
```
#### Lightning Address
```json
{
"amount":"1000",
"callbackUrl":"",
"internalId":null,
"invoice":"",
"preimage":"",
"unit":"msats",
"walletId":""
}
```
## Security / Integrity
It is important that developers are able to validate the integrity of all API calls performed to their `callbackUrl` endpoints.
To ensure that calls are coming from trusted ZBD Payments API servers, please use the [ZBD IP Address API Endpoint](/payments/api/utils/ip).
**By checking the originating IP address** of the request received to your callback servers, **with the approved IP address** returned from this API endpoint, you are able to verify the authenticity of the requests.
We have plans to expose features to further harden this security by providing data-encryption capabilities. The idea here is to allow developers to enter a secret key in their ZBD Project's Settings and then require this key to decode the encrypted data payload.
## Testing Locally
When developing with the ZBD Payments API, it is imperative that developers can test full end-to-end functionality of payment flows, including the async updates received through the `callbackUrl`s.
In order to receive updates locally, we recommend using a proxy server such as [ngrok](https://ngrok.com).
* [Follow the installation steps](https://ngrok.com/docs/getting-started/)
* Run command to start ngrok tunnel `ngrok http 8000`
* ngrok URL (e.g. `https://84c5dfxx39d74.ngrok.io`) is provided
* This URL is accessible to the world --> expose an API endpoint here and use it as the `callbackUrl` (e.g. `https://84c5dfxx39d74.ngrok.io/api/zbd-callback`).
You will now be able to receive async updates about your ZBD Payments API transactions directly to your local environment.
# Email Payments
Source: https://docs.zbdpay.com/payments/api/email
How to send instant payments to email addresses using ZBD Payments APIs.
Section coming soon.
# Pay to Email
Source: https://docs.zbdpay.com/payments/api/email/send
POST https://api.zebedee.io/v0/email/send-payment
Send instant Bitcoin payments to any email.
## Description
Leverage this API to programmatically perform payments to emails. You can view this more detailed [guide](/payments/payouts/email), if needed.
* If the email is associated with an existing ZBD App account, then that user account will be credited the sats.
* Otherwise, the sats will be issued to the email in the form of a valid [ZBD Voucher](/get-started/vouchers) that the recipient can redeem in the [ZBD Mobile App](/rewards/app).
## Usage
It's as simple as collecting the destination email and hitting this API. The endpoint charges a small fee equal to the greater of 1 satoshi or 1% of the transaction amount.
## Configuration
### Header Parameters
ZBD Project API Key
### Body
The Email of the intended recipient (e.g. [info@zebedee.io](mailto:info@zebedee.io))
The amount for the Payment -> in millisatoshis
Note / description of this Payment (may be shown to recipient)
```json Response
{
"success": true,
"data": {
"amount": "1000",
"code": "CB6A2DC5",
"createdAt": "2023-08-29T22:07:25.736Z",
"createTransactionId": "a3742c93-be3b-49aa-9414-79deb04137b9",
"description": "Sending to an email!",
"fee": "1000",
"id": "bdd0ee12-5231-4759-88aa-bb3634ed99e4",
"unit": "msats",
"walletId": "0701cf1b-059b-4b88-854e-3362d9b96aab"
},
"message": "Voucher was sent to email address."
}
```
# Errors
Source: https://docs.zbdpay.com/payments/api/errors
Troubleshoot problems with API calls.
The ZBD API follows standard HTTP response codes for handling success and error requests.
If you are unfamiliar with HTTP requests, [please read more here](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status).
## HTTP status codes
Below is an overview of HTTP status codes available in the standard, which ZBD API adheres by:
| HTTP Response Group | Status Code Range |
| ------------------------ | :---------------: |
| Informational Responses | `100-199` |
| **Successful Responses** | `200-299` |
| Redirects | `300-399` |
| **Client Errors** | `400-499` |
| **Server Errors** | `500-599` |
## Common response codes
These are the HTTP status codes most often returned by the ZBD API.
| Status Code | Details | Response Description |
| :---------: | :---------------: | ---------------------------------------------------------------------------------------------------------- |
| `200` | Success | Request was successful. |
| `400` | Bad Request | Either incorrect or missing parameters provided for the Request. |
| `401` | Unauthorized | Request is not authorized. Make sure correct API Key is provided. |
| `403` | Forbidden | Request is forbidden. Make sure your IP is located in a region/country that ZBD services are available in. |
| `404` | Not Found | The requested endpoint/resource was not found. |
| `422` | Missing Parameter | The requested endpoint expected a specific parameter to be provided. |
| `429` | Rate Limited | Too many requests in short time-frame. |
| `500` | Server Error | Something went wrong in the ZBD API servers. |
## Error messages
To help identify the issue with your API requests, the error JSON response returned will often include a **message** property that aims to be descriptive.
Example of an error message from the API:
```json
{
"success": false,
"message": "Error creating Withdrawal Request: The \"amount\" property (in millisatoshis) is required.",
}
```
# ZBD Gamertags
Source: https://docs.zbdpay.com/payments/api/gamertags
How to send instant payments to ZBD Gamertags using ZBD Payments APIs.
Section coming soon.
# Create Charge
Source: https://docs.zbdpay.com/payments/api/gamertags/create-charge
POST https://api.zebedee.io/v0/gamertag/charges
Generate a payment request for a ZBD User.
## Description
While you can use the [Pay to ZBD Gamertag](/payments/api/gamertags/send) 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.
## 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
```json Response
{
"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
}
}
```
# Get Gamertag By ZBD ID
Source: https://docs.zbdpay.com/payments/api/gamertags/retrieve-from-userid
GET https://api.zebedee.io/v0/gamertag/user-id/{id}
Retrieve ZBD user ID from a Gamertag.
## Usage
This API endpoint is the reverse of the [Get User ID for ZBD Gamertag](/payments/api/gamertags/retrieve-userid) endpoint. Use this endpoint to get a given user's ZBD Gamertag.
If you've got a User ID and you wish to find out that user's ZBD Gamertag, perhaps to then [send that user payments](/payments/api/gamertags/send), you may use this endpoint.
## Configuration
### Path Parameters
User ID
### Header Parameters
ZBD Project API Key
```json Response
{
"success": true,
"data": {
"gamertag": "foxp2"
},
"message": "Fetched gamertag from uuid"
}
```
# Get Payment
Source: https://docs.zbdpay.com/payments/api/gamertags/retrieve-payment
GET https://api.zebedee.io/v0/gamertag/transaction/{id}
Retrieve all data about a Payment sent to ZBD User.
## Description
In order to get data on payments sent to ZBD Gamertags, you can use this endpoint. The data payload returned will inform you of the `status` of that transaction as well as any associated `fees`.
## Usage
The idea here is to use the `transactionId` property returned from the [Pay to ZBD Gamertag](/payments/api/gamertags/send) response, and use that ID to fetch the latest details of the given Payment.
## Configuration
### Path Parameters
Payment Transaction ID
### Header Parameters
ZBD Project API Key
```json Response
{
"message": "Fetched charge.",
"success": true,
"data": {
"id": "903883f2-67d9-4707-a21b-ddff004fe041",
"receiverId": "ec9b38d5-b126-4307-9d1e-8aa0dfab5d7e",
"amount": "15000",
"fee": "1000",
"unit": "msats",
"processedAt": "2023-01-04T15:59:16.993Z",
"confirmedAt": "2023-01-04T15:59:16.989Z",
"comment": "Sending to ZBD Gamertag",
"status": "TRANSACTION_STATUS_COMPLETED"
}
}
```
# Get ID by ZBD Gamertag
Source: https://docs.zbdpay.com/payments/api/gamertags/retrieve-userid
GET https://api.zebedee.io/v0/user-id/gamertag/{GAMERTAG}
Retrieve Gamertag from a ZBD user ID.
## Description
Make use of this endpoint to get a given User's ID when provided with a ZBD Gamertag.
## Usage
This is needed because ZBD Gamertags are akin to social media handles, they are swappable. In the scenario where a Developer is using a ZBD Gamertag as the identifier for transaction limits and/or thresholds (for example), a user could simply change their ZBD Gamertag and try to bypass those constraints. Using a truly unique and immutable ID like the `User ID` will provide Developers with the needed assurances.
## Configuration
### Path Parameters
ZBD Gamertag
### Header Parameters
ZBD Project API Key
```json 200 Response
{
"success": true,
"data": {
"id": "0a59bf56-daa3-4888-8330-cbc02eba3a6e"
}
}
```
```json 400 Response
{
"success": false,
"message": "No user found with this gamertag"
}
```
# Pay to ZBD Gamertag
Source: https://docs.zbdpay.com/payments/api/gamertags/send
POST https://api.zebedee.io/v0/gamertag/send-payment
Send instant Bitcoin payments to ZBD Users.
Unlike other payout endpoints in the ZBD API, sending payments to ZBD Gamertags is a synchronous action -> this is why there is no `callbackUrl` property. The payment either succeeds or fails on the spot.
## 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)
```json Response
{
"success": true,
"data": {
"id": "49cccd62-b686-4057-9f44-f492bd54ac39",
"status": "settled",
"transactionId": "78fb6474-d791-47a1-bda1-a4b9023898c0",
"receiverId": "ec9b38d5-b126-4307-9d1e-8aa0dfab5d7e",
"amount": "1000",
"comment": "Sent to ZBD Gamertag",
"settledAt": "2023-07-19T21:42:54.993Z"
},
"message": "Payment done."
}
```
# Keysend
Source: https://docs.zbdpay.com/payments/api/keysend
How to send Keysend payments using ZBD Payments APIs.
Section coming soon.
# Send Keysend Payment
Source: https://docs.zbdpay.com/payments/api/keysend/send
POST https://api.zebedee.io/v0/keysend-payment
Start sending Keysend payments on the Lightning Network.
## Description
Every Lightning Network node has a public key identifying it to the wider network. While most payments in the Lightning Network require Payment Requests ([Charges](/payments/glossary#charges)) QR codes to be created and then paid for, there is another type of payment known as `Spontaneous Payment` or `Keysend Payment` on a more technical note.
This endpoint exposes the ability to make payment directly to a Lightning Network node Public Key, without the need for a Payment Request / Charge.
## Usage
If your system relies on sending Bitcoin over the Lightning Network to specific node Public Keys, this API is what you're looking for.
Additional metadata and TLV record data can be attached to this endpoint as well. Both of these properties/values will be returned on the `callbackUrl` POST call from ZBD.
As with all asynchronous payments in the Lightning Network, in order to receive updates about whether a payment settled, you must provide the `callbackUrl` property. As you will note from the response example below, if the Keysend Payment doesn't settle (almost) immediately, you will receive a `Payment Processing` response payload. Once it settles, you'll receive the update on the `callbackUrl`.
## Configuration
### Header Parameters
ZBD Project API Key
Content Type
### Body
The amount for the Payment -> in millisatoshis
The Public Key for the destination Lightning node
The endpoint ZBD will POST Keysend Payment updates to
Open metadata object property
List of TLV records
type of the TLV record
value of the TLV record (hex encoded string)
```json Response
{
"message": "Payment processing.",
"success": true,
"data": {
"keysendId": "0d54521c-f41c-4cec-8799-edf9d87cf6b5",
"paymentId": "276e6f54-65fb-4c30-9b86-b44659015cd6",
"transaction": {
"id": "a51bd8d3-1d65-4785-bfd2-3341dc696f84",
"walletId": "cce98a9b-c52a-427c-8cf5-d7ca39c5035e",
"type": "KEYSEND_PAYMENT",
"totalAmount": "3000",
"fee": "2000",
"amount": "1000",
"description": "Keysend Payment",
"status": "TRANSACTION_STATUS_PROCESSING",
"confirmedAt": null
}
}
}
```
# Lightning Address
Source: https://docs.zbdpay.com/payments/api/lightning-address
How to send instant payments to Lightning Addresses using ZBD Payments APIs.
## Description
A Lightning Address is an internet identifier (akin to an email address -- `andre@zbd.gg`) that anyone can use to send you Bitcoin Lightning Network payments.
Leverage this API to programmatically perform these types of payments.
A massively simpler way for anyone to send you Bitcoin instantly on the Lightning Network. Like an email address, but for your Bitcoin!
As creators of the [Lightning Address open source standard](https://github.com/andrerfneves/lightning-address), we believe this API to be the single most frictionless way of using Bitcoin today.
## APIs
Here are some Lightning Address APIs that you can use to programmatically help perform these types of payments.
Ensure destination is a valid Lightning Address.
Send a payment to a Lightning Address.
Create a charge QR code for a Lightning Address.
# Create Charge
Source: https://docs.zbdpay.com/payments/api/lightning-address/create-charge
POST https://api.zebedee.io/v0/ln-address/fetch-charge
Generate a payment request for a Lightning Address.
## Description
If instead of sending Bitcoin payments directly to a given Lightning Address, you would rather create a Payment Request QR code for that Lightning Address, you can use this API.
## Usage
Depending on your system's configuration or your product's UX, you may need the ability to generate Charges for specific users. For ZBD users that's easy using the ZBD Gamertag endpoints. For any user that is using a different provider, you can use this endpoint.
The way to think of this is:
Given `user@domain.com` Lightning Address and an `amount` property, this endpoint generates a Charge.
If this new Charge is paid, the payment is received by `user@domain.com`.
## Configuration
### Header Parameters
ZBD Project API Key
Content Type
### Body
The Lightning Address of the intended recipient
The amount for the Charge -> in millisatoshis
Note or comment of this Charge
```json Response
{
"success": true,
"data": {
"lnaddress": "andre@zbd.gg",
"amount": "15000",
"invoice": {
"uri": "lightning:lnbc100n1p3mtxc3pp5tz4srtee9c4gsvlcqa6azu60a2ak2fvrnk7jv52j6n0rzp0musnqhp5xt5ts9t74akf67j59ynkr5qz8x3hs4g09d3dttmjrwwdhrxgc03qcqzpgxqzfvsp5529t5y03yaakumqrm9cwr5t6nysnr5cv93pnvw089a25aa7wszas9qyyssqalswdlc92983203l5azl43nksehadfy2uahc9v6qwg67xs52z02hg6vh7alrm3yx46ywdrl3dxey75t9l2ekmuwc3tu4ug03dy729fspdld2lj",
"request": "lnbc100n1p3mtxc3pp5tz4srtee9c4gsvlcqa6azu60a2ak2fvrnk7jv52j6n0rzp0musnqhp5xt5ts9t74akf67j59ynkr5qz8x3hs4g09d3dttmjrwwdhrxgc03qcqzpgxqzfvsp5529t5y03yaakumqrm9cwr5t6nysnr5cv93pnvw089a25aa7wszas9qyyssqalswdlc92983203l5azl43nksehadfy2uahc9v6qwg67xs52z02hg6vh7alrm3yx46ywdrl3dxey75t9l2ekmuwc3tu4ug03dy729fspdld2lj"
}
}
}
```
# Pay to Lightning Address
Source: https://docs.zbdpay.com/payments/api/lightning-address/send
POST https://api.zebedee.io/v0/ln-address/send-payment
Send instant Bitcoin payments to any Lightning Address.
## Configuration
### Header Parameters
ZBD Project API Key
Content Type
### Body
The Lightning Address of the intended recipient (e.g. [andre@zbd.gg](mailto:andre@zbd.gg))
The amount for the Payment -> in millisatoshis
Note or description of this Payment
Open metadata string property
The endpoint ZBD will POST Charge updates to
```json Response
{
"success": true,
"data": {
"id": "db3e9e98-82c6-4ad5-acb8-900212d352aa",
"fee": "0",
"unit": "msats",
"amount": "10000",
"invoice": "lnbc100n1p3mtx6gpp5qpc7qvapr475jjazwkves7t7qdyq5njym52z5r6mg0a9d79w783shp5xt5ts9t74akf67j59ynkr5qz8x3hs4g09d3dttmjrwwdhrxgc03qcqzpgxqzfvsp59uasmyhqwfuek2dwyfla6dn7la5wxkwzmlvvhcuptxdxsxs8d24q9qyyssqslvgpll5cwtcmhr0ch607gg463xc3s2g7mfww2dr3l0f29czt7eq03rylyg5g09qz0w97qv87mmmcyj0ytfahhzc6y79je5vsf67tgcp8248ez",
"preimage": null,
"walletId": "2e686eed-82c6-4722-95bd-de1b23f27d44",
"transactionId": "2924bf31-96ba-4d26-80df-9e35c09a59cf",
"callbackUrl": "https://your-domain.com/zbd-callback",
"internalId": "uniqueIdFromYourSystem",
"comment": "Sending to a Lightning Address",
"processedAt": "2023-01-04T15:29:12.577Z",
"createdAt": "2023-01-04T15:29:12.514Z",
"status": "completed"
},
"message": "Payment done."
}
```
# Validate Lightning Address
Source: https://docs.zbdpay.com/payments/api/lightning-address/validate
GET https://api.zebedee.io/v0/ln-address/validate/{address}
Verify the validity of a Lightning Address.
## Usage
Not all internet identifiers are Lightning Addresses. Make use of this API to validate whether a user's entered address is indeed a valid Lightning Address that can accept Bitcoin payments.
The idea behind this API endpoint is to verify whether an internet-indentifier (e.g. `user@domain.com`) is in fact a Lightning Address and NOT an email address. Once verified, use the [Send Lightning Address Payment](/payments/api/lightning-address/send) to perform the transaction.
## Configuration
### Path Parameters
Lightning Address to be verified
### Header Parameters
ZBD Project API Key
```json Response
{
"success": true,
"data": {
"valid": true,
"metadata": {
"minSendable": 10000,
"maxSendable": 150000000,
"commentAllowed": 150,
"tag": "payRequest",
"metadata": "[[\"text/plain\",\"andre - Welcome to ZBD! ;)\"],[\"text/identifier\",\"andre@zbd.gg\"],[\"image/png;base64\",\"/9j/2wBDAAYEBQ......IUeDcpP9akPkjm3XPid8/OmYZB//9k=\"]]",
"callback": "https://api.zebedee.io/v0/process-static-charges/d0f2c3da-e836-480a-bf8c-f5d5b167d6f8",
"payerData": {
"name": {
"mandatory": false
},
"identifier": {
"mandatory": false
}
},
"disposable": false
}
}
}
```
# Overview
Source: https://docs.zbdpay.com/payments/api/lightning-charges
How to create and manage Lightning Charges.
## Introduction
Static Charges are a type of Payment Request QR code in the Bitcoin Lightning Network that has some incredible characteristics and capabiltiies. Whereas [Charges](/payments/api/lightning-charges/create) create `fixed-amount` and `single-use` Payment Requests that expire, [Static Charges](/payments/api/lightning-charges/create-static) provide you a lot more flexibility & capabilities, including:
Static Charges have both `minAmount` and `maxAmount` properties, allowing for the payer to define the amount.
By default Static Charges have **no expiration time**, making them usable for any N payers and payments.
Slots allow you to define that only N payments are to be accepted for this specific Static Charge QR.
When a payment is completed, a `Success Message` can be displayed to the payer (e.g. receipt, link).
## What is a Static Charge?
A Static Charge is a static QR code that can be used an unlimited number of times, does not expire, accepts various amounts, accepts attached messages, and allows for full configurability, **all while maintaining the same QR code**.
A Static Charge QR code looks like the one show below:
## Common use cases
There are many potential scenarios where Static Charges are very handy. Let's take a look at couple of them.
### User deposits
Static Charges are excellent for handling user deposits. You can generate a Static Charge for each unique users in your platform and provide that QR code to them. Whenever payments come in through that specific Static QR code, you will know it belongs to such user. Your users can now receive money from any Bitcoin Lightning wallet.
Static Charges can be set up such that they can be used an unlimited number of times and they do not expire. It makes receiving payments extremely easy.
\*Just like every user has a \$venmotag for Venmo, every ZBD user has an Static Charge. The only difference between the two is that there is interoperability between different providers since they understand the same money protocol.
### In-person fundraising
One crafty thing you can do for donations is throw a Static Charge QR code on a large screen and anyone who has a wallet can now pay you directly just by scanning and confirming a payment.
The ZBD API makes this incredibly easy. Since there are no limits to the number of Static Charges created, you could create one for each campaign and properly measure donation goal reach. Cool, right?
This is great for nonprofits!
### Remote fundraising / donations
Streamers can take their QR image and easily add it to any streaming software (e.g. OBS) to enable direct payments to them from their audience. Never has this been possible before.
Please check out [ZBD Streamer](https://streamer.zebedee.io) to view this live in a ZBD product.
### User tips / Zaps / User-to-user payments
Static Charges are great for tips or commonly referred to as "zaps". It can also be used for user-to-user payments, since they are a static QR code. Though the best user experience for these use cases is a [Lightning Address](/payments/api/lightning-address/send).
### Deposits
Users can attach Static QR codes to their blog posts, social media posts, images, live streams, videos, & art.
# Create Charge
Source: https://docs.zbdpay.com/payments/api/lightning-charges/create
POST https://api.zebedee.io/v0/charges
Start receiving instant Bitcoin payments through the ZBD API.
## Description
Creates a new [Charge](/payments/glossary#charge) in the Bitcoin Lightning Network, payable by any Lightning-capable wallet.
These payment requests are single-use, fixed-amount QR codes. If you're looking for multi-use and multi-amount payment requests you want [Static Charges](/payments/api/lightning-charges/create-static).
## Usage
This API is used for `receiving` funds into your ZBD Project. The primary idea is to create one of these Charges anytime someone wishes to perform a payment **TO** you.
On a successful `200 HTTP response` from the ZBD API, you should render the contents of `data.invoice.uri` in a QR code. This QR code can be scanned by any Bitcoin Lightning wallet.
## Configuration
### Header Parameters
ZBD Project API Key
Content Type
### Body
The amount for the Charge -> in millisatoshis
Note or comment for this Charge (visible to payer)
Time until Charge expiration -> in seconds
The endpoint ZBD will POST Charge updates to
Open metadata string property
```json Response
{
"success": true,
"message": "Successfully created Charge.",
"data": {
"unit": "msats",
"amount": "10000",
"confirmedAt": null,
"status": "pending",
"description": "My Charge Description",
"createdAt": "2020-05-09T15:09:05.765Z",
"expiresAt": "2020-05-09T15:14:05.618Z",
"id": "1907b0fe-789b-4e25-b18a-0c4c0f5cced7",
"internalId": "11af01d092444a317cb33faa6b8304b8",
"callbackUrl": "https://your-website.com/callback",
"invoice": {
"request": "lnbc100n1p0td3u3pp5z2ed9yjfrz0rgu0fzuc5cdwfu8dtjlgrfztz5uga8hakkjy2yzgsdpzf4ujqsmgv9exwefqg3jhxcmjd9c8g6t0dccqzpgxqzfvsp5q8z5mkghmuzrnusxdwtmls7x8vuy63j25rt4z55gj3s7340dv72q9qy9qsqz02rlmlzcvew3vk90c6l0369ewk7tkr2tx0yrk3qa235v07w6d3qeksk99wm7y8f8ug7zqy6yjudu4cs2f4umpey43cw7msyj7uqj2qq8x03te",
"uri": "lightning:lnbc100n1p0td3u3pp5z2ed9yjfrz0rgu0fzuc5cdwfu8dtjlgrfztz5uga8hakkjy2yzgsdpzf4ujqsmgv9exwefqg3jhxcmjd9c8g6t0dccqzpgxqzfvsp5q8z5mkghmuzrnusxdwtmls7x8vuy63j25rt4z55gj3s7340dv72q9qy9qsqz02rlmlzcvew3vk90c6l0369ewk7tkr2tx0yrk3qa235v07w6d3qeksk99wm7y8f8ug7zqy6yjudu4cs2f4umpey43cw7msyj7uqj2qq8x03te"
}
}
}
```
# Create Static Charge
Source: https://docs.zbdpay.com/payments/api/lightning-charges/create-static
POST https://api.zebedee.io/v0/static-charges
Start accepting payments on Lightning with Static QR codes.
## Description
Static Charges are static Payment Requests in the Bitcoin Lightning Network. Whereas [Charges](/payments/api/lightning-charges/create) 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 `minAmount` and `maxAmount` properties, 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.
Static Charges also have the same core properties of Charges such as `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.
To understand more use cases for Static Charges, [check our in-depth guide](/payments/api/lightning-charges).
## Configuration
### Header Parameters
ZBD Project API Key
Content Type
### Body
Minimum allowed amount for the Static Charge -> in millisatoshis
Maximum allowed amount for the Static Charge -> in millisatoshis
Note or comment for this Static Charge (visible to payer)
Message displayed to the payer AFTER payment settles. Maximum of 144 characters.
Number of payments this Static Charge can accept
Open metadata string property
The endpoint ZBD will POST Charge updates to
Used for Custom Lightning Addresses (see guide)
```json Response
{
"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"
}
}
}
```
# Decode Charge
Source: https://docs.zbdpay.com/payments/api/lightning-charges/decode
POST https://api.zebedee.io/v0/decode-invoice
Understand the inner properties of a Charge QR code.
## 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
ZBD Project API Key
Content Type
### Body
The Charge or Invoice QR code contents
```json Response
{
"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"
}
}
```
# Retrieve Charge
Source: https://docs.zbdpay.com/payments/api/lightning-charges/retrieve
GET https://api.zebedee.io/v0/charges/{id}
Retrieve all data about a single Charge.
## Usage
While the best approach is to rely on the `callbackUrl` property and expect async Charge updates sent from ZBD servers, this API can be used to check any information about any Charge, specifically properties such as `status` and `internalId` which are likely useful for your application.For most use cases it is unlikely you will hit a rate limit, however it is recommended to avoid practices such as "long polling" especially if your server collectively "long polls" for multiple clients as this could cumulatively cause a rate limit to be reached.
## Configuration
### Path Parameters
Charge ID
### Header Parameters
ZBD Project API Key
```json Response
{
"success": true,
"message": "Successfully retrieved Charge.",
"data": {
"unit": "msats",
"amount": "10000",
"confirmedAt": null,
"status": "pending",
"description": "My Charge Description",
"createdAt": "2020-05-09T15:09:05.765Z",
"expiresAt": "2020-05-09T15:14:05.618Z",
"id": "1907b0fe-789b-4e25-b18a-0c4c0f5cced7",
"internalId": "11af01d092444a317cb33faa6b8304b8",
"callbackUrl": "https://your-website.com/callback",
"invoice": {
"request": "lnbc100n1p0td3u3pp5z2ed9yjfrz0rgu0fzuc5cdwfu8dtjlgrfztz5uga8hakkjy2yzgsdpzf4ujqsmgv9exwefqg3jhxcmjd9c8g6t0dccqzpgxqzfvsp5q8z5mkghmuzrnusxdwtmls7x8vuy63j25rt4z55gj3s7340dv72q9qy9qsqz02rlmlzcvew3vk90c6l0369ewk7tkr2tx0yrk3qa235v07w6d3qeksk99wm7y8f8ug7zqy6yjudu4cs2f4umpey43cw7msyj7uqj2qq8x03te",
"uri": "lightning:lnbc100n1p0td3u3pp5z2ed9yjfrz0rgu0fzuc5cdwfu8dtjlgrfztz5uga8hakkjy2yzgsdpzf4ujqsmgv9exwefqg3jhxcmjd9c8g6t0dccqzpgxqzfvsp5q8z5mkghmuzrnusxdwtmls7x8vuy63j25rt4z55gj3s7340dv72q9qy9qsqz02rlmlzcvew3vk90c6l0369ewk7tkr2tx0yrk3qa235v07w6d3qeksk99wm7y8f8ug7zqy6yjudu4cs2f4umpey43cw7msyj7uqj2qq8x03te"
}
}
}
```
# Get Static Charge
Source: https://docs.zbdpay.com/payments/api/lightning-charges/retrieve-static
GET https://api.zebedee.io/v0/static-charges/{id}
Retrieve all data about a single Static Charge.
You should rely on `callbackUrl` property and expect async Static Charge updates sent from ZBD servers. However, this API can be used to check any information about any specific Static Charge, specifically properties such as `slots`, `successMessage`, and `status`.
## Configuration
### Path Parameters
Static Charge ID
### Header Parameters
ZBD Project API Key
```json Response
{
"message":"Successfully fetched 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":"This is my static charge",
"callbackUrl":"https://my-website/zbd-callback",
"allowedSlots":1000,
"successMessage":"Congratulations your payment was successful!",
"status":"active",
"invoice":{
"request":"lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9aex2ut4v4ehgttnw3shg6tr943ksctjvajhxte5x43nyv34vgcj6vpjxf3z6drpxvmj6wfcvsmz6dtpx56nvwrxxuuxgvf3uzvpfy",
"uri":"lightning:lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9aex2ut4v4ehgttnw3shg6tr943ksctjvajhxte5x43nyv34vgcj6vpjxf3z6drpxvmj6wfcvsmz6dtpx56nvwrxxuuxgvf3uzvpfy"
}
}
}
```
# Update Static Charge
Source: https://docs.zbdpay.com/payments/api/lightning-charges/update-static
PATCH https://api.zebedee.io/v0/static-charges/{id}
Change the configuration of a Static Charge QR code.
## Usage
Use this API endpoint with the specific Static Charge ID to update its properties. Usually you'd use this API for the purposes of `increasing slots` or `changing min/max amount` settings.
Updating a Static Charge **WILL NOT modify its QR code**. The point of a Static Charge is that it **does not change**, while its contents can remain dynamic.
## Configuration
### Path Parameters
Static Charge ID
### Header Parameters
ZBD Project API Key
Content Type
### Body
Minimum allowed amount for the Static Charge -> in millisatoshis
Maximum allowed amount for the Static Charge -> in millisatoshis
Note or comment for this Static Charge (visible to payer)
Message displayed to the payer AFTER payment settles
Number of payments this Static Charge can accept
Open metadata string property
The endpoint ZBD will POST Charge updates to
```json Response
{
"message":"Successfully editted 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":"This is my static charge",
"callbackUrl":"https://my-website/zbd-callback",
"allowedSlots":1000,
"successMessage":"Congratulations your payment was successful!",
"status":"active",
"invoice":{
"request":"lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9aex2ut4v4ehgttnw3shg6tr943ksctjvajhxte5x43nyv34vgcj6vpjxf3z6drpxvmj6wfcvsmz6dtpx56nvwrxxuuxgvf3uzvpfy",
"uri":"lightning:lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9aex2ut4v4ehgttnw3shg6tr943ksctjvajhxte5x43nyv34vgcj6vpjxf3z6drpxvmj6wfcvsmz6dtpx56nvwrxxuuxgvf3uzvpfy"
}
}
}
```
# Lightning Payments
Source: https://docs.zbdpay.com/payments/api/lightning-payments
How to send instant payments to Lightning Addresses using ZBD Payments APIs.
Section coming soon.
# Retrieve Payment
Source: https://docs.zbdpay.com/payments/api/lightning-payments/retrieve
GET https://api.zebedee.io/v0/payments/{id}
Retrieve all data about a single Payment.
## Usage
Use this API endpoint to get all of the properties of a given Payment record, including its total fee, processing timestamp, and settlement status.
## Configuration
### Path Parameters
Payment ID
### Header Parameters
ZBD Project API Key
```json Response
{
"success": true,
"message": "Fetched Payment.",
"data": {
"id": "caafd318-527c-466b-81f2-441d3a092aae",
"fee": "2000",
"unit": "msats",
"amount": "101000",
"invoice": "lnbc1010n1p3mt8akpp5uyxhllflux2fvl36wjxh80wtqzdh2vjmu8cdyzuap578az80v74qdqcd3hzucmpwd5zqurp09kk2mn5cqzpgxqzjhsp550s770zy4puj76wqnua0hmym883gr07dhuast5ygcm44grl6z7ns9qyyssqgf7sumdmxwzgkq2m0h9lcv530sqs0m4t4shlu98djrrckrtulcmr8rear70dyftdm67jvgncxgz4jmd6ksx87jvnj88e39un48ssk4gp8vs4u5",
"preimage": "8a14f6da89d4a8ffd09677f585b7c377de72744b7c3713d3c115fa71ca4fc290",
"internalId": "11af01d092444a317cb33faa6b8304b8",
"processedAt": "2023-01-04T15:48:29.805Z",
"confirmedAt": "2023-01-04T15:48:29.805Z",
"description": "Custom Payment Description",
"status": "completed"
}
}
```
# Send Payment
Source: https://docs.zbdpay.com/payments/api/lightning-payments/send
POST https://api.zebedee.io/v0/payments
Start sending instant Bitcoin payments through the ZBD API.
## 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](/payments/glossary#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 the `callbackUrl` 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
ZBD Project API Key
Content Type
### Body
Lightning Network Payment Request / Charge
Note or comment for this Payment
Amount to be paid to this Charge/Invoice -> in millisatoshis *(only valid if Amountless Invoice)*
Open metadata string property
The endpoint ZBD will POST Payment updates to
```json Response
{
"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",
}
}
```
# OpenAPI
Source: https://docs.zbdpay.com/payments/api/resources/openapi
Explore the OpenAPI specification for the ZBD Payments API.
The official OpenAPI specification for the ZBD Payments API.
# Utilities
Source: https://docs.zbdpay.com/payments/api/utils
Utility APIs for developers integrating with ZBD Payments.
Section coming soon.
# BTC USD Price Feed
Source: https://docs.zbdpay.com/payments/api/utils/btc-usd
GET https://api.zebedee.io/v0/btcusd
Get the latest price for Bitcoin in US Dollars.
## Description
The exchange rate feed is refreshed every 5 seconds and is based upon a combination of industry-leading partner exchange providers's price feeds.
## Usage
Use this API to show your users the correct USD value when paying any Satoshis/BTC Charges or Payment Requests. This API allows you to stay synced with ZBD on the `price of Bitcoin`.
```json Response
{
"success": true,
"data": {
"btcUsdPrice": "16825",
"btcUsdTimestamp": "1672847113"
},
"message": "Successfully retrieved BTC USD price ticker information."
}
```
# ZBD IP Address
Source: https://docs.zbdpay.com/payments/api/utils/ip
GET https://api.zebedee.io/v0/prod-ips
Get the official IP addresses of ZBD servers.
## Description
The ZBD API relies on callback URLs for keeping you informed about updates that occur to any Charges, Payments, or Withdrawals you've created. In order to ensure that any incoming callback message is indeed from a trusted ZBD API infrastructure server, we provide this API endpoint for you to know which IP addresses `real` requests come from.
## Usage
The idea is to use this API endpoint to fetch the production IP addresses for ZBD servers, such that when you receive a callback about a payment having settled, you can check the originating IP address and confirm it indeed came from ZBD.
ZBD has a static set of IP addresses so, though possible, it is unlikely we will be changing these IPs often.
## Configuration
### Header Parameters
ZBD Project API Key
```json Response
{
"success": true,
"data": {
"ips": [
"3.225.112.64"
]
}
}
```
# API Supported Regions
Source: https://docs.zbdpay.com/payments/api/utils/is-supported-region
GET https://api.zebedee.io/v0/is-supported-region/{IP_ADDRESS}
Verify if a user is coming from a supported region.
## Description
The ZBD API is available in over 100 countries around the world, and we're always aiming to expand our reach.
If you wish to know whether the incoming user request is coming from a region where ZBD is supported or not, you can use this simple API endpoint and pass the target IP address as a parameter.
## Usage
The idea behind this endpoint is that in order to serve your users the best way possible, you should check where they are located and ensure that they can make use of ZBD services.
## Configuration
### Path Parameters
IP address to check
### Header Parameters
ZBD Project API Key
```json Response
{
"success": true,
"data": {
"ipAddress": "66.109.221.0",
"isSupported": true,
"ipCountry": "US",
"ipRegion": "CO"
}
}
```
# Vouchers
Source: https://docs.zbdpay.com/payments/api/vouchers
How to create and manage Vouchers using ZBD Payments APIs.
Section coming soon.
# Create Voucher
Source: https://docs.zbdpay.com/payments/api/vouchers/create
POST https://api.zebedee.io/v1/create-voucher
## Description
Debits your Project wallet to create a single-time use [ZBD Voucher](/get-started/vouchers). Returns a valid 8-digit voucher Code which can be redeemed by any ZBD user to claim the sats (crediting their account). Creating a voucher takes either a fee of 1 sat or 1% of the voucher amount.
ZBD Vouchers are redeemable by any ZBD user, via the Developer Dashboard or ZBD App.
## Usage
You can create vouchers any time you want to send another ZBD user sats from a Project Wallet. For example, you could run a giveaway by programatically creating the required number of vouchers and distributing the Codes to users accordingly.
## Configuration
### Header Parameters
ZBD Project API Key
Content Type
### Body
The amount for the Charge -> in millisatoshis
Note or comment for this Charge (visible to payer)
```json Response
{
"success": true,
"data": {
"amount": "1000",
"code": "7EE15185",
"createdAt": "2023-08-24T15:01:56.408Z",
"createTransactionId": "0e11be7a-fd5e-48db-a0bb-54731681bc25",
"description": "Voucher for user.",
"fee": "1000",
"id": "a2eb43c4-af7f-4eb9-839c-ca31db34b3fc",
"unit": "msats",
"walletId": "4a4bd549-297e-4e67-a594-386200e1bc21"
},
"message": "Successfully created Voucher."
}
```
# Redeem Voucher
Source: https://docs.zbdpay.com/payments/api/vouchers/redeem
POST https://api.zebedee.io/v0/redeem-voucher
## Description
Credits your Project wallet by claiming a single-time use [ZBD Voucher](/get-started/vouchers).
## Usage
Enter a valid 8-digit voucher Code to redeem the sats to your Project wallet.
## Configuration
### Header Parameters
ZBD Project API Key
Content Type
### Body
Valid 8-digit ZBD Voucher Code
```json Response
{
"success": true,
"data": {
"amount": "1000",
"code": "7EE15185",
"createdAt": "2023-08-24T15:01:56.408Z",
"description": "Voucher for user.",
"id": "a2eb43c4-af7f-4eb9-839c-ca31db34b3fc",
"redeemedAt": "2023-08-24T15:03:43.333Z",
"redeemedById": "4a4bd549-297e-4e67-a594-386200e1bc21",
"redeemedTransactionId": "656695f9-36e3-4b9c-abfa-8c2e90f61b45",
"revokedAt": null,
"revokedById": null,
"revokedTransactionId": null,
"unit": "msats"
},
"message": "Successfully redeemed Voucher."
}
```
# Retrieve Voucher
Source: https://docs.zbdpay.com/payments/api/vouchers/retrieve
GET https://api.zebedee.io/v0/vouchers/{VOUCHER_ID}
## Description
Retrieves details for a [ZBD Voucher](/get-started/vouchers). Returns whether the provided ID corresponds to a valid Voucher, and details about a valid Voucher.
## Usage
You can retrieve details about a voucher at any time, including whether it is valid, redeemed, or revoked.
## Configuration
### Path Parameters
ID of the Voucher
### Header Parameters
ZBD Project API Key
```json Response
{
"success": true,
"data": {
"amount": "1000",
"code": "7EE15185",
"createdAt": "2023-08-24T15:01:56.408Z",
"createTransactionId": "0e11be7a-fd5e-48db-a0bb-54731681bc25",
"description": "Voucher for user.",
"id": "a2eb43c4-af7f-4eb9-839c-ca31db34b3fc",
"redeemedAt": null,
"redeemedById": null,
"redeemedTransactionId": null,
"revokedAt": null,
"revokedById": null,
"revokedTransactionId": null,
"updatedAt": null,
"unit": "msats",
"walletId": "4a4bd549-297e-4e67-a594-386200e1bc21"
},
"message": "Successfully retrieved Voucher."
}
```
# Revoke Voucher
Source: https://docs.zbdpay.com/payments/api/vouchers/revoke
POST https://api.zebedee.io/v0/revoke-voucher
## Description
Credits your Project wallet by revoking a valid (non-redeemed, non-revoked) single-time use [ZBD Voucher](/get-started/vouchers).
## Usage
Enter a valid 8-digit voucher Code to reclaim the sats to your Project wallet. Revoke a voucher if you don't want the Voucher to be redeemable by another user.
## Configuration
### Header Parameters
ZBD Project API Key
Content Type
### Body
Valid 8-digit ZBD Voucher Code
```json Response
{
"success": true,
"data": {
"amount": "1000",
"code": "E044A15A",
"createdAt": "2023-08-24T15:04:19.927Z",
"description": "Voucher for user.",
"id": "8703d5da-6b38-499f-b543-c6e73543b371",
"redeemedAt": null,
"redeemedById": null,
"redeemedTransactionId": null,
"revokedAt": "2023-08-24T15:04:41.196Z",
"revokedById": "4a4bd549-297e-4e67-a594-386200e1bc21",
"revokedTransactionId": "34f5abab-3f36-4fb3-b25a-4d54b0ad0924",
"unit": "msats"
},
"message": "Successfully revoked Voucher."
}
```
# Wallet
Source: https://docs.zbdpay.com/payments/api/wallet
How to manage your ZBD Wallet using ZBD Payments APIs.
Section coming soon.
# Initiate Internal Transfer
Source: https://docs.zbdpay.com/payments/api/wallet/internal-transfer
POST https://api.zebedee.io/v0/internal-transfer
Performs a transfer of funds between two Projects.
## Usage
The API Key used is the Project Wallet that is `SPENDING` the funds, so the `apikey` used in this request must be the `SENDER` Project Wallet.
In the body payload, the API also expects a `receiverWalletId`. This Project Wallet ID has to match the `RECEIVING` Project Wallet ID, which can be found in the ZBD Developer Dashboard under Project Details.
This API is primarily to be used for any programmatic movement of funds between any two of your Projects.
## Configuration
### Header Parameters
ZBD Project API Key
Content Type
### Body
The amount to be transferred -> in millisatoshis
The Wallet ID of the recipient Project
```json Response
{
"success": true,
"data": {
"id": "c8571a4c-3c34-47af-8ded-ebd476f519c1",
"senderWalletId": "b81fa874-ac60-4a08-84f2-0af79684c506",
"receiverWalletId": "b804ee02-ec0b-4fd4-b99f-1f2d3d0001a6",
"userId": "2470d896-9dc8-4d49-b18c-a4e83263e76d",
"sendTxId": "f532db20-2cfa-41b0-8c00-40cfbe124b54",
"receiveTxId": "4b4640e0-d8a2-4f1e-8973-d98196f79a88",
"status": "TRANSFER_STATUS_COMPLETED",
"amount": "1000",
"createdAt": "2023-02-16T02:28:32.754Z",
"updatedAt": "2023-02-16T02:28:32.777Z"
},
"message": "Internal Transfer done."
}
```
# Get Wallet
Source: https://docs.zbdpay.com/payments/api/wallet/retrieve-balance
GET https://api.zebedee.io/v0/wallet
Retrieve all data about a ZBD Project's Wallet.
To retrieve the balance of the Wallet for a specific ZBD Project, just make sure to use that Project's API Key in the `apikey` header property in the API endpoint.
## Configuration
### Header Parameters
ZBD Project API Key
```json Response
{
"message": "Successfully retrieved Wallet.",
"data": {
"unit": "msats",
"balance": "384000"
}
}
```
# Withdrawal Requests
Source: https://docs.zbdpay.com/payments/api/withdrawal-requests
How to create and manage Withdrawal Requests using ZBD Payments APIs.
Section coming soon.
# Create Withdrawal Request
Source: https://docs.zbdpay.com/payments/api/withdrawal-requests/create
POST https://api.zebedee.io/v0/withdrawal-requests
Start creating Bitcoin voucher QR codes.
## Description
Withdrawal Requests can be thought of as exact opposites to Charges. Charges in the ZBD API are QR codes that represent Payment Requests in the Bitcoin Lightning Network. These QR codes expect that a payer will scan and perform a **payment** against it.
A Withdrawal Request is the same in that it also is represented as a QR code. But unlike Charges, Withdrawal Requests are QR codes that someone scans to **receive** Bitcoin. You can read more about the LNURL Withdrawal specification [here](https://github.com/lnurl/luds/blob/luds/03.md).
Think of it like this:
* **Charges** -> Lightning QR codes that **YOU SPEND**
* **Withdrawal Requests** -> Lightning QR codes that **YOU RECEIVE**
## Usage
The most common use of this API endpoint are 1) Fintechs adding the ability for Withdrawals / Payouts through the Lightning Network, and 2) Apps and Games sending Bitcoin microrewards through Withdrawal QR codes / redeem codes.
Every Withdrawal Request will be in a `pending` state until someone scans the QR code and claims the funds.
Withdrawal Requests created by ZBD API are `single-use` and will not work if attempted again.
## Configuration
### Header Parameters
ZBD Project API Key
Content Type
### Body
The amount for the Withdrawal Request -> in millisatoshis
Note or comment for this Withdrawal Request
Time until Withdrawal Request expiration -> in seconds
Open metadata string property
The endpoint ZBD will POST Charge updates to
```json 200 Response
{
"success": true,
"data": {
"id": "e54e62d4-9cfa-495d-abb9-9c9f4bc4f2cf",
"unit": "msats",
"amount": "15000",
"createdAt": "2023-04-27T22:15:54.258Z",
"expiresAt": "2023-04-27T22:20:54.252Z",
"internalId": "1c3b1-f61j2",
"description": "Withdraw QR!",
"callbackUrl": "https://your-website.com/zbd-callback",
"status": "pending",
"fee": null,
"invoice": {
"request": "lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9acxz7tvdaskgtthd96xserjv9mkzmpdwfjhzat9wd6r7um9vdex2apax5exxwpjx9jx2wf4xajnxc3sx4jrwcenv56nwdm9vg6kxwtrx9sk2dtzvsunxce3vymkxef4vycxvwpexd3kxcmpxcmk2d3n8yenswqph63m6",
"fastRequest": "lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9acxz7tvdaskgtthd96xserjv9mkzmpdwfjhzat9wd6r7arpvu7hw6t5dpj8ycth2fjhzat9wd6zv6e3856nycecxgckgefex5mk2vmzxq6kgdmrxdjn2dehv43r2ceevvckzef4vfjrjvmrx9snwcm9x4snqe3c8yekxcmrvymrwefkxvunxwpcyekkjmjhd96xserjv9mkzcnvv57nzdfsxqczvmtp0ptkjargv3exzampvfkx20f3x5crqvpxv3jkvct4d36ygetnvdexjur5d9hku02hd96xserjv9mjq52jyynxxctvd33xzcmt8458garswvaz7tmpwp5ju7n9vfjkget99e5k7tmkxqhhqun0vdjhxuedwa5hg6rywfshwctv94ex2ut4v4ehg5thy6x",
"uri": "lightning:lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9acxz7tvdaskgtthd96xserjv9mkzmpdwfjhzat9wd6r7um9vdex2apax5exxwpjx9jx2wf4xajnxc3sx4jrwcenv56nwdm9vg6kxwtrx9sk2dtzvsunxce3vymkxef4vycxvwpexd3kxcmpxcmk2d3n8yenswqph63m6",
"fastUri": "lightning:lnurl1dp68gurn8ghj7ctsdyh85etzv4jx2efwd9hj7a3s9acxz7tvdaskgtthd96xserjv9mkzmpdwfjhzat9wd6r7arpvu7hw6t5dpj8ycth2fjhzat9wd6zv6e3856nycecxgckgefex5mk2vmzxq6kgdmrxdjn2dehv43r2ceevvckzef4vfjrjvmrx9snwcm9x4snqe3c8yekxcmrvymrwefkxvunxwpcyekkjmjhd96xserjv9mkzcnvv57nzdfsxqczvmtp0ptkjargv3exzampvfkx20f3x5crqvpxv3jkvct4d36ygetnvdexjur5d9hku02hd96xserjv9mjq52jyynxxctvd33xzcmt8458garswvaz7tmpwp5ju7n9vfjkget99e5k7tmkxqhhqun0vdjhxuedwa5hg6rywfshwctv94ex2ut4v4ehg5thy6x"
}
},
"message": "Successfully created Withdrawal Request."
}
```
```json 400 Response
{
"success": false,
"message": "The minimum Withdrawal amount supported is 10 satoshis."
}
```
# Retrieve Withdrawal Request
Source: https://docs.zbdpay.com/payments/api/withdrawal-requests/retrieve
GET https://api.zebedee.io/v0/withdrawal-requests/{id}
Retrieve all data about a single Withdrawal Request.
## Configuration
### Path Parameters
Withdrawal Request ID
### Header Parameters
ZBD Project API Key
```json Response
{
"success": true,
"message": "Successfully retrieved Withdrawal Request.",
"data": {
"unit": "msats",
"amount": "12000",
"status": "pending",
"createdAt": "2020-05-09T15:15:30.222Z",
"expiresAt": "2020-05-09T15:20:30.212Z",
"description": "My Withdrawal Description",
"id": "243ee7f6-a91b-4644-aa5f-ecc9c9fdd351",
"internalId": "11af01d092444a317cb33faa6b8304b8",
"callbackUrl": "https://your-website.com/zbd-callback",
"invoice": {
"request": "lnurl1dp68gurn8ghj7er9wch85etzv4jx2efwd9hj7a3s9acxz7tvdaskgtthd96xserjv9mkzmpdwfjhzat9wd6r7um9vdex2apaxfsnqvmz8pjx2ephxucnzdphxa3xzd3kvfjk2vnyxejnzdf3x93n2e3evesnsetyxsenzvesvdjrxdtrv9jxxdnzxaskxvm9vscrzeg58h24k",
"fastRequest": "lnurl1dp68gurn8ghj7er9wch85etzv4jx2efwd9hj7a3s9acxz7tvdaskgtthd96xserjv9mkzmpdwfjhzat9wd6r7arpvu7hw6t5dpj8ycth2fjhzat9wd6zv6e385exzvpnvguxgetyxumnzvf5xumkycfkxe3x2efjvsmx2vf4xyckxdtx89nxzwr9vs6rxvfnxp3kgve4vdskgcekvgmkzcenv4jrqvt9yekkjmjhd96xserjv9mkzcnvv57nzv3sxqczvmtp0ptkjargv3exzampvfkx20f3xgcrqvpxv3jkvct4d36ygetnvdexjur5d9hku02d0ys9w6t5dpj8ycthv9kzq3r9wd3hy6tsw35k7m3xvdskcmrzv93kk0tgw368que69uhkgetk9eax2cn9v3jk2tnfduhhvvp0wpex7cm9wdej6amfw35xgunpwaskcttjv4ch2etnwsvtdjtq",
"uri": "lightning:lnurl1dp68gurn8ghj7er9wch85etzv4jx2efwd9hj7a3s9acxz7tvdaskgtthd96xserjv9mkzmpdwfjhzat9wd6r7um9vdex2apaxfsnqvmz8pjx2ephxucnzdphxa3xzd3kvfjk2vnyxejnzdf3x93n2e3evesnsetyxsenzvesvdjrxdtrv9jxxdnzxaskxvm9vscrzeg58h24k",
"fastUri": "lightning:lnurl1dp68gurn8ghj7er9wch85etzv4jx2efwd9hj7a3s9acxz7tvdaskgtthd96xserjv9mkzmpdwfjhzat9wd6r7arpvu7hw6t5dpj8ycth2fjhzat9wd6zv6e385exzvpnvguxgetyxumnzvf5xumkycfkxe3x2efjvsmx2vf4xyckxdtx89nxzwr9vs6rxvfnxp3kgve4vdskgcekvgmkzcenv4jrqvt9yekkjmjhd96xserjv9mkzcnvv57nzv3sxqczvmtp0ptkjargv3exzampvfkx20f3xgcrqvpxv3jkvct4d36ygetnvdexjur5d9hku02d0ys9w6t5dpj8ycthv9kzq3r9wd3hy6tsw35k7m3xvdskcmrzv93kk0tgw368que69uhkgetk9eax2cn9v3jk2tnfduhhvvp0wpex7cm9wdej6amfw35xgunpwaskcttjv4ch2etnwsvtdjtq"
}
}
}
```
# Changelog
Source: https://docs.zbdpay.com/payments/changelog
Track changes and updates to ZBD Payments APIs, products, and services.
## AI Assistant Launch
* Released AI Assistant for docs.zbdpay.com documentation
* Ask questions about any aspect of ZBD's documentation and integrations
* Get instant answers about SDK implementations and code examples
* Learn about country coverage and supported regions
* Understand integration options and best practices
* Explore product capabilities and features
* Get help troubleshooting common issues
* Available 24/7 to assist with documentation queries
## Improved Documentation
* Comprehensive rewrite of ZBD documentation with expanded content and guides
* Enhanced [Payments](/payments) documentation with detailed Lightning Network and Lightning Address explanations
* New [Rewards](/rewards) SDK documentation and integration guides
* Added complete [ZBD Onramp](/payments/onramp) documentation and quickstart
* Expanded voucher system documentation with implementation examples
* Streamlined navigation and improved documentation structure
* Added more context and real-world examples throughout
## docs.zbdpay.com Updated
* ZBD Payments Documentation site with divided section for each business vertical
* [Payments](/payments)
* [Rewards](/rewards)
## TypeScript SDK
```bash
pnpm install @zbddev/payments-sdk
```
* New TypeScript SDK for ZBD Payments APIs support [all APIs available](/payments/api).
```typescript
import ZbdPayments from '@zbddev/payments-sdk';
const client = new ZbdPayments({
apikey: process.env['ZBD_PAYMENTS_API_KEY'],
});
async function main() {
await client.lightningAddress.sendPayment({
amount: '500000',
comment: 'Instant global payments',
lnAddress: 'andreneves@zbd.gg',
});
}
main();
```
# Global Support
Source: https://docs.zbdpay.com/payments/coverage
List of regions where ZBD Payments APIs, SDKs, and services are supported.
**This page lists region coverage for ZBD Payments products.** For ZBD Rewards product region coverage, please visit [Rewards Coverage](/rewards/coverage).
### US States
The ZBD API is available in all US states, **except New York (NY)**.
***
### Countries
The ZBD API is **NOT YET** available in the following countries:
* Afghanistan
* Algeria
* Andorra
* Aruba
* Azerbaijan
* Bahamas
* Bangladesh
* Barbados
* Belarus
* Belize
* Benin
* Bolivia
* Bosnia-Herzegovina
* Botswana
* Burundi
* Cambodia
* Cayman Islands
* Central African Republic
* Chad
* China
* Comoros
* Congo (Brazzaville)
* Costa Rica
* Cuba
* Democratic People’s Republic of Korea (DPRK)
* Democratic Republic of the Congo
* Dominican Republic
* Ecuador
* Equatorial Guinea
* Falkland Islands
* Faroe Islands
* Fiji
* French Polynesia
* Ghana
* Gibraltar
* Greenland
* Guam
* Guatemala
* Guinea
* Guinea-Bissau
* Haiti
* Honduras
* Iran
* Iraq
* Jamaica
* Kiribati
* Kyrgyzstan
* Lao People’s Democratic Republic
* Lebanon
* Lesotho
* Liberia
* Libya
* Liechtenstein
* Macau
* Madagascar
* Maldives
* Mali
* Marshall Islands
* Martinique
* Mauritania
* Mauritius
* Monaco
* Mongolia
* Morocco
* Mozambique
* Myanmar (Burma)
* Nicaragua
* Niger
* Niue
* Norfolk Island
* Oman
* Pakistan
* Palau
* Palestine, State of
* Panama
* Pitcairn
* Russia
* Samoa
* San Marino
* Sao Tome & Prin.
* Saudi Arabia
* Senegal
* Seychelles
* Somalia
* South Sudan
* Sudan
* Syria
* Tanzania
* Timor-Leste
* Togo
* Trinidad and Tobago
* Turkmenistan
* Tuvalu
* Uganda
* Ukraine
* United States Virgin Islands
* Vanuatu
* Vatican City State
* Venezuela
* Vietnam
* Yemen
* Zimbabwe
# Glossary
Source: https://docs.zbdpay.com/payments/glossary
In this documentation portal you will encounter a handful of highly-specific technical terms that are used throughout the ZBD Platform and APIs. Below you will find a Glossary of the main terms used. This list is not exhaustive and is meant to help you understand the concepts and terminology used in the documentation.
## B[](#b "Direct link to heading")
### BOLTs[](#bolts "Direct link to heading")
The [Basis of Lightning Technology (BOLT)](https://github.com/lightning/bolts) are specifications that describe the rules and standards required for participants of the Lightning Network. The standards established by the BOLTs allow different Lightning implementation software to integrate with one another and form a network.
### BOLT11[](#bolt11 "Direct link to heading")
[BOLT11](https://bolt11.org) is the 11th specification document for the BOLTs (Basis of Lightning Technology), and it is the invoice protocol for Lightning Payments. It is a simple, extendable, QR-code-ready protocol for requesting payments over Lightning.
Learn more about BOLT11 on this [interactive visualizer](https://bolt11.org) as well as the core [RFC documentation](https://github.com/lightning/bolts/blob/master/11-payment-encoding.md).
## C[](#c "Direct link to heading")
### Charge[](#charge "Direct link to heading")
A Charge is the name given inside of the ZBD Platform to a Lightning Network invoice (BOLT11) that is sent to a peer to request a Bitcoin payment.
## I[](#i "Direct link to heading")
### Invoice[](#invoice "Direct link to heading")
Invoices, charges, payment requests -- these are all terms for the same thing. Invoices are used to request payments from a peer on the Bitcoin Lightning Network.
## L[](#l "Direct link to heading")
### Lightning Address[](#lightning-address "Direct link to heading")
A [Lightning Address](https://lightningaddress.com) is a unique internet identifier that identifies a user inside of a given provider. It resembles an email address format with `username` @ `provider.com`. The ZBD API allows a developer to send payments to any user of a company, wallet provider, or self-hosted user software that supports the open source protocol.
By leveraging Lightning Addresses a developer is able to support sending payments to users of any provider, with frictionless user experience.
**It's like an email address, but for your Bitcoin.**
Every ZBD user has a unique Lightning Address based on their [ZBD Gamertag](https://zbd.gg) resembling **[satoshi@zbd.gg](mailto:satoshi@zbd.gg)**.
### LNURL[](#lnurl "Direct link to heading")
LNURL is a set of HTTP open API standards that aim to facilitate the interactions between service providers (stores, websites, apps) and wallets (users). The idea is to provide for standardized ways of performing Bitcoin Lightning Network invoice-orchestration and payment-requesting.
LNURL technologis are leveraged inside of the ZBD Platform in places such as Static Charges and Withdrawal Requests. LNURL is also the base protocol for the Lightning Address user standard.
## M[](#m "Direct link to heading")
### Millisatoshi[](#millisatoshi "Direct link to heading")
The ZBD API is built on millisatoshis. 1,000 millisatoshis make up 1 satoshi. And 100 million satoshis make up 1 Bitcoin. This is akin to 100 cents being equal to 1 dollar.
While the API is built with millisatoshis in mind, the currently-allowed minimum amount for transaction sizes is 1 satoshi, or 1,000 millisatoshis. 1 satoshi is currently valued at \$0.0005 USD, and the system was built with scalability in mind, both in amount size, and Bitcoin valuation.
**100,000,000 satoshis = 1 Bitcoin**
**1,000 millisatoshis = 1 satoshi**
## O[](#o "Direct link to heading")
### On-chain[](#on-chain "Direct link to heading")
On-chain is a term used to describe any data that is registered on the Bitcoin blockchain, in contrast with off-chain data, which is not stored on the blockchain. On-chain data are always Bitcoin transactions, while off-chain data can be an unconfirmed Bitcoin transaction or any other type of data.
### Off-chain[](#off-chain "Direct link to heading")
Off-chain is a term used to describe any data that is not registered on the Bitcoin blockchain. Off-chain data can be Bitcoin transactions that were not sent to the blockchain, data on the Lightning Network, or data on other blockchains, such as a sidechain.
## S[](#s "Direct link to heading")
### Satoshi[](#satoshi "Direct link to heading")
Satoshis, or “sats” for short, are the atomic unit of Bitcoin, named after Bitcoin’s creator, Satoshi Nakamoto. A Bitcoin is equal to 100 million satoshis (1 BTC = 100,000,000 sats).
**There will only ever be 21 million bitcoin, and there will only ever be 2.1 quadrillion sats.**
This makes Bitcoin more divisible, enabling payments smaller than $0.01 at current prices. 1 satoshi is currently valued at ~$0.0005 USD.
## V[](#v "Direct link to heading")
### Voucher[](#voucher "Direct link to heading")
A ZBD Voucher is an 8-digit code that can be used in any product in the ZBD suite to redeem for Bitcoin on the Lightning Network. It is usually used as a tool for onboarding new users to Bitcoin.
Learn more about the capabilities of ZBD Vouchers on [this thread](https://twitter.com/andreneves/status/1517572121609879552).
## W[](#w "Direct link to heading")
### Withdrawal Request[](#withdrawal-request "Direct link to heading")
A Withdrawal Request is the direct opposite of a Payment Request (or Charge). The Withdrawal Request is used to request a withdrawal **from** a user's wallet, whereas a Payment Request is used to request a payment **to** a user's wallet.
While both user flows are nearly identical -- scan QR code and press submit -- behind the scenes one flow is sending Bitcoin over Lightning while the other is **request Bitcoin to be sent over Lightning**. If you ever want to **receive Bitcoin by scanning a QR code**, then that's what a Withdrawal Request effectively enables.
# Lightning Address
Source: https://docs.zbdpay.com/payments/lightning-address
The human-readable payment protocol that transformed Bitcoin UX forever
Lightning Address is the protocol that made Bitcoin payments as simple as sending an email. Created by Andre Neves (CTO of ZBD) in 2021, it has become the standard for user-friendly Bitcoin payments, processing millions of transactions across hundreds of apps and services globally.
**Fun Fact**: Lightning Address was invented at ZBD to solve a real problem – our users were terrified of long Bitcoin Lightning invoices. Today, it's an open protocol used by the entire Lightning ecosystem.
[user@domain.com](mailto:user@domain.com) instead of lnbc1pvjluezpp5qqqsyq...
One address, unlimited payments. No more invoice generation.
Works across all supporting wallets and services globally.
## The UX Revolution
### Before Lightning Address (2009-2021)
```bash
# Bitcoin address (hard to remember, changes each time)
bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh
# Lightning invoice (expires, single use, even longer)
lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d73gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ecky03ylcqca784w
```
**Problems:**
* 🤯 Impossible to memorize
* ⏱️ Invoices HAVE to expire at a certain time
* 🔄 New address / invoice needed for each payment
* 📱 Required QR codes or copy-paste
### After Lightning Address (2021-Present)
```bash
# Lightning Address (simple, permanent, reusable)
andre@zbd.gg
```
**Solved:**
* ✅ Easy as email – memorizable and shareable
* ✅ Works 24/7 – receive payments while you sleep
* ✅ One address forever – put it in your bio
* ✅ No QR codes needed – just type it
## How Lightning Address Works
Sender enters `gamer@zbd.gg` in any Lightning wallet
Wallet looks up `https://zbd.gg/.well-known/lnurlp/gamer`
ZBD creates a fresh Lightning invoice for this payment
Standard Lightning payment flows to recipient
```mermaid
sequenceDiagram
participant User
participant Wallet
participant ZBD Server
participant Recipient
User->>Wallet: Pay andre@zbd.gg
Wallet->>ZBD Server: GET /.well-known/lnurlp/andre
ZBD Server->>Wallet: Payment details + invoice
Wallet->>ZBD Server: Lightning payment
ZBD Server->>Recipient: Payment received!
```
## Real-World Impact
Since its creation in 2021, Lightning Address has transformed Bitcoin payments and ZBD is here to support it.
Maintaining the protocol specification, contributing improvements back to community, and advocating for widespread adoption.
### Success Stories
**🎮 Gaming Revolution**
* Players share addresses as gamertags
* Streamers receive tips without interruption
* Tournament payouts to `player@zbd.gg`
* Cross-game portable identity
**💸 Creator Economy**
* Artists put addresses in social bios
* Direct fan-to-creator payments
* No platform fees or restrictions
* Instant global monetization
**🌍 Global Remittances**
* Families share memorable addresses
* No bank account required
* Instant settlement, minimal fees
* Works on basic smartphones
## Why Lightning Address Matters
### 1. Mainstream-Ready UX
**Email Model**: Everyone understands email. Lightning Address uses the same mental model – user\@domain – making Bitcoin accessible to billions.
No technical knowledge required. No long strings. No QR codes. Just human-readable addresses.
**Set It and Forget It**: Unlike invoices that expire or addresses that change, your Lightning Address is permanent. Put it on business cards, social profiles, or billboards.
Receive payments 24/7/365 without generating new invoices.
**Universal Standard**: Send from any supporting wallet to any other supporting service. Like email, it just works across providers.
ZBD to Cash App – all seamless.
### 2. Enhanced Privacy
* No on-chain footprint for address lookups
* Rotating invoices prevent payment correlation
* Optional sender/receiver metadata
* No public address / invoice reuse
### 3. Developer Friendly
```javascript Node.js
// Send to Lightning Address
const payment = await zbd.sendLightningAddress({
lnAddress: 'andre@zbd.gg',
amount: 1000, // sats
comment: 'Thanks for creating this!'
});
// Validate Lightning Address
const isValid = await zbd.validateLightningAddress({
lnAddress: 'user@domain.com'
});
```
```python Python
# Create Lightning Address for user
address = zbd.create_lightning_address(
username="newuser",
user_id="usr_123"
)
# Returns: newuser@zbd.gg
# Receive notification on payment
@webhook_handler
def payment_received(data):
print(f"Received {data.amount} sats")
```
## Advanced Features
### Custom Domains
Run Lightning Address on your own domain:
```nginx
# Nginx config for yourgame.com
location /.well-known/lnurlp/ {
proxy_pass https://api.zebedee.io/lnurlp/;
proxy_set_header Host api.zebedee.io;
}
```
Now users can have `player@yourgame.com` addresses!
## The Future of Lightning Address
ZBD continues to evolve the protocol:
* **🔜 Multi-Currency Support**: Send USD and receive BTC seamlessly
* **🔜 Cross-Currency Payments**: Automatic currency conversion on payment
* **🔜 Bitcoin Onchain**: Support for traditional Bitcoin addresses (fallback)
* **🔜 BOLT12 Integration**: Enhanced Lightning Network features
**Want to onramp users directly to Lightning Addresses?**
[ZBD Onramp](/payments/onramp) is the first and only fiat-to-crypto widget that supports Lightning Address delivery. Let your users buy Bitcoin and receive it instantly at their Lightning Address!
## Start Using Lightning Address
[Contact our team](https://zbd.one/sales) to get your API keys
Use our SDKs to create and manage Lightning Addresses
Help users understand their new superpower
Complete Lightning Address API docs
Quick integration with our SDKs
Onramp directly to Lightning Addresses
***
Lightning Address is an open protocol. While ZBD created and maintains it, it's free for anyone to implement. We're proud to have contributed this UX breakthrough to the Bitcoin ecosystem and continue supporting its growth.
# Lightning Network
Source: https://docs.zbdpay.com/payments/lightning-network
Instant global payments that unlock new business models impossible with traditional systems
The Lightning Network transforms Bitcoin from digital gold into a global payment rail capable of millions of transactions per second. It's not just faster Bitcoin – it's an entirely new paradigm for moving money.
Payments settle in milliseconds, not minutes or days
Send 1 cent for \$0.0001 in fees. Finally, micropayments that work.
Millions of TPS capacity. Built for the scale of the internet.
## What Makes Lightning Different
### Traditional Payments vs Lightning
**Credit Cards**: 2-3 business days to settle\
**Bank Transfers**: 1-5 business days\
**Bitcoin**: 10-60 minutes\
**Lightning**: \< 1 second ⚡
Lightning payments are literally faster than loading a webpage.
**Credit Cards**: `2.9% + $0.30`\
**International Wire**: `$25-50`\
**Bitcoin**: `$1-20` (varies)\
**Lightning**: `< $0.01` (typical)
Send 1 cent profitably.
## New Business Models Now Possible
Lightning enables entirely new ways to monetize and transfer value that were impossible before:
### 💰 True Micropayments
Finally, payments smaller than a dollar that actually make sense:
* \$0.01 to read an article
* \$0.001 per API call
* \$0.05 to skip ads
* Tips as small as \$0.0001
* Buy items for pennies
* Micro-wagers on matches
* Pay-to-play arcade style
* Fractional tournament fees
### 🌍 Instant Global Settlement
Send money anywhere, instantly, 24/7/365:
```javascript
// Monday 3am in Tokyo → Sunday 2pm in New York
// Settlement: 847 milliseconds
// Fee: $0.003
// No banks involved
await zbd.send({
amount: 1000000, // sats (~$500)
receiver: 'business@tokyo.jp',
comment: 'Invoice #12345'
});
```
**Unlocked Use Cases:**
* Global gig economy payments
* Cross-border gaming economies
* International remittances
* 24/7 market settlement
### ⚡ Machine-to-Machine Payments
APIs and IoT devices that pay each other automatically:
```javascript
// Car pays for parking by the second
while (parked) {
await payParkingMeter({
amount: 0.001, // $0.001 per second
meterId: 'meter_sf_123'
});
await sleep(1000);
}
```
**Future Applications:**
* Self-paying autonomous vehicles
* IoT device micropayments
* AI agents with wallets
* Automated supply chains
## How Lightning Actually Works
Think of Lightning like having bar tabs across the internet. Instead of settling every drink immediately, you keep a running tab and settle up later.
### The Bar Tab Analogy
You and the bartender each put \$100 in a lockbox (the channel)
Each drink updates the balance. You owe more, bartender owes less.
Your friend can pay through your tab if they know the bartender
Close the tab and take your remaining balance
### Technical Architecture
```mermaid
graph TB
A[Your Wallet] ---|Payment Channel| B[ZBD Node]
B ---|Routing| C[Lightning Network]
C ---|Multiple Hops| D[Recipient]
style A fill:#f9f,stroke:#333,stroke-width:2px
style D fill:#9f9,stroke:#333,stroke-width:2px
```
**Key Concepts:**
Two-party Bitcoin smart contracts that enable unlimited off-chain transactions. Only opening and closing hit the blockchain.
Payments find the best path through multiple channels automatically. Like internet packet routing, but for money.
HTLCs (Hash Time-Locked Contracts) ensure payments either complete fully or fail completely. No money gets stuck.
Channels need Bitcoin on both sides to route payments. ZBD manages this complexity for you.
## Common Myths Debunked
**"Lightning is too complex for users"**
Reality: Users just see an email-like address ([user@zbd.gg](mailto:user@zbd.gg)). The complexity is abstracted away, just like email hides SMTP.
**"Lightning is centralized"**
Reality: 15,000+ nodes globally. More decentralized than traditional DNS or BGP internet routing.
**"Lightning is still experimental"**
Reality: \$400M+ total network capacity, processing millions of payments daily across major apps and games.
## Building on Lightning
### Quick Start Examples
```javascript Node.js
// Receive streaming payments
const invoice = await zbd.createCharge({
amount: 1000, // sats
description: 'Power-up purchase'
});
// Send instant payment
await zbd.sendPayment({
receiver: 'gamer@zbd.gg',
amount: 500,
comment: 'GG! Nice win'
});
```
```python Python
# Generate Lightning invoice
invoice = zbd.create_charge(
amount=1000,
description="API credits"
)
# Pay Lightning Address
payment = zbd.send_payment(
receiver="api@zbd.gg",
amount=100
)
```
### Best Practices
Begin with simple send/receive before complex flows
Use satoshis (1 BTC = 100M sats) for precision
## The Future is Streaming Money
Lightning isn't just an improvement to payments – it's a fundamental shift in how money moves. Just as the internet packetized information, Lightning packetizes value.
### What's Next
* **AI Agents**: LLMs with Lightning wallets paying for resources
* **Streaming Contracts**: Smart contracts that execute based on payment flows
* **Global Gaming Economies**: Truly borderless in-game currencies
* **Machine Economy**: Billions of devices transacting autonomously
Get your API keys and build the next generation of payment experiences. The internet of money is here.
## Resources
Human-readable payment addresses
Complete Lightning API docs
Step-by-step implementation
***
Lightning Network is open source and permissionless. While you can technically run your own node, ZBD handles all of the complexity of channel management, liquidity, and routing so you can focus on building great experiences.
# MCP Server
Source: https://docs.zbdpay.com/payments/mcp
Extend the capabilities of your AI Agents with ZBD Payments as an MCP Server
## What is MCP?
MCP is a protocol for integrating tools with AI Agents. It can greatly enhance the capabilities of your AI Agents by providing them with real-time data and context.
ZBD has MCP support built into the [ZBD Payments TypeScript SDK](/payments/sdk/typescript).
## Using ZBD Payments as an MCP server
You need a MCP-capable Agent environment to use ZBD Payments as an MCP server. A few of them are Claude and Cursor.
### Claude
Add the following server definition to your claude\_desktop\_config.json file:
```json
{
"mcpServers": {
"zbd": {
"command": "npx",
"args": ["-y", "@zbddev/payments-sdk-mcp", "--client=claude"],
"env": {
"ZBD_PAYMENTS_API_KEY": "YOUR_ZBD_API_KEY"
}
}
}
}
```
## Filtering tools
You can run the package on the command line to discover and filter the set of tools that are exposed by the ZBD MCP Server. This can be helpful for large APIs where including all endpoints at once is too much for your AI's
context window.
You can filter by multiple aspects:
* `--tool` includes a specific tool by name
* `--resource` includes all tools under a specific resource, and can have wildcards, e.g. `my.resource*`
* `--operation` includes just read (get/list) or just write operations
See more information with `--help`.
All of these command-line options can be repeated, combined together, and have corresponding exclusion versions (e.g. `--no-tool`).
Use `--list` to see the list of available tools, or see below.
### Specifying the MCP Client
Different clients have varying abilities to handle arbitrary tools and schemas.
You can specify the client you are using with the `--client` argument, and the MCP server will automatically
serve tools and schemas that are more compatible with that client.
* `--client=`: Set all capabilities based on a known MCP client
* Valid values: `openai-agents`, `claude`, `claude-code`, `cursor`
* Example: `--client=cursor`
Additionally, if you have a client not on the above list, or the client has gotten better
over time, you can manually enable or disable certain capabilities:
* `--capability=`: Specify individual client capabilities
* Available capabilities:
* `top-level-unions`: Enable support for top-level unions in tool schemas
* `valid-json`: Enable JSON string parsing for arguments
* `refs`: Enable support for \$ref pointers in schemas
* `unions`: Enable support for union types (anyOf) in schemas
* `formats`: Enable support for format validations in schemas (e.g. date-time, email)
* `tool-name-length=N`: Set maximum tool name length to N characters
* Example: `--capability=top-level-unions --capability=tool-name-length=40`
* Example: `--capability=top-level-unions,tool-name-length=40`
## Importing the tools and server individually
```js
// Import the server, generated endpoints, or the init function
import { server, endpoints, init } from "@zbddev/payments-sdk-mcp/server";
// import a specific tool
import createChargeGamertags from "@zbddev/payments-sdk-mcp/tools/gamertags/create-charge-gamertags";
// initialize the server and all endpoints
init({ server, endpoints });
// manually start server
const transport = new StdioServerTransport();
await server.connect(transport);
// or initialize your own server with specific tools
const myServer = new McpServer(...);
// define your own endpoint
const myCustomEndpoint = {
tool: {
name: 'my_custom_tool',
description: 'My custom tool',
inputSchema: zodToJsonSchema(z.object({ a_property: z.string() })),
},
handler: async (client: client, args: any) => {
return { myResponse: 'Hello world!' };
})
};
// initialize the server with your custom endpoints
init({ server: myServer, endpoints: [createChargeGamertags, myCustomEndpoint] });
```
## Available Tools
The following tools are available in this MCP server.
### Resource `gamertags`:
* `create_charge_gamertags` (`write`): Generate a payment request for a ZBD User.
* `retrieve_by_gamertag_gamertags` (`read`): Retrieve Gamertag from a ZBD user ID.
* `retrieve_by_zbd_id_gamertags` (`read`): Retrieve ZBD user ID from a Gamertag.
* `retrieve_payment_gamertags` (`read`): Retrieve all data about a Payment sent to ZBD User.
* `send_payment_gamertags` (`write`): Send instant Bitcoin payments to ZBD Users.
### Resource `lightning_charges`:
* `create_lightning_charges` (`write`): Start receiving instant Bitcoin payments through the ZBD API.
* `retrieve_lightning_charges` (`read`): Retrieve all data about a single Charge.
### Resource `internal_transfer`:
* `initiate_internal_transfer` (`write`): Performs a transfer of funds between two Projects.
### Resource `lightning_address`:
* `create_charge_lightning_address` (`write`): Generate a payment request for a Lightning Address.
* `send_payment_lightning_address` (`write`): Send instant Bitcoin payments to any Lightning Address.
* `validate_lightning_address` (`read`): Verify the validity of a Lightning Address.
### Resource `lightning_static_charges`:
* `create_lightning_static_charges` (`write`): Start accepting payments on Lightning with Static QR codes.
* `retrieve_lightning_static_charges` (`read`): Retrieve all data about a single Static Charge.
* `update_lightning_static_charges` (`write`): Change the configuration of a Static Charge QR code.
### Resource `vouchers`:
* `create_vouchers` (`write`): Create Voucher
* `retrieve_vouchers` (`read`): Get Voucher
* `redeem_vouchers` (`write`): Redeem Voucher
* `revoke_vouchers` (`write`): Revoke Voucher
### Resource `withdrawal_requests`:
* `create_withdrawal_requests` (`write`): Start creating Bitcoin voucher QR codes.
* `retrieve_withdrawal_requests` (`read`): Retrieve all data about a single Withdrawal Request.
### Resource `lightning_payments`:
* `retrieve_lightning_payments` (`read`): Retrieve all data about a single Payment.
* `send_lightning_payments` (`write`): Start sending instant Bitcoin payments through the ZBD API.
### Resource `wallet`:
* `retrieve_balance_wallet` (`read`): Retrieve all data about a ZBD Project's Wallet.
### Resource `utils`:
* `check_ip_support_utils` (`read`): Verify if a user is coming from a supported region.
* `decode_lightning_charge_utils` (`write`): Understand the inner properties of a Charge QR code.
* `list_prod_ips_utils` (`read`): Get the official IP addresses of ZBD servers.
* `retrieve_btc_usd_utils` (`read`): Get the latest price for Bitcoin in US Dollars.
### Resource `oauth2`:
* `create_authorization_url_oauth2` (`read`): Create an authorization URL for ZBD Login.
* `refresh_token_oauth2` (`write`): Generate a new accessToken for a ZBD Login user.
* `retrieve_user_data_oauth2` (`read`): Fetch user-related information about a logged-in ZBD User.
* `retrieve_wallet_data_oauth2` (`read`): Fetch wallet-related information about a logged-in ZBD User.
### Resource `keysend_payments`:
* `send_keysend_payments` (`write`): Start sending Keysend payments on the Lightning Network.
### Resource `email_payments`:
* `send_email_payments` (`write`): Send instant Bitcoin payments to any email.
# ZBD Onramp
Source: https://docs.zbdpay.com/payments/onramp
Enable Bitcoin and USDC purchases directly in your app with our embeddable onramp widget
Enable your users to buy Bitcoin and USDC directly within your app or game. ZBD Onramp is the first widget to support Lightning Address delivery, providing instant Bitcoin access for gaming and interactive entertainment.
First-in-market Lightning Address support for instant Bitcoin delivery
Built for high-throughput gaming transactions and in-app purchases
Integrated KYC/AML with gaming-friendly risk assessment
## How It Works
Your backend creates a secure session with our API
Users verify identity and purchase Bitcoin or USDC through the widget
Funds are delivered via Lightning Address or onchain to your users
## Perfect for Gaming Use Cases
### 🎮 In-Game Wallet Top-ups
Let players add funds to their game wallets for purchasing skins, items, or premium content. With Lightning-fast delivery, they're back in the game in seconds.
### 🏆 Tournament Entry Fees
Enable players to fund tournament entries directly. Our high-throughput system handles peak tournament registration periods without breaking a sweat.
### 💰 Play-to-Earn Onboarding
Onboard new players into your crypto-powered game economy. They can purchase their first Bitcoin or USDC and start earning immediately.
## Integration at a Glance
```typescript
// 1. Initialize session (backend)
const session = await zbd.onramp.createSession({
userId: "player_123",
email: "player@game.com"
});
// 2. Embed widget (frontend)
// 3. Handle webhooks
app.post('/webhooks/zbd', (req, res) => {
if (req.body.event === 'purchase.completed') {
// Credit user's game wallet
}
});
```
That's it. One backend endpoint, one iframe, one webhook handler.
## Key Features
### Available Now
* **Pay by Bank** - ACH transfers via Plaid for US users
* Low fees and high success rates
Coming soon: Credit/Debit cards, Apple Pay, Google Pay, and Stablecoin payments
### Bitcoin Delivery
* **Lightning Address** - Instant delivery (industry first!)
* **Onchain Bitcoin** - Standard Bitcoin addresses
### USDC Delivery
* Direct to Ethereum or Polygon addresses
* More chains coming soon
### Built-in Protection
* Advanced AI-native fraud detection
* Automated KYC/AML processes
* Gaming-optimized risk scoring
* Bot/VPN/Emulator detection
## Why ZBD Onramp?
### For Developers
* Simple 3-step integration
* No crypto complexity
* Comprehensive webhook events
* White-label customization
### For Your Users
* Seamless in-app experience
* Fast KYC process
* Competitive rates
* Multiple payment options
## Ready to Get Started?
Schedule a 15-minute demo to see ZBD Onramp in action and get your API keys.
Get up and running in minutes with our integration guide
Explore the API endpoints and webhook events
***
ZBD Onramp requires a business account and KYB verification. Individual developers can explore our Rewards products while preparing for business verification.
# API Reference
Source: https://docs.zbdpay.com/payments/onramp/api
Complete API reference for ZBD Onramp integration
Complete reference for all ZBD Onramp API endpoints and webhook events.
## Base URL
All API requests should be made to:
```
https://api.zebedee.io
```
## Authentication
All requests require an API key in the header:
```
apikey: YOUR_API_KEY
```
Get your API keys by [scheduling a call](https://zbd.one/sales) with our sales team.
## Create Widget Session
Initialize a new onramp widget session for a user.
```bash cURL
POST /api/v1/ramp-widget
curl -X POST https://api.zebedee.io/api/v1/ramp-widget \
-H "Content-Type: application/json" \
-H "apikey: YOUR_API_KEY" \
-d '{
"email": "user@example.com",
"webhook_url": "https://yourapp.com/webhooks/zbd"
}'
```
```javascript Node.js
const response = await fetch('https://api.zebedee.io/api/v1/ramp-widget', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': process.env.ZBD_API_KEY
},
body: JSON.stringify({
email: 'user@example.com',
webhook_url: 'https://yourapp.com/webhooks/zbd'
})
});
const data = await response.json();
```
### Request Body
| Parameter | Type | Required | Description |
| ---------------- | ------ | -------- | --------------------------------------------------------- |
| `email` | string | **Yes** | User's email address for verification |
| `webhook_url` | string | **Yes** | URL to receive webhook notifications |
| `access_token` | string | No | Existing user session token (for returning users) |
| `quote_currency` | string | No | Fiat currency code (default: "USD") |
| `base_currency` | string | No | Cryptocurrency: "BTC" or "USDC" (default: "BTC") |
| `destination` | string | No | URL to redirect after successful purchase |
| `reference_id` | string | No | Your internal reference ID for this session |
| `metadata` | object | No | Custom key-value pairs (max 10 keys, 500 chars per value) |
### Response
```json
{
"success": true,
"data": {
"session_token": "eyJraWQiOiJzLWE1OWNkMjc4...",
"widget_url": "https://ramp.zbdpay.com/?session=eyJraWQiOiJzLWE1OWNkMjc4...",
"session_id": "ses_9n3f7h2u4b",
"expires_at": "2025-06-09T12:00:00Z"
}
}
```
### Error Responses
```json
{
"success": false,
"error": {
"code": "INVALID_EMAIL",
"message": "Please provide a valid email address"
}
}
```
Common error codes:
* `INVALID_EMAIL` - Email format is invalid
* `INVALID_WEBHOOK_URL` - Webhook URL is not accessible
* `UNAUTHORIZED` - Invalid API key
* `RATE_LIMITED` - Too many requests
## Webhook Events
Webhooks are sent as POST requests to your specified `webhook_url`.
### Event Structure
All webhook events follow this structure:
```json
{
"id": "evt_2n4f8gu3nf",
"type": "onramp.purchase.completed",
"created_at": "2025-06-09T10:30:00Z",
"livemode": true,
"data": {
// Event-specific data
}
}
```
### Event Types
#### `onramp.session.created`
Fired when a widget session is initialized.
```json
{
"type": "onramp.session.created",
"data": {
"session_id": "ses_9n3f7h2u4b",
"reference_id": "your_reference_123",
"email": "user@example.com",
"metadata": {
"custom_field": "value"
}
}
}
```
#### `onramp.email.verified`
Fired when user completes email verification.
```json
{
"type": "onramp.email.verified",
"data": {
"session_id": "ses_9n3f7h2u4b",
"user_id": "usr_8h3d6f9k2m",
"email": "user@example.com",
"is_new_user": true
}
}
```
#### `onramp.kyc.completed`
Fired when KYC verification is successfully completed (first-time users only).
```json
{
"type": "onramp.kyc.completed",
"data": {
"session_id": "ses_9n3f7h2u4b",
"user_id": "usr_8h3d6f9k2m",
"kyc_level": "full",
"verified_at": "2025-06-09T10:25:00Z"
}
}
```
#### `onramp.purchase.completed`
Fired when a purchase is successfully completed and crypto is delivered.
```json
{
"type": "onramp.purchase.completed",
"data": {
"session_id": "ses_9n3f7h2u4b",
"reference_id": "your_reference_123",
"user_id": "usr_8h3d6f9k2m",
"email": "user@example.com",
"transaction": {
"id": "txn_7g2d5c8j1n",
"amount": 50.00,
"currency": "USD",
"crypto_amount": 0.00052,
"crypto_currency": "BTC",
"exchange_rate": 96153.85,
"fees": {
"platform_fee": 2.50,
"network_fee": 0.50,
"total": 3.00
},
"delivery": {
"method": "lightning",
"address": "user@zbd.gg",
"transaction_id": "lntx_8j3k5m7p9q",
"delivered_at": "2025-06-09T10:29:55Z"
},
"payment_method": "ach_debit",
"status": "completed",
"created_at": "2025-06-09T10:28:00Z",
"completed_at": "2025-06-09T10:29:55Z"
},
"metadata": {
"custom_field": "value"
}
}
}
```
#### `onramp.purchase.failed`
Fired when a purchase fails at any stage.
```json
{
"type": "onramp.purchase.failed",
"data": {
"session_id": "ses_9n3f7h2u4b",
"reference_id": "your_reference_123",
"user_id": "usr_8h3d6f9k2m",
"reason": "payment_declined",
"error_message": "Insufficient funds in bank account",
"failed_at": "2025-06-09T10:29:00Z",
"metadata": {
"custom_field": "value"
}
}
}
```
### Webhook Security
All webhooks include a signature header for verification:
```
X-ZBD-Signature: sha256=7d38cdd689735b008b3c702edd92eea23791c5f6
```
Verify webhooks using HMAC-SHA256:
```javascript
const crypto = require('crypto');
function verifyWebhook(payload, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
const provided = signature.replace('sha256=', '');
return crypto.timingSafeEqual(
Buffer.from(expected),
Buffer.from(provided)
);
}
```
### Webhook Retry Policy
Failed webhook deliveries are retried with exponential backoff:
* Attempt 1: Immediate
* Attempt 2: 5 seconds
* Attempt 3: 30 seconds
* Attempt 4: 2 minutes
* Attempt 5: 10 minutes
* Attempt 6: 1 hour
Webhooks are considered failed if:
* Response status is not 2xx
* No response within 5 seconds
* Connection error
## Error Codes
### HTTP Status Codes
| Code | Description |
| ---- | ---------------------------------- |
| 200 | Success |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid API key |
| 403 | Forbidden - Access denied |
| 404 | Not Found - Resource doesn't exist |
| 429 | Too Many Requests - Rate limited |
| 500 | Internal Server Error |
### Application Error Codes
| Code | Description | Resolution |
| ---------------------------- | ------------------------------------- | ------------------------------------- |
| `INVALID_EMAIL` | Email format is invalid | Provide valid email address |
| `INVALID_CURRENCY` | Currency code not supported | Use USD for fiat, BTC/USDC for crypto |
| `SESSION_EXPIRED` | Widget session has expired | Create a new session |
| `USER_BLOCKED` | User failed fraud checks | Contact support |
| `KYC_REQUIRED` | User needs to complete KYC | User will be guided through KYC flow |
| `PURCHASE_LIMIT_EXCEEDED` | Amount exceeds limits | Reduce purchase amount |
| `PAYMENT_METHOD_UNAVAILABLE` | Selected payment method not available | Try different payment method |
## Rate Limits
API endpoints are rate limited to ensure platform stability:
| Endpoint | Limit | Window |
| --------------------------- | ------------- | -------- |
| `/api/v1/ramp-widget` | 100 requests | 1 minute |
| All endpoints (per API key) | 1000 requests | 1 hour |
Rate limit headers are included in responses:
```
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1623456789
```
## Testing
Sandbox environment is coming soon. Currently, all integrations use production mode. Test with small amounts during development.
## Support
Get help with your integration from our technical team
Check current API status and subscribe to updates
***
This API is in active development. Subscribe to our [changelog](https://docs.zbdpay.com/changelog) for updates.
# Appearance
Source: https://docs.zbdpay.com/payments/onramp/appearance
Customize the appearance of ZBD Onramp.
Section coming soon.
# Architecture
Source: https://docs.zbdpay.com/payments/onramp/architecture
Onboard into Bitcoin or USDC with ZBD Onramp.
Section coming soon.
# Branding
Source: https://docs.zbdpay.com/payments/onramp/branding
Customize the branding of ZBD Onramp.
Section coming soon.
# FAQ
Source: https://docs.zbdpay.com/payments/onramp/faq
Onboard into Bitcoin or USDC with ZBD Onramp.
Section coming soon.
# Integration Guide
Source: https://docs.zbdpay.com/payments/onramp/quickstart
Complete guide to integrating ZBD Onramp into your application
This guide covers the technical details of integrating ZBD Onramp, including session management, widget parameters, and webhook handling.
## Integration Flow
Call the `/api/v1/ramp-widget` endpoint from your backend
Embed the returned widget URL in an iframe
Process webhooks and frontend messages
## Session Initialization
Create a widget session by calling our API from your backend. This ensures your API key remains secure.
### Endpoint
```
POST https://api.zebedee.io/api/v1/ramp-widget
```
### Request
```bash
curl -X POST https://api.zebedee.io/api/v1/ramp-widget \
-H "Content-Type: application/json" \
-H "apikey: YOUR_API_KEY" \
-d '{
"email": "player@game.com",
"webhook_url": "https://yourgame.com/webhooks/zbd",
"quote_currency": "USD",
"base_currency": "BTC",
"destination": "https://yourgame.com/purchase-complete",
"reference_id": "player_123_purchase_456",
"metadata": {
"player_id": "123",
"game_session": "abc"
}
}'
```
```javascript
const response = await fetch('https://api.zebedee.io/api/v1/ramp-widget', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': process.env.ZBD_API_KEY
},
body: JSON.stringify({
email: user.email,
webhook_url: 'https://yourgame.com/webhooks/zbd',
quote_currency: 'USD',
base_currency: 'BTC',
destination: 'https://yourgame.com/purchase-complete',
reference_id: `${user.id}_${purchaseId}`,
metadata: {
player_id: user.id,
game_session: sessionId
}
})
});
const data = await response.json();
```
### Parameters
| Parameter | Type | Required | Description |
| ---------------- | ------ | -------- | ---------------------------------- |
| `email` | string | Yes | User's email address |
| `webhook_url` | string | Yes | URL to receive webhook events |
| `quote_currency` | string | No | Fiat currency (default: "USD") |
| `base_currency` | string | No | Crypto currency: "BTC" or "USDC" |
| `destination` | string | No | URL to redirect after completion |
| `reference_id` | string | No | Your internal reference ID |
| `metadata` | object | No | Custom data (returned in webhooks) |
| `access_token` | string | No | Existing user session token |
### Response
```json
{
"success": true,
"data": {
"session_token": "eyJraWQiOiJzLWE1OWNk...",
"widget_url": "https://ramp.zbdpay.com/?session=eyJraWQiOiJzLWE1OWNk...",
"expires_at": "2025-06-09T12:00:00Z"
}
}
```
Widget sessions expire after 15 minutes. Create a new session if the user needs more time.
## Widget Embedding
Once you have the widget URL, embed it in your application using an iframe.
### Basic Implementation
```html
```
### Frontend Events
The widget communicates via `postMessage`. Listen for these events:
```javascript
window.addEventListener('message', (event) => {
// Verify origin
if (event.origin !== 'https://onramp.zbd.gg') return;
switch (event.data.type) {
case 'zbd.onramp.ready':
console.log('Widget loaded successfully');
break;
case 'zbd.onramp.close':
// User clicked close button
hideWidget();
break;
case 'zbd.onramp.success':
// Purchase completed
console.log('Transaction ID:', event.data.transactionId);
showSuccessMessage();
break;
case 'zbd.onramp.error':
// Handle errors
console.error('Widget error:', event.data.message);
break;
case 'zbd.onramp.resize':
// Widget requests size change
adjustIframeHeight(event.data.height);
break;
}
});
```
## Security Best Practices
* Never expose API keys in frontend code
* Use environment variables
* Rotate keys regularly
* Restrict key permissions
* Always verify signatures
* Use HTTPS endpoints only
* Implement idempotency
* Log all events
## Next Steps
Learn how to customize the widget appearance
**Contact Support** - Our team is here to help with your integration. Schedule a technical support session.
# Email Receipts
Source: https://docs.zbdpay.com/payments/onramp/receipts
Customize the email receipts of ZBD Onramp.
Section coming soon.
# User Flow
Source: https://docs.zbdpay.com/payments/onramp/user-flow
Onboard into Bitcoin or USDC with ZBD Onramp.
Section coming soon.
# Webhook Events
Source: https://docs.zbdpay.com/payments/onramp/webhooks
List of webhook events for ZBD Onramp.
Section coming soon.
# Request Charge for ZBD Gamertag
Source: https://docs.zbdpay.com/payments/payins/gamertags
Learn how to generate payment requests specifically for ZBD users.
## ZBD Gamertag Charge API
While you can use the [Send Bitcoin to ZBD Gamertag](/payments/api/gamertags/send) endpoint to make a direct payment to a ZBD user, if you want to create a regular Lightning Network payment request / Charge QR code for that given user, you can do so using the [Create Charge for ZBD Gamertag](/payments/api/gamertags/create-charge) endpoint.
In order to request Charges from a ZBD Gamertag you just need to make a simple API call with a payload like the example below.
```bash
curl --location --request POST 'https://api.zebedee.io/v0/gamertag/charges' \
--header 'Content-Type: application/json' \
--header 'apikey: API_KEY_HERE' \
--data-raw '{
"gamertag": "andre",
"amount": "15000",
"internalId": "12347ahk1n",
"description": "ZBD so fast!",
"callbackUrl": "https://your-app.com/zbd-callback"
}'
```
In order to receive updates about the status of this request, make sure to include a `callbackUrl` in the `data` portion of the request.
The response payload will include a **`invoiceRequest`** which is the contents of the payment request QR code.
```json
{
"success": true,
"data": {
"status": "CHARGE_PENDING",
"amount": "15000",
"internalId": "12347ahk1n",
"description": "ZBD so fast!",
"invoiceRequest": "lnbc100n1pskq45xpp5q5rtpfzydndqk4fu2y4h64fdc284y6av0fn8gz4dmkq89xuxd28sdpvw3jhxarfdenjqctxw3jhygrjv4kk7anfdenjqmnpd4jscqzpgxqzjcsp59g6vgrss790zkwjqc3adndzt5tcq2ltaxynfstggjl6rre3kk6js9qyyssqfyan62pzsjsm62l6zq57jv9pmlpmycvqu649ccfjn7mar77awgykz2gft3fcgl9x5m4mz78nyng920uf6zwft5qnt2qjtqgpl7c72dgq4z7mgv",
"invoiceExpiresAt": "2021-10-08T14:42:38.759Z",
"unit": "msats",
"createdAt": "2022-02-08T14:32:38.793Z"
},
"message": "Successfully created charge request for gamertag"
}
```
Charges / Payment Requests have defined expiration times. After a Charge expires it cannot be paid, but you can simply create another one.
Once a payment is made and the Charge settles, the ZBD User will receive a Push Notification alerting them they've been sent some Bitcoin.
## Multiplayer Commerce through ZBD Gamertag Charges
For App or Game Developers that wish to provide a more robust commerce experience for their users and gamers, requesting an invoice from ZBD Gamertags can be one of the ways.
**Think of yourself, the Developer, as the Orchestrator of payments.**
By leveraging Lightning Network invoices tied to specific ZBD Gamertag, you can ensure that the payment is made to the correct user, and that the payment has truly settled.
### 1. Two-Step Payment Orchestration
Let's say **Alice** wants to buy a sword from **Bob** inside of the game. Well that's easy, and there's two ways:
### 2. ZBD Gamertag Charges
You can use the above endpoint to create a Charge from **Bob**'s ZBD Gamertag, and display it for **Alice** to pay. Pass a `callbackUrl` on the ZBD API request and when the payment settles, you will be alerted of it and can then transfer the sword asset inside the game.
**Yes, it's really that simple!**
### 3. Project Wallet as Escrow
Alternatively you could rely on the Project's own Wallet as a form of escrow. You can create a Charge using the `/charges` endpoint passing a `callbackUrl` to receive settlement updates, and have **Alice** pay it.
Alice will effectively be paying the Project Wallet in this scenario.
Once payment is settled, you can use the [Send Bitcoin to ZBD Gamertag](/payments/api/gamertags/send) endpoint and send the same amount to **Bob**. When this second payment settles you can then transfer the sword asset inside the game.
While this technically involves two transactions, it provides a bit more control to the Developer that wishes to manage the transfer of assets/in-game items a bit more closely and with more checks and balances in place. Both approaches are recommended.
# Receiving Lightning Payments
Source: https://docs.zbdpay.com/payments/payins/lightning-charges
Learn how to receive Lightning payments using the ZBD API.
## Charge API
In order to receive Bitcoin through the Lightning Network using the ZBD API, you must first create a **Charge**.
A Charge accepts the following attributes:
| Property | Description |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `amount` | The Charge amount (in millisatoshis --> 1 satoshi = 1,000 millisatoshi). |
| `description` | The Charge note or comment. |
| `internalId` | An optional free-use attribute. Usually used by setting the Player/User ID of your Game/Application in order to link specific Charges to specific Players. |
| `callbackUrl` | The URL ZBD API will make a POST HTTP request to with information about the Charges's status updates. See [Callbacks](/payments/api/callbacks) for more. |
| `expiresIn` | The desired expiration time for this Charge (in seconds). |
To create a Charge, use the [`/charges`](/payments/api/lightning-charges/create) API (or leverage one of our SDKs) by passing the correct attributes:
```js NodeJS
// Using ZBD's NodeJS SDK
import { zbd } from '@zbddev/payments-sdk';
// Instantiate ZBD client
const ZBD = new zbd(API_KEY_HERE);
// Set the payload
const payload = {
expiresIn: 300,
amount: '50000',
internalId: '118304b8',
description: 'My Charge Description',
callbackUrl: 'https://your-app.com/zbd-callback',
};
// Create Charge
try {
const response = await ZBD.createCharge(payload);
} catch(error) {
console.log({ error });
}
```
```bash cURL
curl --location --request POST 'https://api.zebedee.io/v0/charges' \
--header 'Content-Type: application/json' \
--header 'apikey: API_KEY_HERE' \
--data-raw '{
"expiresIn": 300,
"amount": "50000",
"internalId": "118304b8",
"description": "My Charge Description",
"callbackUrl": "https://your-app.com/zbd-callback"
}'
```
If the submitted request suceeds, you can expect a JSON API response that resembles the following:
```json
{
"message": "Successfully created Charge.",
"data": {
"id": "c121356b-9671-4fbd-a751-987fb4b3d0b3",
"description": "My Charge Description",
"createdAt": "2022-12-23T03:58:17.993Z",
"callbackUrl": "https://your-app.com/zbd-callback",
"internalId": "118304b8",
"amount": "50000",
"status": "pending",
"invoice": {
"expiresAt": "2019-12-23T04:08:18.038Z",
"request": "lnbc20n1p0qqw66pp5lhjn2sshvh03h2lsxyzg5eyfwt0760207q3hake25fs7l3psegtqdpgg3jhxcmjd9c8g6t0dcsx7e3qw35x2gzrdpshyem9cqzpgxqzjcfppjramjf8sxnvy3k8dq84kv56dy5gq9mlqs9qy9qsqsp5jvf69w282jdxkyt824dn0crxdentx8nvncfdt0ulqp75lvkjpagqqwpgcttpmfzaxc3akfn85jlu8cmtv5l2hu8q3yqttru8vlryg3vnewssy8w00yyfsghzqj03j45kj3uhhjek6q6e8djfu5u4gna6wjcqdsdhwe"
}
}
}
```
## Receiving Funds
Now that you have created a Charge, you can allow anyone to pay this Payment Request in the Bitcoin Lightning Network. Depending on your use-case you may choose to display the `invoice.request` property as a QR Code that others can scan with their mobile apps, or you can put it under a button click.
**Any Bitcoin Lightning-capable wallets can read, decode, and effect payments against these Charges.**
## Charge Updates
All Charges will either **complete** or **expire**. If no payment is effected until the Charge's expiration time, the Charge (and underlying Bitcoin Lightning Network Invoice) will expire and will therefore no longer be payable. To know the status of your specific Charge, check the `status` attribute returned from the `/charges/create` or `/charges/get` API calls.
```json
{
...
"status": "pending" // pending | completed | expired | error
...
}
```
To subscribe to updates on any given Charge object, the recommended approach is to provide a `callbackUrl` property when creating that Charge. Whenever there are updates to the Charge (a payment was made, or Charge expires) the ZBD API will make a POST request to the URL provided in `callbackUrl`, passing the Charge updates as data in the request.
# Send Bitcoin to Email
Source: https://docs.zbdpay.com/payments/payouts/email
Learn how to instantly send Bitcoin to any Email.
## Send Bitcoin to Email API
To send Bitcoin to a given email, all you need to do is call the [Pay to Email API](/payments/api/email/send) with a POST call providing the following properties:
| Property | Description |
| --------- | --------------------------------------------------------- |
| `email` | Recipient email to send payment to. |
| `amount` | Total amount of satoshis to send (in millisatoshis). |
| `comment` | comment to be sent with the payment (max 150 characters). |
Example: If you wish to reward 20 satoshis to a user for their completion of a challenge, and you have the user's email, you can use the information below to send it in 1 API call.
## Details
* If the email is associated with an existing ZBD App account, then that user account will be credited the sats.
* Otherwise, the sats will be issued to the email in the form of a valid [ZBD Voucher](/get-started/vouchers) that the recipient can redeem in the [ZBD Mobile App](/rewards/app).
## API Response
Response payloads will look like this:
```
{
"success": true,
"data": {
"amount": "1000",
"code": "CB6A2DC5",
"createdAt": "2023-08-29T22:07:25.736Z",
"createTransactionId": "a3742c93-be3b-49aa-9414-79deb04137b9",
"description": "Sending to an email!",
"fee": "1000",
"id": "bdd0ee12-5231-4759-88aa-bb3634ed99e4",
"unit": "msats",
"walletId": "0701cf1b-059b-4b88-854e-3362d9b96aab"
},
"message": "Voucher was sent to email address."
}
```
Wow that's easy. Welcome to email payments!
There are no Lightning Network Fees for this endpoint.
# Send Bitcoin to ZBD Gamertag
Source: https://docs.zbdpay.com/payments/payouts/gamertags
Learn how to instantly send Bitcoin to a ZBD user.
## Introduction
The ZBD API allows for developers to create Charges, perform Payments, and process Withdrawal Requests for any user, wallet, or service that understands / speaks the Lightning Network protocol. These capabilities are possible because of the underlying `Lightning Charges / Payment Requests / Invoices`, the single-use payable QR codes the platform can create and handle.
While this Payment Request provides a truly interoperable experience for ZBD-powered apps, games, and services to interact with any type of Bitcoin Lightning wallet a user may use, it can at times provide for a much poorer user experience (UX). This is the case because it involves a switch of context, going in-and-out of the app / game and wallet applications to perform a simple payment or withdrawal. This is especially true for mobile devices (which comprises over 2/3 of the entire gaming market for example).
## Enter the ZBD Gamertag
**Every ZBD user has a ZBD Gamertag.** A ZBD Gamertag is a user's unique identifier that allows a developer to directly interact with the given user. This means you can directly send payments to users / gamers.
### Send Bitcoin to ZBD Gamertags
In order to send payments directly to a ZBD user you just need to make a simple API call with a payload similar to the example below.
```js NodeJS
// Using ZBD's NodeJS SDK
import { zbd } from '@zbddev/payments-sdk';
// Instantiate ZBD client
const ZBD = new zbd(API_KEY_HERE);
// Set the payload
const payload = {
amount: '50000',
gamertag: 'andre',
description: 'ZBD so fast!',
};
// Send Payment
try {
const response = await ZBD.sendGamertagPayment(payload);
} catch(error) {
console.log({ error });
}
```
```bash cURL
curl --location --request POST 'https://api.zebedee.io/v0/gamertag/send-payment' \
--header 'Content-Type: application/json' \
--header 'apikey: API_KEY_HERE' \
--data-raw '{
"gamertag": "andre",
"amount": "50000",
"description": "ZBD so fast!",
}'
```
If the ZBD Gamertag exists and is active, the ZBD API will perform the transaction and will return a 200 status code and a JSON response with the following:
```json
{
"success": true,
"data": {
"status": "settled",
"settledAt": "2021-10-08T14:21:55.378Z",
"amount": "5000",
"receiverId": "3dde8e48-7c13-4db7-a0e5-caf2a48c002a",
"comment": "So fast!"
},
"message": "Payment done."
}
```
At this stage the user will receive a Push Notification alerting them they've been sent some Bitcoin.
## In-Game Bitcoin Rewards through ZBD Gamertag
One of the many benefits of the ZBD API is that it is flexible enough to allow for developers to create simple in-game / in-app reward systems for their users. This is shown to increase user retention and improve general KPIs around ROAS and CPI. This is done by asking the user to enter their ZBD Gamertag in the game, and whenever the user completes a level, or triggers an event (depends entirely on the game or app and the developer's needs), some Bitcoin is immediately streamed to the user's ZBD App.
# Send Bitcoin to Lightning Address
Source: https://docs.zbdpay.com/payments/payouts/lightning-address
Learn how to instantly send Bitcoin to any Lightning Address.
## Lightning Address API
To send Bitcoin to a given Lightning Address, all you need to do is call the [Send Lightning Address Payment API](/payments/api/lightning-address/send) with a POST call providing the following properties:
| Property | Description |
| ----------- | --------------------------------------------------------- |
| `lnAddress` | Recipient Lightning Address to send payment to. |
| `amount` | Total amount of satoshis to send (in millisatoshis). |
| `comment` | comment to be sent with the payment (max 150 characters). |
Example: If you wish to reward 20 satoshis to a user for their completion of a challenge, and you have the user's Lightning Address, you can use the information below to send it in 1 API call.
## Sending Transaction
```js NodeJS
// Using ZBD's NodeJS SDK
import { zbd } from '@zbddev/payments-sdk';
// Instantiate ZBD client
const ZBD = new zbd(API_KEY_HERE);
// Set the payload
const payload = {
amount: "20000",
lnAddress: "andre@zbd.gg",
comment: "Sending to a Lightning Address"
};
// Send Lightning Address payment
try {
const response = await ZBD.sendLightningAddressPayment(payload);
} catch(error) {
console.log({ error });
}
```
```bash cURL
curl --location --request POST 'https://api.zebedee.io/v0/ln-address/send-payment' \
--header 'Content-Type: application/json' \
--header 'apikey: API_KEY_HERE' \
--data-raw '{
"amount": "20000",
"lnAddress": "andre@zbd.gg",
"comment": "Sending to a Lightning Address"
}'
```
## API Response
Response payloads will usually look similar to this:
```json
{
"success": true,
"data": {
"id": "795de178-573f-47dd-9535-a710cd9daf56",
"fee": "2000",
"unit": "msats",
"amount": "20000",
"preimage": "e2fb59fe93a2c63082be50f58f4f3e92841d436339fab93fdd67b1280650cf47",
"status": "completed",
"invoice": "lnbc200n1p3277jtpp5594ju6twysvqkqtus4l0pnawuum4w8l9x3ktz234pp93nfsdc5fshp574njlu3jdr3y2k3g4g9xcp323kgwh7n4v7n4yraakvwh7xmeyugqcqzpgxqyz5vqsp55ju2g2j06u8ua59kj80wqrpgsnkjclzdv28d0msgah90fcx9t9ds9qyyssqphhva4akne5hr0f6t3gmmdpllu00zxgvu70s0kp5g8wmg5vv26qygsearsyrcm4xjecttazfy3ul9lmcvas9ha24n9jtpc3ca9g2mqsppxzvdl",
"walletId": "73c1db10-d1f7-499f-bbbe-eea2f73bb27c",
"transactionId": "9ab28811-97d3-40d0-b603-50cfa00bba2d",
"createdAt": "2022-06-19T19:34:35.955Z",
"processedAt": "2022-06-19T19:34:36.936Z"
},
"message": "Payment done."
}
```
Wow that's easy. Welcome to instantaneous payments!
Fees are added post-send given that the routing fees for the Lightning Network are variable.(e.g if you send a 10,000 satoshi transaction to a Lightning Address and the fee ends up being 10 satoshis, the total paid by the API wallet is 10,010 satoshis).
# Pay Lightning Network Charges
Source: https://docs.zbdpay.com/payments/payouts/lightning-charges
Learn how to pay Lightning Network Charges using ZBD.
## Payment API
In order to make a payment against a Lightning Network Payment Request (a.k.a Lightning Invoices, or Charges), you simply have to use the [Send Payment API](/payments/api/lightning-payments/send) endpoint. A Payment accepts the following attributes:
| Property | Status | Description |
| ------------- | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `invoice` | *String* | The Lightning payment request, or invoice, that is meant to be paid. |
| `description` | *String* | The Payment description (only used for internal record-keeping). |
| `internalId` | *String* | An optional free-use attribute. Usually used by setting the Player/User ID of your Game/Application in order to link specific Payments to specific users. |
| `callbackUrl` | *String* | The URL ZBD services will make a POST HTTP request to with information about the Payment's status updates. See [Callbacks](/payments/api/callbacks) for more. |
To perform the Payment, use the API (or leverage one of our SDKs) by passing the correct attributes:
```js NodeJS
// Using ZBD's NodeJS SDK
import { zbd } from '@zbddev/payments-sdk';
// Instantiate the client
const ZBD = new zbd('API_KEY_HERE');
// Set the payload
const payload = {
description: 'My Payment Description',
callbackUrl: 'https://your-app.com/zbd-callback',
internalId: '11af01d09a6b8304b8',
invoice: 'lnbc450n1p0yeytspp55yrs0j42wnkw0qutr8e0tgsf2yplxs9986t5gqmfpn7mfd0ckc8sdzq2pshjmt9de6zqen0wgsrgdfqwp5hsetvwvsxzapqwdshgmmndp5hxtnsd3skxefwxqzjccqp2sp5pyccqt6apxelz62d2ndrt0ssahndpcua4wklea80glaczx80t3wqrzjqfn4cln8jwe4dh4dmscddrmd6sdw6hzkn702l6ghwvr8lhad0ez5vzt8vyqqf2sqqqqqqqlgqqqqqqgq9q9qy9qsqqeft09gryr80aaghm7rmh7eeqfl7hxlcynp99730yk7qh534d9nyfwp0nc628rp8hpgp23fxzj5l2aet4y6sc4t79uj3wyjxffejmvgqrmxkvr',
};
// Make Payment
try {
const response = await ZBD.sendPayment(payload);
} catch(error) {
console.log({ error });
}
```
```bash cURL
curl --location --request POST 'https://api.zebedee.io/v0/payments' \
--header 'Content-Type: application/json' \
--header 'apikey: API_KEY' \
--data-raw '{
"invoice": "lnbc450n1p0yeytspp55yrs0j42wnkw0qutr8e0tgsf2yplxs9986t5gqmfpn7mfd0ckc8sdzq2pshjmt9de6zqen0wgsrgdfqwp5hsetvwvsxzapqwdshgmmndp5hxtnsd3skxefwxqzjccqp2sp5pyccqt6apxelz62d2ndrt0ssahndpcua4wklea80glaczx80t3wqrzjqfn4cln8jwe4dh4dmscddrmd6sdw6hzkn702l6ghwvr8lhad0ez5vzt8vyqqf2sqqqqqqqlgqqqqqqgq9q9qy9qsqqeft09gryr80aaghm7rmh7eeqfl7hxlcynp99730yk7qh534d9nyfwp0nc628rp8hpgp23fxzj5l2aet4y6sc4t79uj3wyjxffejmvgqrmxkvr",
"description": "My Payment Description",
"callbackUrl": "https://myapp.com/zbd-callback",
"internalId": "11af01d0cb33faa6b8304b8"
}'
```
If the submitted request suceeds, you can expect a JSON API response that resembles the following:
```json
{
"message": "Successfully made Payment.",
"data": {
"id": "31d60de1-efe0-4e55-9942-910934efe7a3",
"fee": "1000",
"unit": "msats",
"amount": "10000",
"status": "completed",
"description": "My Payment Description",
"processedAt": "2020-01-01T19:34:42.794Z",
"invoice": "lnbc450n1p0yeytspp55yrs0j42wnkw0qutr8e0tgsf2yplxs9986t5gqmfpn7mfd0ckc8sdzq2pshjmt9de6zqen0wgsrgdfqwp5hsetvwvsxzapqwdshgmmndp5hxtnsd3skxefwxqzjccqp2sp5pyccqt6apxelz62d2ndrt0ssahndpcua4wklea80glaczx80t3wqrzjqfn4cln8jwe4dh4dmscddrmd6sdw6hzkn702l6ghwvr8lhad0ez5vzt8vyqqf2sqqqqqqqlgqqqqqqgq9q9qy9qsqqeft09gryr80aaghm7rmh7eeqfl7hxlcynp99730yk7qh534d9nyfwp0nc628rp8hpgp23fxzj5l2aet4y6sc4t79uj3wyjxffejmvgqrmxkvr"
}
}
```
## Payment Updates
There are cases where Lightning Payments can `get stuck` in transit (e.g. a network node on the path to the payment's destination suddenly goes offline). ZBD aims to provide cutting edge Lightning Network infrastructure with high availability and liquidity. That said, due to the possibility of running into stuck payment cases, the recommended method of getting Payment updates is through the `callbackUrl` attribute. By providing a `callbackUrl` when making the Payment, the [ZBD API](/payments/api) is able to make a POST request to that URL and pass along Payment updates as they happen.
# Using Withdrawal QR Codes
Source: https://docs.zbdpay.com/payments/payouts/withdrawal-requests
Understanding the Lightning Charge Workflow Problem
## Introduction
The Lightning Network is a push-based system: in order to receive payments, the payee must first create a Charge / Payment Request, which the payer can pay. This is a great workflow when users are making payments for goods and services. Usually this workflow is as follows:
User performs action that requires a Payment.
A Lightning Charge is created for the specified amount and displayed as QR.
User uses a Lightning Wallet (usually mobile app) to scan QR and decode payment.
User reviews and confirms request details and accepts the Payment.
You receive the Payment and unlock content/action for the user.
This is a great user experience between User and a Project (e.g. game or application). However, this user workflow is limited to **User paying Project**.
To perform the reverse (Project paying User), as with all Lightning payments, the Project must first ask for a Lightning Network Charge/Invoice from the User, for a specific amount. This provides for subpar UX because the User is now an active participant when receiving funds.
## Withdrawal Request API
Withdrawal Requests are the exact opposite of a Charge. Whereas a Charge is a payment from a User to a Project, a Withdrawal Request can be understood as a payment from a Project to a User. In other words, a Charge is a QR code that accepts a Bitcoin payment while **a Withdrawal Request is a QR code that allows a User to claim Bitcoin**.
ZBD's Withdrawal Request capability is based on the [LNURL open-source specification](https://github.com/fiatjaf/lnurl-rfc), which provides a standard for easier communication between Wallets (users) and Projects, through the use of HTTP requests. A developer building upon ZBD's Withdrawal Requests functionality does not need to understand the underlying methodology and workflow of LNURL - the [ZBD API](/payments/api) abstracts away any complexities. Let's see how to do it.
If you've been able to create a ZBD Charge, then you will be able to create a ZBD Withdrawal Request easily.
### Creating a Withdrawal Request
When creating a Withdrawal Request code to allow Lightning Wallets to withdraw funds from the Project (game or application) you must provide the following attributes to the [`/withdrawal-requests`](/payments/api/withdrawal-requests/create) endpoint:
| Property | Status | Description |
| ------------- | :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `amount` | *String* | The Withdrawal Request amount (in millisatoshis). |
| `description` | *String* | The Withdrawal Request description. |
| `internalId` | *String* | An optional free-use attribute. Usually used by setting the Player/User ID of your Game/Application in order to link specific Withdrawal Requests to specific Players. |
| `callbackUrl` | *String* | The URL ZBD services will make a POST HTTP request to with information about the Withdrawal Requests's status updates. See [Callbacks](/payments/api/callbacks) for more. |
| `expiresIn` | *Number* | The desired expiration time for this Withdrawal Request (in seconds). |
To create the Withdrawal Request, use the ZBD API (or leverage one of our SDKs) by passing the correct attributes:
```js NodeJS
// Using ZBD's NodeJS SDK
import { zbd } from '@zbddev/payments-sdk';
// Instantiate the client
const ZBD = new zbd('API_KEY_HERE');
// Set the payload
const payload = {
expiresIn: 300,
amount: '50000',
internalId: '11af01d0924aa6b8304b8',
description: 'My Custom Withdrawal Request',
callbackUrl: 'https://yourapp.com/zbd-callback',
};
// Create Withdrawal Request
try {
const response = await ZBD.createWithdrawalRequest(payload);
} catch(error) {
console.log({ error });
}
```
```bash cURL
curl --location --request POST 'https://api.zebedee.io/v0/withdrawal-requests' \
--header 'Content-Type: application/json' \
--header 'apikey: API_KEY' \
--data-raw '{
"expiresIn": 300,
"amount": "50000",
"internalId": "11af01d0926b8304b8",
"description": "My Custom Withdrawal Description",
"callbackUrl": "http://your-website.com/zbd-callback"
}'
```
If the submitted request suceeds, you can expect a JSON API response that resembles the following:
```json
{
"message": "Successfully created Withdrawal Request.",
"data": {
"id": "c121356b-9671-4fbd-a751-987fb4b3d0b3",
"unit": "msats",
"amount": "50000",
"status": "pending",
"description": "Description of the Withdrawal Request",
"createdAt": "2019-12-23T03:58:17.993Z",
"callbackUrl": "http://your-website.com/zbd-callback",
"internalId": "11af01d092444a317cb33faa6b8304b8",
"invoice": {
"expiresAt": "2019-12-23T04:08:18.038Z",
"request": "lnurl1dp68gurn8ghj7cn9w3sj6ctsdyh85etzv4jx2efwd9hj7a3s9acxz7tvdaskgtthd96xserjv9mkzmpdwfjhzat9wd6r7um9vdex2apav3skxdfev93rwvm9x43nwcf5vvekgdmpxq6rgvrrxumnxdp3vserqe35v4jr2efs8y6k2epkxf3rxc35vg6nwdrpx9jrqv3kxfjxxwqxmuhcd"
}
}
}
```
### Displaying as QR Code
In order to display the Withdrawal Request as a QR code, simple use the `data.invoice.request` attribute returned from the API response and pass it to your QR code generator of choice. The QR code should look something like this:
## Request Updates
Note that the Withdrawal Request is created in a `pending` state as it still hasn't *been claimed*. All Withdrawal Requests will either **complete** or **expire**. If no User is able to Withdraw the funds on time before the Withdrawal Request's expiration time, the Request will expire and will therefore no longer be valid. To know the status of your specific Withdrawal Request, check the `status` attribute returned from the `CreateWithdrawalRequest` or `GetWithdrawalRequestDetails` API calls.
```json
{
...
"status": "expired" // pending | completed | expired | error
...
}
```
To subscribe to updates on a specific Withdrawal Request, the recommended approach is to provide a `callbackUrl` property when creating that Withdrawal Request. Whenever there are updates to the Withdrawal Request (a payment was made, or it has expired) the [ZBD API](/payments/api) will make a POST request to the URL provided in `callbackUrl`, passing the Withdrawal Request updates as data in the request.
# ZBD Payments SDK
Source: https://docs.zbdpay.com/payments/sdk
Use ZBD Payments in your preferred development environment.
## Official SDKs
The following SDKs are maintained by the ZBD Payments core team.
Easiest way to interact with the ZBD Payments APIs. Quickstart guides and source code for Next.js, Node.js, and Express applications. Includes templates for Vercel and Supabase.
## Community SDKs
Supported by the ZBD open source developer community.
Rust SDK for ZBD Payments APIs
Go SDK for ZBD Payments APIs
C# SDK for ZBD Payments APIs
# C# SDK
Source: https://docs.zbdpay.com/payments/sdk/csharp
Learn how to send and receive instant Bitcoin payments with C# and ZBD.
## Prerequisites
To complete this guide, you will need the following:
* [ZBD Project with a Live API key](/get-started/api-keys)
* [Visual Studio](https://visualstudio.microsoft.com/downloads/)
## 1. Create project
Create a new project or open an existing project in Visual Studio.
## 2. Install the ZBD NuGet package
NuGet package name: `dev.zbd.csharp`
```bash Package Manager
NuGet\Install-Package dev.zbd.csharp
```
```bash .NET CLI
dotnet add package dev.zbd.csharp
```
```xml Package Reference
```
## 3. Send and receive Bitcoin
The below code is an example of how you can create a charge.
```csharp
using ZebedeeAPI;
var handler = new ZebedeeHandler("");
var charge =
await handler.CreateCharge(
expiresIn: "10000",
amount: "100000",
description: "A Charge Created with ZBD!"
);
Console.WriteLine(charge.data.invoice.request);
```
You're looking for the `data.invoice.request` property in the JSON response. It starts with `lnbc1` and is the payment request anyone in the Bitcoin Lightning Network can use to pay you.
```
lnbc1u1pjdlax9pp5t7jhkd7h2wntd4f2v7xp22dknmjxp0q8nm7hfcny4p7a5mr7x3rsdp9f4hkueteypshggrfde6x2unwv46zqumsv4jkgcqzzsxqzjcsp5dsayu6m6632p28rnkeeqsr7d54amrkv6wh46yrv42gdgca8xl8gs9qyyssqgj2zrkax733rzulfkzc5mqsr8fpwrva82stpa7e0frw32722trv37jlq8mvlqfp8y75lr6mz63zd7qnxar8hhsehuy22pvfq6wjxwqqqa60lx3
```
Charges and payment requests are usually shown to users as QR codes that can be scanned by mobile apps (e.g. [ZBD](https://zbd.one/download)). Read [Callbacks](/payments/api/callbacks) to understand how to receive updates about your payment asynchronously.
# Go SDK
Source: https://docs.zbdpay.com/payments/sdk/go
Learn how to use the Go SDK to send Bitcoin to any Email.
This guide is coming soon. Until then you can check the [Go SDK repository](https://github.com/zebedeeio/go-sdk).
# Rust SDK
Source: https://docs.zbdpay.com/payments/sdk/rust
Learn how to send and receive instant Bitcoin payments with Rust and ZBD.
## Prerequisites
To complete this guide, you will need the following:
* [ZBD Project with a Live API key](/get-started/api-keys)
* [Rust](https://www.rust-lang.org/tools/install) and [cargo](https://www.rust-lang.org/tools/install) installed
## 1. Create a Rust project
```bash
cargo new
cd
```
## 2. Install dependencies
Add both the `zebedee-rust` and `tokio` crates to your project:
```bash
cargo add zebedee-rust tokio
```
## 3. Update your Cargo.toml
Update your `Cargo.toml` file to use full features in tokio.
```yaml
[package]
name = "zbd-rust"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1.29.1", features = ['full']}
zebedee-rust = "0.4.4"
```
## 4. Create a Charge
Open your project's `main.rs` file and add the following code:
```rust
use std::env;
use zebedee_rust::{charges::*, ZebedeeClient};
#[tokio::main]
async fn main(){
let apikey: String = env::var("ZBD_API_KEY").unwrap();
let zbd_client = ZebedeeClient::new().apikey(apikey).build();
let charge = Charge{
amount: String::from("5000"),
..Default::default()
};
let charges_res = zbd_client.create_charge(&charge).await.unwrap();
println!("{:?}", charge_res);
}
```
Make sure to create an environment variable called **ZBD\_API\_KEY** in your Rust project. This is the API key you get from your ZBD Project.
Run the following command to create your charge:
```bash
cargo run
```
You can now create charges using the ZBD and Rust!
Charges and payment requests are usually shown to users as QR codes that can be scanned by mobile apps (e.g. [ZBD](https://zbd.one/download)). Read [Callbacks](/payments/api/callbacks) to understand how to receive updates about your payment asynchronously.
## 5. Try it yourself
You can now begin receiving instant Bitcoin payments with Rust + ZBD!
See the full source code.
# TypeScript SDK
Source: https://docs.zbdpay.com/payments/sdk/typescript
ZBD is your one-stop shop API for all things instant payments in TypeScript.
## Installation
```bash
pnpm install @zbddev/payments-sdk
```
## Quickstart
Use the following guides to get started with the TypeScript SDK for ZBD Payments:
} color="#3C873A" href="/payments/sdk/typescript/next">
Application codebase that allows you to quickly get started with ZBD and Next.js -- ZBD API Playground and a Starter Kit for ZBD-powered Next.js apps.
} href="/payments/sdk/typescript/vercel/send" />
} href="/payments/sdk/typescript/supabase/send" />
# Express
Source: https://docs.zbdpay.com/payments/sdk/typescript/express
Learn how to send and receive instant Bitcoin payments with Express and ZBD.
## Prerequisites
To complete this guide, you will need the following:
* [ZBD Project with a Live API key](/get-started/api-keys)
## 1. Create a Node.js project
Start with a brand new empty directory called `express-example` and run the following command to initiate a Node.js project:
```bash
npm init -y
```
## 2. Install Express.js
Inside your project directory, run the following command to install Express.js:
```bash yarn
yarn add express
```
```bash npm
npm install express
```
```bash pnpm
pnpm add express
```
## 3. Install @zbddev/payments-sdk Node.js SDK
Inside your Express.js
```bash yarn
yarn add @zbddev/payments-sdk
```
```bash npm
npm install @zbddev/payments-sdk
```
```bash pnpm
pnpm add @zbddev/payments-sdk
```
## 4. Send and receive Bitcoin
Create a new file called `index.js` and add the following code:
```js
import express from "express";
import ZbdPayments from '@zbddev/payments-sdk';
const ZBD_API_KEY = 'b7YW3s2JzZKGcXjIf5Dqof8wjKT2RuWr8'; // dummy key
const client = new ZbdPayments({
apikey: ZBD_API_KEY,
});
// Create Express app
const app = express();
// Creating a Bitcoin Lightning payment request
app.get("/request", async (req, res) => {
try {
const data = await client.lightningCharges.create({
amount: '100000',
callbackUrl: 'https://your-app.com/zbd-callback',
description: 'Express + ZBD!',
});
res.status(200).json({ data });
} catch (error) {
res.status(500).json({ error });
}
});
// Send a payment to a Bitcoin Lightning Address
app.get("/send", async (req, res) => {
try {
const data = await client.lightningAddress.sendPayment({
lnAddress: "andreneves@zbd.gg", // Who is the recipient?
amount: "100000", // 100 satoshis (100,000 msats)
comment: "Express + ZBD!",
});
res.status(200).json({ data });
} catch (error) {
res.status(500).json({ error });
}
});
app.listen(3000, () => {
console.log("Express server w/ ZBD listening on http://localhost:3000");
});
```
Run the following command to start your Express.js server:
```bash yarn
yarn start
```
```bash npm
npm start
```
Opening your browser to the following URL: `http://localhost:3000/request` should return a JSON response with a payment request.
You can also test this using curl command:
```bash
curl http://localhost:3000/request
```
You're looking for the `data.invoice.request` property in the JSON response. It starts with `lnbc1` and is the payment request anyone in the Bitcoin Lightning Network can use to pay you.
```
lnbc1u1pjdlax9pp5t7jhkd7h2wntd4f2v7xp22dknmjxp0q8nm7hfcny4p7a5mr7x3rsdp9f4hkueteypshggrfde6x2unwv46zqumsv4jkgcqzzsxqzjcsp5dsayu6m6632p28rnkeeqsr7d54amrkv6wh46yrv42gdgca8xl8gs9qyyssqgj2zrkax733rzulfkzc5mqsr8fpwrva82stpa7e0frw32722trv37jlq8mvlqfp8y75lr6mz63zd7qnxar8hhsehuy22pvfq6wjxwqqqa60lx3
```
Charges and payment requests are usually shown to users as QR codes that can be scanned by mobile apps (e.g. [ZBD](https://zbd.one/download)). Read [Callbacks](/payments/api/callbacks) to understand how to receive updates about your payment asynchronously.
Opening your browser to the following URL: `http://localhost:3000/send` should return a JSON response with the payment sent message.
You can also test this using curl command:
```bash
curl http://localhost:3000/send
```
You're looking for the `status` of `completed` to know that the payment settled successfully.
Payments in the Lightning Network are asynchronous so you may see a response stating the payment is `processing`. This is expected -- use the `callbackUrl` property to receive updates about your payments.
## 3. Try it yourself
You can now send and receive instant Bitcoin payments using Express.js + ZBD!
See the full source code.
# Next.js
Source: https://docs.zbdpay.com/payments/sdk/typescript/next
Learn how to use the ZBD with Next.js and our Playground Starter Kit.
## Playground Starter Kit
The ZBD + Next.js Playground Starter Kit is an application codebase that allows you to quickly get started with ZBD and Next.js. It includes two main sections: a ZBD API Playground and a Starter Kit for ZBD-powered Next.js applications.
Open the ZBD + Next.js Playground
View the source code.
} color="#000000" href="https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fzebedeeio%2Fnextjs-zebedee-starter&env=ZBD_API_KEY&envDescription=Your%20ZBD%20project%20API%20key&demo-title=ZBD%20%2B%20Next.js%20Starter&demo-description=Starter%20kit%20for%20using%20ZBD%20API%20with%20Next.js%20fullstack%20applications&demo-url=https%3A%2F%2Fnextjs-zebedee-starter.vercel.app%2F&demo-image=https%3A%2F%2Fi.imgur.com%2FNf8wRgv.png">
1-click deploy your own instance.
## Next.js
To use ZBD with Next.js and complete this guide, you will need the following:
* [ZBD Project with a Live API key](/get-started/api-keys)
### 1. Create a Next.js project
Start with a brand new Next.js project. To begin run the following command and walk through the initializing steps:
```bash
npx create-next-app@latest
```
### 2. Install @zbddev/payments-sdk Node.js SDK
Install ZBD:
```bash yarn
yarn add @zbddev/payments-sdk
```
```bash npm
npm install @zbddev/payments-sdk
```
```bash pnpm
pnpm add @zbddev/payments-sdk
```
### 3. Create Send and Receive API routes
Create a new file `/app/api/receive/route.ts` and add the following code to create an API route that will receive instant Bitcoin payments:
```js
import { NextResponse } from 'next/server';
import ZbdPayments from '@zbddev/payments-sdk';
const ZBD_API_KEY = 'b7YW3s2JzZKGcXjIf5Dqof8wjKT2RuWr8'; // dummy key
const client = new ZbdPayments({
apikey: ZBD_API_KEY,
});
export async function POST() {
try {
const data = await client.lightningCharges.create({
amount: '100000',
callbackUrl: 'https://your-app.com/zbd-callback',
description: 'Next.js + ZBD!',
});
return NextResponse.json(data);
} catch (error) {
return NextResponse.json({ error });
}
}
```
Then create a new file `/app/api/send/route.ts` and add the following code to create an API route that will send Bitcoin Lightning Address payments:
```js
import { NextResponse } from 'next/server';
import ZbdPayments from '@zbddev/payments-sdk';
const ZBD_API_KEY = 'b7YW3s2JzZKGcXjIf5Dqof8wjKT2RuWr8';
const client = new ZbdPayments({
apikey: ZBD_API_KEY,
});
export async function POST() {
try {
const data = await client.lightningAddress.sendPayment({
lnAddress: "andreneves@zbd.gg", // Who is the recipient?
amount: "100000", // 100 satoshis (100,000 msats)
comment: "Next.js + ZBD!",
});
return NextResponse.json(data);
} catch (error) {
return NextResponse.json({ error });
}
}
```
### 4. Run your Next.js server
Run the following command to start your Next.js server:
```bash yarn
yarn dev
```
```bash npm
npm run dev
```
Using an API tool like [Postman](https://postman.com), you should be able to make a POST call to this endpoint and receive a JSON response with a payment request:
```bash
http://localhost:3000/api/request
```
You're looking for the `data.invoice.request` property in the JSON response. It starts with `lnbc1` and is the payment request anyone in the Bitcoin Lightning Network can use to pay you.
```
lnbc1u1pjdlax9pp5t7jhkd7h2wntd4f2v7xp22dknmjxp0q8nm7hfcny4p7a5mr7x3rsdp9f4hkueteypshggrfde6x2unwv46zqumsv4jkgcqzzsxqzjcsp5dsayu6m6632p28rnkeeqsr7d54amrkv6wh46yrv42gdgca8xl8gs9qyyssqgj2zrkax733rzulfkzc5mqsr8fpwrva82stpa7e0frw32722trv37jlq8mvlqfp8y75lr6mz63zd7qnxar8hhsehuy22pvfq6wjxwqqqa60lx3
```
Charges and payment requests are usually shown to users as QR codes that can be scanned by mobile apps (e.g. [ZBD](https://zbd.one/download)). Read [Callbacks](/payments/api/callbacks) to understand how to receive updates about your payment asynchronously.
Using an API tool like [Postman](https://postman.com), you should be able to make a POST call to this endpoint and receive a JSON response with the payment success message:
```bash
http://localhost:3000/api/send
```
You're looking for the `status` of `completed` to know that the payment settled successfully.
Payments in the Lightning Network are asynchronous so you may see a response stating the payment is `processing`. This is expected -- use the `callbackUrl` property to receive updates about your payments.
### 5. Try it yourself
You can now send and receive instant Bitcoin payments using Next.js + ZBD!
See the full source code.
# Node.js
Source: https://docs.zbdpay.com/payments/sdk/typescript/node
Learn how to send and receive instant Bitcoin payments with Node.js and ZBD.
## Prerequisites
To complete this guide, you will need the following:
* [ZBD Project with a Live API key](/get-started/api-keys)
## 1. Create a Node.js project
Start with a brand new empty directory called `node-example` and run the following command to initiate a Node.js project:
```bash
npm init -y
```
## 2. Install @zbddev/payments-sdk Node.js SDK
Install ZBD:
```bash yarn
yarn add @zbddev/payments-sdk
```
```bash npm
npm install @zbddev/payments-sdk
```
```bash pnpm
pnpm add @zbddev/payments-sdk
```
## 3. Send and receive Bitcoin
Create a new file called `index.js` and add the following code:
```js
import ZbdPayments from '@zbddev/payments-sdk';
const ZBD_API_KEY = 'b7YW3s2JzZKGcXjIf5Dqof8wjKT2RuWr8'; // dummy key
const client = new ZbdPayments({
apikey: ZBD_API_KEY,
});
(async function () {
try {
const data = await client.lightningCharges.create({
amount: '100000',
callbackUrl: 'https://your-app.com/zbd-callback',
description: 'Node.js + ZBD!',
});
console.log(data);
} catch (error) {
console.error(error);
}
})();
```
Run the following command to start your Node.js server:
```bash yarn
yarn start
```
```bash npm
npm start
```
You may need to add a `start` script to your `package.json` file such as `node index.js`.
You're looking for the `data.invoice.request` property in the JSON response. It starts with `lnbc1` and is the payment request anyone in the Bitcoin Lightning Network can use to pay you.
```
lnbc1u1pjdlax9pp5t7jhkd7h2wntd4f2v7xp22dknmjxp0q8nm7hfcny4p7a5mr7x3rsdp9f4hkueteypshggrfde6x2unwv46zqumsv4jkgcqzzsxqzjcsp5dsayu6m6632p28rnkeeqsr7d54amrkv6wh46yrv42gdgca8xl8gs9qyyssqgj2zrkax733rzulfkzc5mqsr8fpwrva82stpa7e0frw32722trv37jlq8mvlqfp8y75lr6mz63zd7qnxar8hhsehuy22pvfq6wjxwqqqa60lx3
```
Charges and payment requests are usually shown to users as QR codes that can be scanned by mobile apps (e.g. [ZBD](https://zbd.one/download)). Read [Callbacks](/payments/api/callbacks) to understand how to receive updates about your payment asynchronously.
## 3. Try it yourself
You can now send and receive instant Bitcoin payments using Express.js + ZBD!
See the full source code.
# Receiving instant Bitcoin payments with Supabase
Source: https://docs.zbdpay.com/payments/sdk/typescript/supabase/receive
Learn how to receive Bitcoin using Supabase Edge Functions.
## Prerequisites
To complete this guide, you will need the following:
* [ZBD Project with a Live API key](/get-started/api-keys)
* [Supabase account](https://supabase.com/) + [Supabase CLI installed](https://supabase.com/docs/guides/cli#installation)
## 1. Create a Supabase Function
To create a Supabase Edge Function you must run the following command locally:
```bash
supabase functions new zbd-receive
```
This will create a `/supabase/functions/zbd-receive` folder structure in your project.
## 2. Write the Edge Function
Use the code below as a starting point for your handler function. You will need to replace the `ZBD_API_KEY` with your own ZBD Project's API key.
```typescript
import { serve } from "https://deno.land/std@0.168.0/http/server.ts"
const ZBD_API_KEY = "b7Ya3s2JZKZcXXX2Dqf8wjKTZZZRuWr8";
const zbdReceive = async (_request: Request): Promise => {
const res = await fetch("https://api.zebedee.io/v0/charges", {
method: "POST",
headers: {
"Content-Type": "application/json",
"apikey": `${ZBD_API_KEY}`,
},
body: JSON.stringify({
amount: '100000', // 100 satoshis (100,000 msats) -- ~$0.03
description: 'Money at internet speed', // What is this payment request for?
}),
});
const data = await res.json();
return new Response(JSON.stringify(data), {
status: 200,
headers: {
"Content-Type": "application/json",
},
});
};
serve(zbdReceive);
```
## 3. Receive payment locally
To run this Supabase Edge Function locally you can spin up your Supabase instance using the following command. *You may already have this running at this stage.*
```bash
supabase functions start
```
Then you can run the following command to start your serverless function:
```bash
supabase functions serve zbd-receive --no-verify-jwt
```
Note that we add the `--no-verify-jwt` flag to the command to disable JWT verification. This is because we are not passing a JWT token to the function when we call it. **This is not recommended for production use.**
Supabase CLI will output a HTTP URL endpoint that you can use to test your function by issuing a POST request to that resource.
## 4. Deploying to Supabase Edge
After testing it locally, you can deploy your function to Supabase Edge using the following command. *You will need to enter your Supabase project ID to deploy.*
```bash
supabase functions deploy zbd-receive
```
Once you deploy you will receive a URL that you can use to view that function in production on Supabase's Web Dashboard:
Opening your browser (or another HTTP client) to the URL provided by Supabase: `https://xxxxxxxxxxxxx.supabase.co/functions/v1/zbd-receive` should return a JSON response with the payment request details.
You can also test this using curl command:
```bash
curl https://xxxxxxxxxxxxx.supabase.co/functions/v1/zbd-receive
```
You're looking for the `data.invoice.request` property in the JSON response. It starts with `lnbc1` and is the payment request anyone in the Bitcoin Lightning Network can use to pay you.
```
lnbc1u1pjdlax9pp5t7jhkd7h2wntd4f2v7xp22dknmjxp0q8nm7hfcny4p7a5mr7x3rsdp9f4hkueteypshggrfde6x2unwv46zqumsv4jkgcqzzsxqzjcsp5dsayu6m6632p28rnkeeqsr7d54amrkv6wh46yrv42gdgca8xl8gs9qyyssqgj2zrkax733rzulfkzc5mqsr8fpwrva82stpa7e0frw32722trv37jlq8mvlqfp8y75lr6mz63zd7qnxar8hhsehuy22pvfq6wjxwqqqa60lx3
```
Charges and payment requests are usually shown to users as QR codes that can be scanned by mobile apps (e.g. [ZBD](https://zbd.one/download)). Read [Callbacks](/payments/api/callbacks) to understand how to receive updates about your payment asynchronously.
## 5. Try it yourself
You can now begin receiving instant Bitcoin payments on the edge with Supabase + ZBD!
See the full source code.
# Sending instant Bitcoin payments with Supabase
Source: https://docs.zbdpay.com/payments/sdk/typescript/supabase/send
Learn how to send Bitcoin using Supabase Edge Functions.
## Prerequisites
To complete this guide, you will need the following:
* [ZBD Project with a Live API key](/get-started/api-keys)
* [Supabase account](https://supabase.com/) + [Supabase CLI installed](https://supabase.com/docs/guides/cli#installation)
## 1. Create a Supabase Function
To create a Supabase Edge Function you must run the following command locally:
```bash
supabase functions new zbd-send
```
This will create a `/supabase/functions/zbd-send` folder structure in your project.
## 2. Write the Edge Function
Use the code below as a starting point for your handler function. You will need to replace the `ZBD_API_KEY` with your own ZBD Project's API key.
```typescript
import { serve } from "https://deno.land/std@0.168.0/http/server.ts"
const ZBD_API_KEY = "b7Ya3s2JZKZcXXX2Dqf8wjKTZZZRuWr8";
const zbdSend = async (_request: Request): Promise => {
const res = await fetch("https://api.zebedee.io/v0/ln-address/send-payment", {
method: "POST",
headers: {
"Content-Type": "application/json",
"apikey": `${ZBD_API_KEY}`,
},
body: JSON.stringify({
lnAddress: 'andre@zbd.gg', // Who is the recipient of the payment?
amount: '100000', // 100 satoshis (100,000 msats) -- ~$0.03
comment: 'Money at internet speed', // What is this payment for?
}),
});
const data = await res.json();
return new Response(JSON.stringify(data), {
status: 200,
headers: {
"Content-Type": "application/json",
},
});
};
serve(zbdSend);
```
## 3. Send payment locally
In order to successfully send payments through the API, you must have an active balance in the ZBD Project you are using. [Learn more about depositing funds into a ZBD Project wallet](/get-started/add-funds).
If you do not have funds in the ZBD Project you are using, you will receive a 4xx error from the API stating insufficient funds.
To run this Supabase Edge Function locally you can spin up your Supabase instance using the following command. *You may already have this running at this stage.*
```bash
supabase functions start
```
Then you can run the following command to start your serverless function:
```bash
supabase functions serve zbd-send --no-verify-jwt
```
Note that we add the `--no-verify-jwt` flag to the command to disable JWT verification. This is because we are not passing a JWT token to the function when we call it. **This is not recommended for production use.**
Supabase CLI will output a HTTP URL endpoint that you can use to test your function by issuing a POST request to that resource.
## 4. Deploying to Supabase Edge
After testing it locally, you can deploy your function to Supabase Edge using the following command. *You will need to enter your Supabase project ID to deploy.*
```bash
supabase functions deploy zbd-send
```
Once you deploy you will receive a URL that you can use to view that function in production on Supabase's Web Dashboard:
Opening your browser (or another HTTP client) to the URL provided by Supabase: `https://xxxxxxxxxxxxx.supabase.co/functions/v1/zbd-send` should return a JSON response with the payment sent message.
You can also test this using curl command:
```bash
curl https://xxxxxxxxxxxxx.supabase.co/functions/v1/zbd-send
```
You're looking for the `status` of `completed` to know that the payment settled successfully.
Payments in the Lightning Network are asynchronous so you may see a response stating the payment is `processing`. This is expected -- use the `callbackUrl` property to receive updates about your payments.
## 5. Try it yourself
You can now begin sending instant Bitcoin payments on the edge with Supabase + ZBD!
See the full source code.
# Receiving instant Bitcoin payments on Vercel
Source: https://docs.zbdpay.com/payments/sdk/typescript/vercel/receive
Learn how to receive Bitcoin using Vercel Edge Functions.
## Prerequisites
To complete this guide, you will need the following:
* [ZBD Project with a Live API key](/get-started/api-keys)
* [Vercel account](https://vercel.com/signup) + [Vercel CLI installed](https://vercel.com/docs/cli#installing-vercel-cli)
## 1. Create a Next.js Project
Follow the prompts on the create-next-app CLI to create a new project, and then change into the directory of your project.
```bash
yarn create next-app
```
```bash
cd
```
## 2. Write an Edge Function
For this guide we will be making use of the [App Router](https://nextjs.org/docs/app/building-your-application/routing/route-handlers) inside of Next.js.
Create a new file in the `app/api/request/route.ts` that creates a Bitcoin Lightning Charge (payment request) with the following code:
```javascript app/api/request/route.ts
import { NextResponse } from 'next/server';
export const runtime = 'edge';
export const dynamic = 'force-dynamic';
const ZBD_BASE_URL = 'https://api.zebedee.io';
const ZBD_API_KEY = 'b7YW3s2JzZKGcXjIf5Dqof8wjKT2RuWr8';
export async function GET() {
const res = await fetch(`${ZBD_BASE_URL}/v0/charges`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': `${ZBD_API_KEY}`,
},
body: JSON.stringify({
amount: '100000', // 100 satoshis (100,000 msats) -- ~$0.03
description: 'Money at internet speed', // What is this payment request for?
}),
});
if (res.ok) {
const data = await res.json();
return NextResponse.json(data);
}
}
```
## 3. Create payment request locally
Run function locally:
```bash
npx next dev
```
Opening your browser to the following URL: `http://localhost:3000/api/request` should return a JSON response with a payment request.
You can also test this using curl command:
```bash
curl http://localhost:3000/api/request
```
You're looking for the `data.invoice.request` property in the JSON response. It starts with `lnbc1` and is the payment request anyone in the Bitcoin Lightning Network can use to pay you.
```
lnbc1u1pjdlax9pp5t7jhkd7h2wntd4f2v7xp22dknmjxp0q8nm7hfcny4p7a5mr7x3rsdp9f4hkueteypshggrfde6x2unwv46zqumsv4jkgcqzzsxqzjcsp5dsayu6m6632p28rnkeeqsr7d54amrkv6wh46yrv42gdgca8xl8gs9qyyssqgj2zrkax733rzulfkzc5mqsr8fpwrva82stpa7e0frw32722trv37jlq8mvlqfp8y75lr6mz63zd7qnxar8hhsehuy22pvfq6wjxwqqqa60lx3
```
Charges and payment requests are usually shown to users as QR codes that can be scanned by mobile apps (e.g. [ZBD](https://zbd.one/download)). Read [Callbacks](/payments/api/callbacks) to understand how to receive updates about your payment asynchronously.
## 4. Create payment request in production
Deploy your project to Vercel:
```bash
vercel
```
Opening your browser to the following URL: `https://project-name.vercel.app/api/request` should now return this in production.
You can also test this using curl command:
```bash
curl https://project-name.vercel.app/api/request
```
## 5. Try it yourself
You can now begin receiving instant Bitcoin payments on the edge with Vercel + ZBD!
See the full source code.
# Sending instant Bitcoin payments on Vercel
Source: https://docs.zbdpay.com/payments/sdk/typescript/vercel/send
Learn how to send Bitcoin using Vercel Edge Functions.
## Prerequisites
To complete this guide, you will need the following:
* [ZBD Project with a Live API key](/get-started/api-keys)
* [Vercel account](https://vercel.com/signup) + [Vercel CLI installed](https://vercel.com/docs/cli#installing-vercel-cli)
## 1. Create a Next.js Project
Follow the prompts on the create-next-app CLI to create a new project, and then change into the directory of your project.
```bash
yarn create next-app
```
```bash
cd
```
## 2. Write an Edge Function
For this guide we will be making use of the [App Router](https://nextjs.org/docs/app/building-your-application/routing/route-handlers) inside of Next.js.
Create a new file in the `app/api/send/route.ts` that makes a payment to a [Lightning Address](/payments/glossary#lightning-address) (e.g. [andre@zbd.gg](mailto:andre@zbd.gg)) with the following code:
```javascript app/api/send/route.ts
import { NextResponse } from 'next/server';
export const runtime = 'edge';
export const dynamic = 'force-dynamic';
const ZBD_BASE_URL = 'https://api.zebedee.io';
const ZBD_API_KEY = 'b7YW3s2JzZKGcXjIf5Dqof8wjKT2RuWr8';
export async function GET() {
const res = await fetch(`${ZBD_BASE_URL}/v0/ln-address/send-payment`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': `${ZBD_API_KEY}`,
},
body: JSON.stringify({
lnAddress: 'andre@zbd.gg', // Who is the recipient of the payment?
amount: '100000', // 100 satoshis (100,000 msats) -- ~$0.03
comment: 'Money at internet speed', // What is this payment for?
}),
});
if (res.ok) {
const data = await res.json();
return NextResponse.json(data);
}
}
```
## 3. Send payment locally
In order to successfully send payments through the API, you must have an active balance in the ZBD Project you are using. [Learn more about depositing funds into a ZBD Project wallet](/get-started/add-funds).
If you do not have funds in the ZBD Project you are using, you will receive a 4xx error from the API.
Run function locally:
```bash
npx next dev
```
Opening your browser to the following URL: `http://localhost:3000/api/send` should return a JSON response with the payment sent message.
You can also test this using curl command:
```bash
curl http://localhost:3000/api/send
```
You're looking for the `status` of `completed` to know that the payment settled successfully.
Payments in the Lightning Network are asynchronous so you may see a response stating the payment is `processing`. This is expected -- use the `callbackUrl` property to receive updates about your payments.
## 4. Send payment in production
Deploy your project to Vercel:
```bash
vercel
```
Opening your browser to the following URL: `https://project-name.vercel.app/api/send` should now return this in production.
You can also test this using curl command:
```bash
curl https://project-name.vercel.app/api/send
```
## 5. Try it yourself
You can now begin sending instant Bitcoin payments on the edge with Vercel + ZBD!
See the full source code.
# ZBD Rewards API
Source: https://docs.zbdpay.com/rewards/api
Instant Bitcoin rewards infrastructure for apps, games, and platforms
Transform user engagement with real-money rewards. The ZBD Rewards API lets you send instant Bitcoin payments to millions of users through their ZBD Gamertags – no complex integration required.
**Engagement as a Service** - Your users can receive and manage rewards through the ZBD App, available on iOS and Android. You focus on engagement, we handle the money rewards.
## Why Bitcoin Rewards Work
Users come back when there's real value at stake
Users share apps that pay them real money
Works globally, no banking required
## How Rewards API Works
```mermaid
graph LR
A[Your App] -->|Rewards API| B[ZBD Platform]
B --> C[User's ZBD Wallet]
C --> D[ZBD App]
D --> E[Cash Out Options]
style A fill:#6B46C1,stroke:#333,stroke-width:2px
style B fill:#f9f,stroke:#333,stroke-width:2px
style D fill:#9f9,stroke:#333,stroke-width:2px
```
Call our API with gamertag and amount
Bitcoin arrives in user's ZBD wallet instantly
Users manage rewards in the ZBD App
Convert to USD, send to your favorite crypto exchange, spend online, get gift cards, or save
## Use Cases That Drive Results
**Player Rewards That Matter**
* 🏆 **Tournament Prizes** - Instant payouts to winners
* 🎯 **Achievement Rewards** - Real money for milestones
* 👥 **Referral Bonuses** - Players recruit players
* 🎮 **Daily Challenges** - Keep them coming back
**Engagement That Pays**
* 📱 **Task Completion** - Reward productive behavior
* 📊 **Survey Incentives** - Higher completion rates
* 🏃 **Fitness Goals** - Pay users to stay healthy
* 📚 **Learning Rewards** - Incentivize education
**Campaigns That Convert**
* 📧 **Email Signups** - Real incentive to subscribe
* 🐦 **Social Sharing** - Organic viral growth
* ⭐ **Review Generation** - Authentic user feedback
* 🎁 **Loyalty Programs** - Points worth real money
## Quick Integration Example
Send your first reward in seconds:
```bash cURL
curl -X POST https://api.zebedee.io/v0/gamertag/send-payment \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"gamertag": "player123",
"amount": "1000",
"description": "Level 10 achievement!"
}'
```
```javascript Node.js
// Send achievement reward
const reward = await fetch('https://api.zebedee.io/v0/gamertag/send-payment', {
method: 'POST',
headers: {
'apikey': process.env.ZBD_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
gamertag: 'player123',
amount: '1000', // ~$0.50
description: 'Level 10 achievement!'
})
});
// Instant delivery - no callbacks needed!
console.log('Reward sent!', await reward.json());
```
```python Python
import requests
# Reward user for referral
response = requests.post(
'https://api.zebedee.io/v0/gamertag/send-payment',
headers={
'apikey': ZBD_API_KEY,
'Content-Type': 'application/json'
},
json={
'gamertag': 'player123',
'amount': '5000',
'description': 'Thanks for the referral!'
}
)
```
## Why Developers Choose ZBD Rewards
### 🚀 Simple Integration
No complex wallet management or Bitcoin / blockchain knowledge needed
Know immediately if payment succeeded
Users already have ZBD Rewards App - just need their gamertag
We handle KYC, AML, transaction monitoring, and regulatory requirements
### 💰 Flexible Reward Amounts
Send rewards from 0.001 to 1000+ dollars:
| Use Case | Typical Amount | Example |
| ----------- | -------------- | -------------- |
| Daily login | 10-100 sats | \~\$0.005-0.05 |
| Achievement | 100-1000 sats | \~\$0.05-0.50 |
| Referral | 1000-5000 sats | \~\$0.50-2.50 |
| Tournament | 10k-100k sats | \~\$5-50 |
### 📊 Real Business Impact (Fumb Games case study)
D7 retention for users who withdraw rewards
Extra revenue during regular community events
Increase of revenue during weekend events
## The ZBD Rewards Ecosystem
### For Your Users
* **ZBD Rewards App** - Beautiful app with wallet for iOS/Android
* **Instant Notifications** - Push notification alerts for rewards
* **Social Features** - Gamertags, profiles, leaderboards
* **Cash Out Options** - Convert to USD, send to your favorite crypto exchange, buy gift cards, or save
### For Developers
* **Simple API** - RESTful endpoints, great documentation
* **Fraud Prevention** - Built-in anti-abuse and anti-bot measures
* **White-label Options** - Custom branding available (talk to ZBD Sales for more details)
## Getting Started
Schedule a call with our team to discuss your use case
Use sandbox environment with test gamertags
Release to production and scale up rewards over time
Monitor performance data to maximize engagement
**Schedule a Demo** - See how leading apps use Bitcoin rewards to drive growth. Get your API keys and start sending rewards today.
## API Endpoints
Explore our rewards endpoints:
Instant payment to any ZBD user
Check payment details and status
Gamertag lookups and validation
Generate payment requests
***
**Pro Tip**: Start with small rewards (100-1000 sats) for common actions, then increase amounts for major achievements. Users appreciate any amount of real money!
# ZBD Gamertags
Source: https://docs.zbdpay.com/rewards/api/gamertags
Understanding the user identity system that powers instant Bitcoin rewards
ZBD Gamertags are unique identifiers that make sending rewards as easy as tagging a friend. Every ZBD user has a gamertag – their identity across the entire rewards ecosystem.
**Like Social Handles** - Gamertags work like Twitter handles or Discord usernames. Easy to remember, easy to share, perfect for rewards.
## What Are Gamertags?
Each user has one unique gamertag like `player123` or `speedrunner`
No long wallet addresses – just simple usernames
Works across all apps using ZBD Rewards
## Why Gamertags Matter
### For Developers
**No Wallet Management**
```javascript
// Traditional crypto payment
const address = "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh";
// 😱 Users are usually scared of long unreadable addresses
// ZBD Gamertag payment
const gamertag = "player123";
// 😊 Simple and memorable!
```
Users already have gamertags - you just send rewards.
**Frictionless Rewards**
* No QR codes to scan
* No addresses to copy/paste
* No wallet setup required
* Works like sending to @username
Your users already understand this pattern from social media.
**Universal Identity**
* Same ZBD Gamertag across all games
* Portable reputation system
### For Users
* **Easy to Share** - Put it in bio, stream overlay, or business card
* **Privacy First** - Reveals nothing about wallet balance
* **Changeable** - Users can update their gamertag anytime
* **Social Status** - Build reputation across games
## How Users Get ZBD Gamertags
Available on iOS and Android app stores
Simple email signup
Pick their unique identifier
Ready to receive rewards from any integrated app, game, or platform!
## Common Gamertag Patterns
### Gaming Communities
Often include game names, ranks, or team tags
Examples: `valorantace`, `RLchamp`, `FaZesniper`
Match their streaming handles for easy tips
Examples: `ttv_streamer`, `ninja`, `pokimane`
Fun, memorable names they use everywhere
Examples: `pizzalover`, `moonwalker`, `bitcoinbob`
Random or privacy-focused names
Examples: `user8429`, `anon2024`, `privateplayer`
## Technical Considerations
### Gamertag vs User ID
**Important**: Gamertags can change! For permanent user tracking, use the immutable User ID.
```javascript
// Get permanent User ID from gamertag
const response = await fetch(`/v0/user-id/gamertag/${gamertag}`, {
headers: { 'apikey': API_KEY }
});
const { id } = await response.json().data;
// id: "0a59bf56-daa3-4888-8330-cbc02eba3a6e" (never changes)
// Use for:
// - User limits/thresholds
// - Historical tracking
// - Database references
```
### Handling Edge Cases
Use User ID for persistent tracking. Gamertags are like social handles - they can change.
API returns clear error. Show user-friendly message: "User not found. Check the gamertag?"
Only letters, numbers allowed. Validate before sending.
## Ready to Send Rewards?
Now that you understand gamertags, start sending instant Bitcoin rewards to your users:
API guide for instant payments
Talk to our team about your use case
***
**Growing Fast**: Over 3 million gamertags created and counting. Your users might already have one!
# Create Charge
Source: https://docs.zbdpay.com/rewards/api/gamertags/create-charge
POST https://api.zebedee.io/v0/gamertag/charges
Generate a Lightning payment request for user-initiated payments
Create Lightning payment requests (invoices) that users can pay to add funds or make purchases. Perfect for user-initiated transactions like deposits, premium upgrades, or marketplace purchases.
**Lightning Invoices** - This creates a standard Lightning Network invoice that can be paid from any Lightning wallet, not just ZBD.
## Use Cases
User-to-user transactions between ZBD users
Collect entry fees with payment proof
## Configuration
### Header Parameters
Your ZBD Project API Key
Content Type (must be application/json)
### Body Parameters
Amount to charge in **millisatoshis**
Common amounts:
* `"10000"` = 10 sats (\~\$0.005)
* `"100000"` = 100 sats (\~\$0.05)
* `"1000000"` = 1,000 sats (\~\$0.50)
* `"10000000"` = 10,000 sats (\~\$5.00)
The user's gamertag who will receive credit when paid
Note: The invoice can be paid by anyone, but this gamertag gets credited
Description shown in Lightning wallets (max 150 chars)
Examples:
* "Deposit to GameApp wallet"
* "Premium upgrade - 30 days"
* "Tournament entry fee"
Invoice expiration time in seconds (default: 600 = 10 minutes)
Range: 60 to 3600 (1 minute to 1 hour)
Your internal reference ID for tracking
Use for linking to your database records
Webhook URL for payment notifications
ZBD will POST to this URL when invoice is paid
## Response
```json Success Response
{
"success": true,
"data": {
"id": "chrg_2n4f8gu3nf",
"unit": "msats",
"status": "CHARGE_PENDING",
"amount": "1000000",
"createdAt": "2024-03-14T19:40:13.880Z",
"internalId": "deposit_1710441613880",
"callbackUrl": "https://yourapp.com/webhooks/charge",
"description": "Add funds to wallet",
"invoiceRequest": "lnbc10u1pjp8wlxpp5xm2la0q5kqw8w85u4kkz8vnwed8kuhn8d5e2qc8xu3j3jk3vy36sdps2fjhzat9wd6xjmn8yppksctjvajjqmr0wfjjqen0wgsywatvdssyyctdv4e8gct8cqzpgxqzjcsp5e7defq66t8svrpqr37weqpxv6fhskmm4h69hx5qhngrmqxzr0qrq9qyyssqtkxkpqd8hll3fmn7v6mfs7u3pxh5j4mtxp8p8tnrch4nqjm8jt0xm9td9klvlshxkkahnvc2yvrt9l8438u8xz2qc6qzlf9kr46y7cp6lvh0t",
"invoiceExpiresAt": "2024-03-14T19:50:13.859Z",
"invoiceDescriptionHash": null
}
}
```
### Response Fields
| Field | Type | Description |
| ------------------ | ------ | ----------------------------------- |
| `id` | string | Unique charge identifier |
| `status` | string | Always "CHARGE\_PENDING" initially |
| `amount` | string | Amount in millisatoshis |
| `invoiceRequest` | string | Lightning invoice (payment request) |
| `invoiceExpiresAt` | string | When invoice expires (ISO 8601) |
| `createdAt` | string | Creation timestamp |
| `internalId` | string | Your reference ID |
| `callbackUrl` | string | Your webhook URL |
**Universal Compatibility** - These invoices work with any Lightning wallet, not just ZBD. Users can pay from Cash App, Strike, Phoenix, or any other Lightning-enabled service.
# Get Gamertag by UserID
Source: https://docs.zbdpay.com/rewards/api/gamertags/retrieve-from-userid
GET https://api.zebedee.io/v0/gamertag/user-id/{id}
Retrieve a user's current gamertag from their permanent User ID
Get the current ZBD Gamertag for a user when you have their permanent User ID. Useful for displaying current usernames and sending rewards to users you're tracking by ID.
## When to Use This
Show up-to-date gamertags in leaderboards and profiles
Reward users you track by permanent ID
Update stored gamertags periodically
Find users in your system by their ID
## Configuration
### Path Parameters
The permanent User ID (UUID format)
Example: `"0a59bf56-daa3-4888-8330-cbc02eba3a6e"`
### Header Parameters
Your ZBD Project API Key
## Response
```json Success Response
{
"success": true,
"data": {
"gamertag": "speedrunner42"
},
"message": "Fetched gamertag from uuid"
}
```
### Response Fields
| Field | Type | Description |
| ---------- | ------ | ----------------------- |
| `gamertag` | string | User's current gamertag |
**Two-Way Mapping** - Use [Get UserID by Gamertag](/rewards/api/gamertags/retrieve-userid) to go from gamertag → ID, and this endpoint for ID → gamertag. Together they handle all user lookups.
# Get Reward
Source: https://docs.zbdpay.com/rewards/api/gamertags/retrieve-reward
GET https://api.zebedee.io/v0/gamertag/transaction/{id}
Retrieve details about a reward sent to a ZBD user
Track and verify rewards sent to your users. This endpoint provides complete transaction details including status, fees, and confirmation times.
## When to Use This
Confirm rewards reached the intended recipient
Build reward dashboards and reports with transaction data
Investigate user inquiries about rewards
Maintain records for accounting and compliance
## Configuration
### Path Parameters
Transaction ID from the Send Reward response
Example: `"78fb6474-d791-47a1-bda1-a4b9023898c0"`
### Header Parameters
Your ZBD Project API Key
## Code Examples
```bash cURL
curl -X GET https://api.zebedee.io/v0/gamertag/transaction/78fb6474-d791-47a1-bda1-a4b9023898c0 \
-H "apikey: YOUR_API_KEY"
```
```javascript Node.js
async function verifyReward(transactionId) {
const response = await fetch(
`https://api.zebedee.io/v0/gamertag/transaction/${transactionId}`,
{
headers: {
'apikey': process.env.ZBD_API_KEY
}
}
);
const result = await response.json();
if (result.success) {
console.log(`Reward status: ${result.data.status}`);
console.log(`Amount: ${result.data.amount / 1000} sats`);
console.log(`Delivered at: ${result.data.confirmedAt}`);
return result.data;
}
throw new Error(result.message);
}
// Verify a recent reward
const txId = "78fb6474-d791-47a1-bda1-a4b9023898c0";
const details = await verifyReward(txId);
```
```python Python
import requests
def get_reward_details(transaction_id):
"""Get details about a sent reward"""
response = requests.get(
f'https://api.zebedee.io/v0/gamertag/transaction/{transaction_id}',
headers={'apikey': ZBD_API_KEY}
)
data = response.json()
if data['success']:
reward = data['data']
print(f"Status: {reward['status']}")
print(f"Amount: {int(reward['amount']) / 1000} sats")
print(f"Fee: {int(reward['fee']) / 1000} sats")
print(f"Confirmed: {reward['confirmedAt']}")
return reward
else:
raise Exception(data['message'])
# Check on a reward
details = get_reward_details("78fb6474-d791-47a1-bda1-a4b9023898c0")
```
## Response
```json Success Response
{
"message": "Fetched charge.",
"success": true,
"data": {
"id": "903883f2-67d9-4707-a21b-ddff004fe041",
"receiverId": "ec9b38d5-b126-4307-9d1e-8aa0dfab5d7e",
"amount": "15000",
"fee": "1000",
"unit": "msats",
"processedAt": "2023-01-04T15:59:16.993Z",
"confirmedAt": "2023-01-04T15:59:16.989Z",
"comment": "Achievement unlocked! 🏆",
"status": "TRANSACTION_STATUS_COMPLETED"
}
}
```
### Response Fields
| Field | Type | Description |
| ------------- | ------ | ------------------------------ |
| `id` | string | Unique transaction identifier |
| `receiverId` | string | Recipient's ZBD User ID |
| `amount` | string | Reward amount in millisatoshis |
| `fee` | string | Network fee in millisatoshis |
| `unit` | string | Always "msats" |
| `processedAt` | string | When transaction was initiated |
| `confirmedAt` | string | When reward was delivered |
| `comment` | string | Description sent with reward |
| `status` | string | Transaction status (see below) |
### Status Values
| Status | Description |
| ------------------------------ | --------------------------------------- |
| `TRANSACTION_STATUS_COMPLETED` | Reward successfully delivered |
| `TRANSACTION_STATUS_PENDING` | Processing (rare for gamertag payments) |
| `TRANSACTION_STATUS_FAILED` | Reward failed to deliver |
**Instant Verification** - Rewards sent to gamertags are confirmed within milliseconds. The status will almost always be `COMPLETED` when you check.
# Get UserID by Gamertag
Source: https://docs.zbdpay.com/rewards/api/gamertags/retrieve-userid
GET https://api.zebedee.io/v0/user-id/gamertag/{GAMERTAG}
Convert a ZBD Gamertag to a permanent User ID for reliable tracking
Get a user's permanent ID from their ZBD Gamertag. Essential for tracking users reliably since gamertags can change but User IDs never do.
**Critical for User Tracking** - Gamertags are like Twitter handles - users can change them anytime. Always use the permanent User ID for databases, limits, and historical tracking.
## Why This Matters
Users can't bypass limits by changing gamertags
Track the same user even after name changes
## Configuration
### Path Parameters
The ZBD Gamertag to look up (case-insensitive)
Examples: `"player123"`, `"bitcoingamer"`, `"speedrunner42"`
### Header Parameters
Your ZBD Project API Key
### Response Fields
| Field | Type | Description |
| ----- | ------ | ------------------------------- |
| `id` | string | Permanent User ID (UUID format) |
**Pro Tip**: Always store both the User ID (permanent) and current gamertag (for display). This gives you reliability and good UX.
# Send Reward
Source: https://docs.zbdpay.com/rewards/api/gamertags/send
POST https://api.zebedee.io/v0/gamertag/send-payment
Send instant Bitcoin rewards to users via their ZBD Gamertag
Send instant Bitcoin rewards to any ZBD user. Perfect for achievements, milestones, referrals, or any action you want to incentivize.
**Synchronous API** - Unlike other payment endpoints, rewards are delivered instantly. The API response confirms success or failure immediately - no callbacks needed.
## Configuration
### Header Parameters
Your ZBD Project API Key
Content Type (must be application/json)
### Body Parameters
Reward amount in **millisatoshis** (1 sat = 1000 msats)
Common amounts:
* `"1000"` = 1 satoshi (\~\$0.0005)
* `"100000"` = 100 sats (\~\$0.05)
* `"1000000"` = 1,000 sats (\~\$0.50)
* `"10000000"` = 10,000 sats (\~\$5.00)
The recipient's ZBD Gamertag (case-insensitive)
Examples: `"player123"`, `"bitcoingamer"`, `"speedrunner42"`
Message shown to the recipient (max 150 characters)
Best practices:
* Be specific: "Level 10 achievement unlocked!"
* Add emojis: "Great job! 🎯"
* Include context: "Tournament prize - 3rd place"
```json 200 - Success
{
"success": true,
"data": {
"id": "49cccd62-b686-4057-9f44-f492bd54ac39",
"status": "settled",
"transactionId": "78fb6474-d791-47a1-bda1-a4b9023898c0",
"receiverId": "ec9b38d5-b126-4307-9d1e-8aa0dfab5d7e",
"amount": "1000000",
"comment": "Achievement unlocked! 🏆",
"settledAt": "2024-03-19T21:42:54.993Z"
},
"message": "Payment done."
}
```
### Error Responses
```json 400 - Invalid Gamertag
{
"success": false,
"message": "User not found with provided gamertag"
}
```
```json 400 - Insufficient Balance
{
"success": false,
"message": "Insufficient balance in project wallet"
}
```
```json 401 - Invalid API Key
{
"success": false,
"message": "Invalid API key provided"
}
```
## Response Fields
| Field | Type | Description |
| --------------- | ------ | ---------------------------------------- |
| `id` | string | Unique payment ID |
| `status` | string | Always "settled" for successful payments |
| `transactionId` | string | ZBD transaction ID for tracking |
| `receiverId` | string | Recipient's ZBD User ID |
| `amount` | string | Amount sent in millisatoshis |
| `comment` | string | Your description as seen by recipient |
| `settledAt` | string | ISO 8601 timestamp of delivery |
## Common Patterns
### Reward with Limits
```javascript
// Implement daily reward limits
async function sendDailyReward(gamertag, amount) {
const dailyLimit = 10000; // 10k sats per day
const userTotal = await getDailyTotal(gamertag);
if (userTotal + amount > dailyLimit) {
throw new Error(`Daily limit exceeded. ${dailyLimit - userTotal} sats remaining.`);
}
const result = await sendReward({
gamertag,
amount: amount * 1000,
description: "Daily challenge complete!"
});
await updateDailyTotal(gamertag, userTotal + amount);
return result;
}
```
## Try It Out
Ready to send your first reward? Use our API playground on the right to test with your API key.
**Instant Delivery** - Rewards appear in the user's ZBD App immediately. They'll get a push notification if they have the app installed!
# Utility APIs
Source: https://docs.zbdpay.com/rewards/api/gamertags/utils
Helper endpoints for gamertag validation, user lookup, and payment requests
Beyond sending rewards, these utility endpoints help you build robust integrations with user validation, payment requests, and identity management.
**Developer Tools** - These APIs handle the edge cases and user management tasks that make your rewards system production-ready.
## Available Utilities
Convert between gamertags and permanent User IDs
Verify gamertags exist before sending rewards
Handle user changes and persistent tracking
Create Lightning charges for user-initiated payments
## Why These Matter
### Prevent Failed Rewards
```javascript
// ❌ Bad: Send and hope
try {
await sendReward({ gamertag: userInput, amount: 1000 });
} catch (error) {
// Reward failed, bad user experience
}
// ✅ Good: Validate first
const userId = await getUserIdByGamertag(userInput);
if (userId) {
await sendReward({ gamertag: userInput, amount: 1000 });
// Success guaranteed
} else {
showError("Invalid gamertag. Please check and try again.");
}
```
### Track Users Properly
**Gamertags Can Change**
```javascript
// Monday: User is "bitcoinlover"
database.save({ gamertag: "bitcoinlover", totalEarned: 5000 });
// Tuesday: User changes to "cryptoking"
database.save({ gamertag: "cryptoking", totalEarned: 1000 });
// Now you have duplicate records! 😱
```
**Use Permanent IDs**
```javascript
// Get permanent ID
const { id } = await getUserIdByGamertag("bitcoinlover");
// id: "abc-123-def" (never changes)
// Always track by ID
database.save({
userId: id,
gamertag: "bitcoinlover", // For display only
totalEarned: 5000
});
```
## Utility Endpoints
Explore each utility API:
Convert gamertag to permanent ID
Convert ID back to current gamertag
Generate Lightning payment requests
Request additional utilities
## Get Started
Ready to build production-ready rewards features?
**Start Sending Rewards** - Check out the complete API documentation with all endpoints and examples.
***
**Coming Soon**: Bulk operations API, gamertag search endpoint, and social graph features. Let us know what utilities would help your integration!
# Download ZBD App
Source: https://docs.zbdpay.com/rewards/app
Get ZBD App for all your favorite platforms.
## ZBD App
The ZBD App is your key to becoming a true Internet Citizen. It is available for [iOS and Android](https://zbd.one/app) mobile devices.
Get ZBD Now!
Get ZBD Now!
## ZBD Bots
ZBD is available for your favorite chat apps Discord and Telegram. Add ZBD to your groups and servers and start zapping your friends as easily as sending a text.
Get ZBD Bots for Discord Now!
Get ZBD Bots for Telegram Now!
## ZBD Browser Extension
ZBD is available on your favorite web browser! Add ZBD as your sidekick for Google Chrome, Mozilla Firefox, Microsoft Edge, Brave Browser, and more.
Install ZBD Extension Now!
Install ZBD Extension Now!
Install ZBD Extension Now!
Install ZBD Extension Now!
Install ZBD Extension Now!
Install ZBD Extension Now!
# URI Schemes
Source: https://docs.zbdpay.com/rewards/app/uri-schemes
Learn about the URI schemes ZBD App subscribes to.
## Introduction
When building experiences with the ZBD API, developers may wish to open the ZBD App from their own applications to trigger users for payments, posts, requests, and more. This can be done by using specific URI schemes.
## Available Schemes
To open or trigger the ZBD App on iOS or Android devices, the following URI schemes should work:
```
# Payments
lnurl
lightning
# ZBD App
zbd
zeb
zebedee
zebedeeapp
zebedeewallet
```
## Using URI Schemes
To use the URI schemes above you may craft a URL similar to the ones below:
### Open ZBD to pay a Charge
```
lightning:lnbc109......71fe
```
### Open ZBD to pay a Static Charge
```
lnurl:lnurl1dp68gurn...e3c3svx0h
```
### Open ZBD to automatically redeem a Voucher
```
zebedee:voucher:XXXXXXXX
```
# Global Support
Source: https://docs.zbdpay.com/rewards/coverage
List of regions where ZBD App & Rewards SDK is supported.
**This page lists region coverage for ZBD Rewards products (API SDK and App)**. For ZBD Payments product region coverage, please visit [Payments Coverage](/payments/coverage).
## US States
The ZBD App & Rewards SDK are available in all US states, **except New York (NY)**.
## Countries
The ZBD App & Rewards SDK **ARE** available in the following countries:
* Argentina
* Australia
* Austria
* Belgium
* Brazil
* Bulgaria
* Canada
* Chile
* Croatia
* Cyprus
* Czech Republic
* Denmark
* Estonia
* Finland
* France
* Germany
* Greece
* Hungary
* Iceland
* Ireland
* Israel
* Italy
* Japan
* Korea, Republic of
* Latvia
* Lithuania
* Luxembourg
* Malta
* Netherlands
* New Zealand
* Norway
* Poland
* Portugal
* Qatar
* Romania
* Singapore
* Slovakia
* Slovenia
* South Africa
* Spain
* Sweden
* Switzerland
* Taiwan
* Turkey
* United Arab Emirates
* United Kingdom
* United States
# Knowledge Base
Source: https://docs.zbdpay.com/rewards/knowledge-base
Learn best practices for implementing secure, scalable Bitcoin rewards in your games and apps
Your complete resource for mastering Bitcoin rewards integration. From security fundamentals to advanced implementation strategies, we've compiled everything you need to build successful rewarded experiences.
**Built from Experience** - These guides come from real-world implementations across hundreds of games processing millions of rewards. Learn from what works.
## What You'll Find Here
Protect your rewards from cheaters and hackers
Proven patterns from successful integrations
Step-by-step integration for Unity, Unreal, and more
## Featured Courses
### 🎮 Rewarded Play Guide
Learn how to implement Bitcoin rewards that drive engagement without breaking your game economy.
**Essential for Game Developers** - Understand reward economics, player psychology, and implementation strategies that have driven 40% retention increases.
**What's Covered:**
* Designing sustainable reward economies
* Balancing fun gameplay with real rewards
* Anti-cheat strategies specific to rewarded games
* Case studies from successful implementations
### 🔒 Game Security Course
**Required Reading** - When real money is involved, security isn't optional. This comprehensive course covers every attack vector and how to defend against it.
Our 9-part security course takes you through:
Start with a vulnerable example game
Learn how hackers exploit games:
* Hacking saved game files
* Memory manipulation
* Source code decompilation
* Network traffic interception
Implement professional security:
* Server-side validation
* Anti-tampering measures
* Replay attack prevention
* Device verification
**9 Comprehensive Modules** - From basic vulnerabilities to advanced protection strategies. With code examples and real attack scenarios.
### 🛠️ Integration Guides
Platform-specific guides for seamless implementation:
**Most Popular** - Complete Unity integration with our drag-and-drop SDK
* C# code examples
* Prefab components
* iOS/Android build guides
* Performance optimization
**Backend Integration** - Server-side rewards with Beamable
* Microservice setup
* Player economy design
* Secure API patterns
* Scaling strategies
## Why This Knowledge Matters
### The Cost of Getting It Wrong
**Without Proper Security:**
* Hackers drain reward pools
* Fake rewards flood the system
* Player trust destroyed
* Potential legal issues
**One game lost \$50,000 in 24 hours** due to a simple client-trust vulnerability.
**Common Mistakes Cost:**
* Players exploit imbalanced rewards
* Server costs spiral out of control
* Retention actually decreases
* Negative reviews pile up
**Proper implementation drives 3-5x ROI** on reward spend.
**Growing Pains:**
* Rewards system can't handle success
* Database locks under load
* API rate limits hit
* Players face delays
**Plan for 100x growth** from day one.
## Learning Paths
Choose your journey based on your role:
### For Game Developers
Start with security fundamentals (2-3 hours)
Learn reward design principles (1 hour)
Implement in your engine (2-4 hours)
Monitor, adjust, optimize
### For Backend Engineers
Focus on modules 5-9 for server security
Study rate limiting and validation
If using microservices architecture
### For Product Managers
Understand the economics
Know the risks and mitigations
Learn from successful implementations
## Quick Reference
### Security Checklist
* [ ] Never trust the client
* [ ] Validate all rewards server-side
* [ ] Implement rate limiting
* [ ] Use cryptographic signatures
* [ ] Monitor for anomalies
* [ ] Regular security audits
* [ ] Incident response plan
### Common Vulnerabilities
| Attack Type | Risk Level | Prevention |
| -------------------- | ---------- | ------------------------- |
| Memory hacking | 🔴 High | Server validation |
| Replay attacks | 🔴 High | Nonce/timestamp checks |
| Save file tampering | 🟡 Medium | Encryption + server sync |
| Network interception | 🟡 Medium | TLS + certificate pinning |
| Fake devices | 🟡 Medium | Device attestation |
## Community Wisdom
**THNDR Games**: "The security course saved us from a major vulnerability before launch"
**Bitcoin Miner**: "Rewarded play guide helped us balance rewards perfectly"
**Common Insight**: "We wish we'd read the security course before writing any code"
**Best Practice**: "Server-side validation isn't optional - it's essential"
## Stay Updated
The landscape of rewarded gaming evolves rapidly:
* **New Attack Vectors** - We update the security course as new threats emerge
* **Platform Changes** - Integration guides updated for latest SDKs
* **Best Practices** - Community-driven improvements
**Continuous Learning** - Bookmark this knowledge base and check back regularly. We add new content based on developer feedback and emerging trends.
## Get Started
Don't wait until after launch to think about security and best practices:
Essential for every developer
Design sustainable economies
Most popular platform guide
***
**Talk to Our Team** - Get personalized advice for your specific implementation challenges.
# Introduction
Source: https://docs.zbdpay.com/rewards/knowledge-base/game-security
ZBD's Head of R&D and Game Security Christian Moss introduces us to the series.
# 5. Altering Network Traffic
Source: https://docs.zbdpay.com/rewards/knowledge-base/game-security/altering-network-traffic
Understand how hackers can alter network traffic to cheat and steal in games.
In this video Daniel shows how hackers use a piece of software called “Charles Proxy” to edit network requests games make to their home servers, showing how unencrypted connections to 3rd party applications and even the developer's own game servers can be attacked.
# Detecting fake devices and apps
Source: https://docs.zbdpay.com/rewards/knowledge-base/game-security/app-check
Detect if the device or app are fake
In this episode, Mandelduck will show us how we can use Firebase's App Check to verify that the player is using a genuinely uncompromised device and a legitimate, untampered version of the app.
A small correction at 20:00 when talking about encrypting the app check token, this may not be needed for android only, as in order to use charles proxy to get and change the app check token the attacker needs a rooted device as a non rooted device running an app from google play won't let charles proxy see the data due to a security policy. This means they can only see app check tokens from devices that would fail the app check i.e. android forces a form of certificate pinning only allowing ssl certificates installed by the system and not by the user
Source code on branch security-4
[https://github.com/zebedeeio/anti-cheat-sample-game/tree/security-4](https://github.com/zebedeeio/anti-cheat-sample-game/tree/security-4)
Repo for the nodejs server can be found here
[https://github.com/zebedeeio/anticheat-example-server](https://github.com/zebedeeio/anticheat-example-server)
# 4. Decompiling Source Code
Source: https://docs.zbdpay.com/rewards/knowledge-base/game-security/decompiling-source-code
Learn how attackers can decompile your game and steal your API keys.
In this video Daniel shows how hackers use programs like ILSpy to read the game's source code. This is done to find out more about how the inner logic of the game works and to steal secret pieces of information such as API keys.
Similar tools can also be used to change or modify the game's internal code files and then recompile it.
# 3. Hacking Memory Values
Source: https://docs.zbdpay.com/rewards/knowledge-base/game-security/hacking-memory-values
Learn how attackers may modify game data through memory injection.
In this video Daniel shows a slightly more advanced method hackers use to change game data, such as players' high scores **in real time**. He achieves this by altering value in memory with the aid of a popular tool called “Cheat Engine”.
# 2. Hacking Saved Game Data
Source: https://docs.zbdpay.com/rewards/knowledge-base/game-security/hacking-saved-game
Understand the risks of storing sensitive data in local storage.
In this video Daniel shows one of the most simple hacks: altering player preferences to change the game’s save data. The point of this video is to show why the developer should not use Playerprefs or any local storage method, especially if it is unencrypted, to store sensitive data.
# 1. An Insecure Game
Source: https://docs.zbdpay.com/rewards/knowledge-base/game-security/insecure-game
Coding a purposefully insecure game with ZBD.
In this video Souleima creates a very simple and utterly insecure game. Even though there have been occurrences of developers developing games in such a way, this is overly insecure by design.
The point of this video is to make sure the developer is 100% aware that the development methods shown in the video are indeed **INSECURE** and should not be used outside demo environments.
# Replay/Mirror Attacks
Source: https://docs.zbdpay.com/rewards/knowledge-base/game-security/replay-attacks
Understand how hackers can replicate request to increase their score.
In this episode Chris aka Mandelduck will talk about some of the more sophisicated but yet common attacks know as Replay attacks.
Source code on branch security-3
[https://github.com/zebedeeio/anti-cheat-sample-game/tree/security-3](https://github.com/zebedeeio/anti-cheat-sample-game/tree/security-3)
# Securing data sent to the server
Source: https://docs.zbdpay.com/rewards/knowledge-base/game-security/securing-data
Stop attackers from altering data sent to the server.
In this episode Mandelduck will show us how we can use encryption to make any data sent to the server tamper proof
Source code on branch security-3
[https://github.com/zebedeeio/anti-cheat-sample-game/tree/security-3](https://github.com/zebedeeio/anti-cheat-sample-game/tree/security-3)
Code for nodejs encryption tools
[https://github.com/mandelmonkey/encryption-tools](https://github.com/mandelmonkey/encryption-tools)
# Making A More Secure Game
Source: https://docs.zbdpay.com/rewards/knowledge-base/game-security/securing-game
Learn how to make your game more secure by moving game logic to the server.
In this video Souleima shows how as a developer you should move as much of the game business logic as possible to the server. This is key to make your game more secure and mitigate most of the attacks shown in this series. Souleima uses [Microsoft Playfab](https://playfab.com/) to show how this is done. However other options such as [Beamable](https://beamable.com) or the developer's own server can be used.
The main takeaway of this video is that the developer should not use the ZBD API directly in their game client and should instead make API calls from their server.
**Furthermore the ZBD API key should NEVER be stored in the client side**.
# Beamable Integration
Source: https://docs.zbdpay.com/rewards/knowledge-base/integrations/beamable
How to integrate ZBD into your Beamable project.
## Why use [Beamable](https://beamable.com/?referral=zbd) with ZBD?
To ensure the security of your game integration with the [ZBD API](/payments/api), it is *crucial* to safeguard your [ZBD API Key](/get-started/api-keys) and avoid exposing it within any client-side code.
By leveraging [Beamable](https://beamable.com/?referral=zbd)'s Microservices and Realm (environment) configurations, you can secure your ZBD API Key by moving it from the game client to a server.
> A microservice architecture, or "microservice", is a solution of developing software systems that focuses on building single-function modules with well-defined interfaces and operations.
>
> [https://docs.beamable.com/docs/microservices-feature-overview](https://docs.beamable.com/docs/microservices-feature-overview)
This provides you a path for a seamless integration solution that powers easy and safe incorporation of ZBD functionalities into your game.
***
## ZBD Unity Package Overview
The ZBD Unity Package is a great starting point/reference package to safely integrate the [ZBD API](/payments/api) into your game using [Beamable](https://beamable.com/?referral=zbd) Microservices. See instructions to download the ZBD Unity Package [here](#3-download-zbd-unity-package).
The ZBD Unity Package contains the following:
### Microservice Demo
This demo showcases how you can use a [Beamable](https://beamable.com/?referral=zbd) Microservice to integrate with the [ZBD API](/payments/api) safely. You can utilize the fully functional Microservice in your project, or use this as a guide to create your own Microservices.
### ZBD Login Demo
This demo showcases a working implementation of [ZBD Login](/rewards/oauth2) (OAuth2) using [Beamable](https://beamable.com/?referral=zbd) Microservices on an Android device, enabling you to quickly achieve secure login to your game.
### UI Kit Demo
This demo showcases how you can integrate ZBD reward balances and reward withdrawal flows into your game, including a playable scene to visualize the look and feel of the UI. *Note: There is no functionality in this demo; this simply showcases UI elements that can be used in your project(s).*
To integrate this package into your game, you'll need to [set up Unity](#unity-setup), [set up Beamable](#beamable-setup), [run Beamable Microservices locally](#run-microservices-locally), then \[publish Microservices on the [Beamable](https://beamable.com/?referral=zbd) platform]\(#publish-microservices-on-beamable-platform).
***
## Unity Setup
You can begin with a new Unity project, or work from an existing one.
### 1. Install Newtonsoft JSON
1. In Unity, go to the `Package Manager` -> `Add package by name` -> input `com.unity.nuget.newtonsoft-json`.
2. Click `Add`.
### 2. Install [Beamable](https://beamable.com/?referral=zbd)
Follow the instructions [here](https://docs.beamable.com/docs/installing-beamable).
### 3. Download ZBD Unity Package
1. Go to the [GitHub repository](https://github.com/zebedeeio/beamable-starter/releases) and download the latest release `.unitypackage` file.
2. Drag and drop the file into the Unity project explorer to install the package.
### 4. Install Docker Desktop
[Docker Desktop](https://www.docker.com/) is needed to run and test the Microservice locally.
***
## [Beamable](https://beamable.com/?referral=zbd) Setup
### 1. Obtain ZBD API Key
To interact with the [ZBD API](/payments/api), you must obtain an [API Key](/get-started/api-keys) from your [ZBD Developer Dashboard](https://dashboard.zebedee.io/) account. If you are unsure about the process, see [this guide](/get-started/dev-dashboard) for step-by-step instructions.
### 2. Add ZBD API Key to your [Beamable](https://beamable.com/?referral=zbd) Project
You need to add the ZBD API Key to your project's Realm Configuration on Beamable. Please refer to [this guide](https://docs.beamable.com/docs/installing-beamable), which explains how to log in to [Beamable](https://beamable.com/?referral=zbd) and create a game. *If you are utilizing the ZBD / [Beamable](https://beamable.com/?referral=zbd) starter project, you can skip the installation steps and proceed directly to logging in and creating a game.*
1. In the [Beamable](https://beamable.com/?referral=zbd) Portal in the left side menu go to `Operate` -> `Config`
2. Add a new config by clicking `+ Add Config`
3. Add two Config Values:
| Namespace: | Key: | Value: | Notes: |
| ---------- | ------------ | ------------------ | --------------------------------------------------- |
| ZebedeeAPI | clientsecret | your client secret | This is only needed for the ZBD Login Example |
| ZebedeeAPI | apikey | your API Key | This is needed for any interaction with the ZBD API |
Here is an example of how your Realm configuration should look:
💡 **Note:** To use the provided sample Microservice, you must use these exact namespace and key values.
***
## Run Microservices Locally
By leveraging Microservices, we are securing our ZBD API Key by moving it from the game client to a server.
Before testing the Microservices, we need to run it locally.
### 1. Open Microservices Manager
In Unity, go to `Window` -> `Beamable` -> `Open Microservices Manager`
💡 **Note:** Here you will see the `ZebedeeMicroservice`
💡 **Note:** If you see this warning, make sure you have Docker installed.
### 2. Run Microservice
Hit the `Play` button.
***
## Publish Microservices on [Beamable](https://beamable.com/?referral=zbd) Platform
When you are ready to test on other devices (outside of Unity editor), you will need to publish your Microservice to [Beamable](https://beamable.com/?referral=zbd).
### 1. Open [Beamable](https://beamable.com/?referral=zbd) Publish Window
In the `Microservices Manager` tab in Unity, click `Publish`.
### 2. Publish Select Microservices
In the `Publish` window, toggle on which Microservice(s) you want published, then click `Publish`. This will deploy your Microservice(s) to [Beamable](https://beamable.com/?referral=zbd)'s platform.
### 3. View Microservices Status
Validate the applicable Microservice(s) are running by viewing the `Microservices` tab in the [Beamable](https://beamable.com/?referral=zbd) Portal.
💡 For more details on publishing Microservices, check out the [Beamable](https://beamable.com/?referral=zbd) documentation [here](https://docs.beamable.com/docs/microservices-distributing).
At this point, your game can now connect the published Beamable Microservice(s), which protects your ZBD API Key from the game client!
***
## Integrating the Microservices
To see sample code for how to integrate [Beamable](https://beamable.com/?referral=zbd) Microservices, view the `MyController.cs` file in the scripts directory of the ZBD Unity Package within Unity. Insert this code in applicable area(s) of your game; e.g. when you're [Sending sats to a ZBD Gamertag](/payments/api/gamertags/send).
To get data that needs to be secure from [Beamable](https://beamable.com/?referral=zbd) (as we do for the `apikey` and `clientsecret`), you can reference the code in `Config.cs` and the `GetAPIKey` function in `ZebedeeMicroservice.cs`.
```csharp
// This code ensures that the Beamable Microservice is ready
var ctx = BeamContext.Default;
await ctx.OnReady;
// This line makes the call to the Microservice
var result = await ctx.Microservices().ZebedeeMicroservice().GetWallet();
// Here we take the string and convert it to a response object
// The ZBD sdk has a response object for all responses.
// This allows you to easily get the data you need.
var jsonObject = JsonConvert.DeserializeObject(result);
// If needed for custom Microservice integration...
// This code gets the value stored at the given key from Beamable
public string ApiKey => _settings.GetSetting("ZebedeeAPI", "apikey");
public string ClientSecret => _settings.GetSetting("ZebedeeAPI", "clientsecret");
```
***
## ZBD Login Example Scene
This scene shows how you can integrate [ZBD Login](/rewards/oauth2) with an Android build.
This uses the Microservice to communicate with ZBD to let your users log in securely.
To see how to integrate ZBD Login (OAuth2 flow) you can check out the `LoginController.cs` script. This handles the initial start of the login flow and the deep link functionality.
### 1. Get ZBD OAuth2 Client ID
Add your [Client ID](/rewards/oauth2/integration) from the [ZBD Developer Dashboard](https://dashboard.zebedee.io/) and add it to the `LoginController` in the ZBD Login demo scene.
### 2. Ensure Microservices are Published
If you haven't already, you will need to publish your Microservice(s) to [Beamable](https://beamable.com/?referral=zbd). Once your Microservice(s) are published, you will be able to use it from anywhere. See [Publish Select Microservices](#2-publish-select-microservices) for more details.
### 3. Build for Android
You can now build your game for Android. Learn more [here](https://docs.unity3d.com/Manual/android-BuildProcess.html).
***
## Troubleshooting
### General Issues
If you are experiencing any issues here are a few things to check:
* **Make sure you are logged in to [Beamable](https://beamable.com/?referral=zbd) in the Unity Editor**
* **Make sure you have the correct game selected in the [Beamable](https://beamable.com/?referral=zbd) plugin within Unity**
* **Ensure you are in the correct [Beamable](https://beamable.com/?referral=zbd) Realm (environment) in Unity**
### 403 Errors
These issues are usually caused by an improper Docker or Microservice setup.
A few things to check:
* **Docker is installed correctly and running**
* **The Microservice is running locally when developing (this can be checked by the play button being highlighted in the Microservices tab in Unity)**
* **If you are expecting a `Published` Microservice, ensure the Microservice is published and deployed to the correct Realm from the [Beamable](https://beamable.com/?referral=zbd) Portal.**
# OAuth2 Login with ZBD in Unity
Source: https://docs.zbdpay.com/rewards/knowledge-base/integrations/unity
How to integrate Login with ZBD into a Unity app
How to integrate Login with ZBD into a Unity ap
In this video we will look at how you can integrate login with ZBD into your project
using beamable as a backend, although this video is also applicable for other backends
# Introduction to Rewarded Play
Source: https://docs.zbdpay.com/rewards/knowledge-base/rewarded-play
Understanding the reasons, benefits and best practices behind implementing real-money player rewards into games.
Here's what's in this guide:
| Section | What you'll learn | Key points |
| ------------------------------------------------------------------------------------------ | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| [Why reward players with real money?](#why-reward-players-with-real-money) | The KPI boosts and business logic behind rewarded play | - By sharing some of your revenue with your players, you end up monetizing them more for a nice net gain |
| | | - Rewards are first and foremost a retention tool |
| [The game must come first](#the-game-must-come-first-rewards-can-help-a-lot-though) | Where rewards can help, and where they can't | - Why rewards aren't a replacement for good gameplay |
| | | - Scenarios where we've seen rewards be a large difference maker |
| [Rewarded economy basics](#rewarded-economy-basics-best-practices-for-structuring-rewards) | Best practices for structuring your rewarded play economy | - Creating a sustainable and impactful rewarded economy |
| | | - The three tenets of rewarding users: reward early and often, determine rewards based on LTV, impose a daily withdrawal limit |
| [Reward mechanics](#reward-mechanics-and-how-to-implement-them) | How to give out rewards | - One-size-fits-all vs custom reward mechanics adapted to each game |
| | | - Link to implementation guide with more details and all things technical |
## Why reward players with real money?
#### Give a little, gain a lot!
In a world of slim profit margins, it may seem counterintuitive to reward players with real money just for playing your game. But, as it turns out, spending a little lets you earn a lot more!
So if you can earn between 80% and 200% more per user by spending 10-20% of your ad revenue on player rewards, why wouldn't you?
#### Retention is the name of the game
Real-money player rewards are a retention driver. And a very good one at that. There might be other reasons you'd want to integrate rewards, but really it all comes down to retention.
Long term retention is especially strongly impacted by rewards, but all ZBD partners see an increase from D1!
Results range from +100% up to ridiculous four-digit increases in long term retention, like what Fumb Games saw with Bitcoin Miner.
How much and in which part of their journey rewards impact player behavior will largely depend on your integration, messaging and first time user experience
#### An instant revenue share model
On the business-model level, player rewards are essentially a smart and fun way to implement a revenue share model.
We recommend giving 10-20% of your game's ad revenue back to players through rewards. But more on that below!
## The game must come first! Rewards can help a lot though
**Let's be realistic: adding rewards won't make a bad game great. But it can be the difference between a profitable product and a failed one.**
Rewarded play isn't about anyone getting rich. If your players are just playing the game to get rewards, it won't work out. The game has to be fun on its own, then the rewards are a cherry on top.
We tested this extensively, and, unfortunately, relying on giving out rewards as a selling point to get people to play your game isn't the best idea. Because the amount players can earn in a sustainable way that makes YOU money isn't large enough. It's more about the dopamine hit and thrill of getting something tangible out of playing.
### Scenarios where rewards work well
If you have a descend game, rewards do work wonders. **Here's a few scenarios we've seen where rewarded play made all the difference**:
1. A game you're struggling to scale, because the economics don't quite work out
* In our experience, this happens a lot. You have a great soft launch, but struggle to scale beyond those first cohorts. Rewarded play done in a sustainable way solves this!
2. Legacy titles that need a little refresher
* Thinking of sunsetting a game that used to work well? Try rewards before you pull the plug. It's a simple way to breathe new life into older titles!
3. Mid-core games with a learning curve
* Rewards are a great way to keep players motivated as they learn to play a game and figure out the mechanics! A little carrot placed in the right spot will push them through those barriers.
4. Casual games that struggle to retain past D7
* Sometimes, a game just won't get better if you add more depth to keep players interested. Or maybe the investment isn't worth it for that specific title. Rewards can help.
## Rewarded economy basics: best practices for structuring rewards
**Every game is different, but we've figured out a few basic tenets that make rewarded play efficient as well as sustainable.**
### Tenet #1: reward early, reward often, but not a lot
Remember: it's not the actual amount of money, it's the psychology of getting real-money rewards that makes the magic happen.
Players should receive a constant trickle of rewards rather than larger sums at a time. Earning something should be easy. Earning more should be a function of consistency from the player.
This is where using Bitcoin comes in super handy. Every Bitcoin breaks down into 100 million units called sats. It's like cents to a dollar, but super tiny - one sat is around 40x less than one cent.
Most mobile games on ZBD reward players between 1 and 5 sats at a time, but do so every few minutes, especially at the start of a session. A fraction of a cent is enough to keep the player engaged!
And because we use sats as the unit of account, the numbers still feel significant. Cashing out 100 sats is a completely different feeling from cashing out \$0.05
### Tenet #2: determine rewards based on LTV
The answer to "how much should I reward players" is actually quite simple... as much as you can afford. We generally recommend giving out 10-20% of your ad-generated revenue to players. The sweet spot is different for every game and there's nothing to do but test it out.
To make this work on a global scale, it's important to be able to change reward amounts based on geography. Certain partners that go deeper with ZBD build systems that set reward amounts for each player based on how much that exact user is earning you. But, as a starting point, it's good enough to simply take the LTV for each country you're live in and give out a percentage of that, based on the player's location.
### Tenet #3: impose a daily withdrawal limit
This is important for two reasons:
1. Security: having a hard limit to how much each player can withdraw per day will protect you against bots and fraud.
2. Retention: having rewards in your game is a great way to get a player to come back every day. A common scenario is that a player accumulates a relatively large sum before they want to cash out. Having a (clearly stated) daily limit is a great way to retain them for a few more days.
*Pro tip: implement a "reset your daily withdrawal limit" rewarded video placement! It's non-intrusive and works well with power users.*
## Reward mechanics and how to implement them
**Go simple and implement in less than a week. Or think about it a bit more and design something custom to your game!**
Generally speaking, there's 2 ways to implement player rewards:
1. One-size-fits app - based on time spent playing
* Give out rewards based on time spent playing a game. Easy to implement and requires no additional game design or changes to the game.
* Essentially a layer on top of your game, doesn't touch anything else.
2. Custom - based on your game mechanics
* Add earning mechanics to your game. Example: in an endless runner, players could pick up coins with a Bitcoin icon on them. Each coin is worth one sat.
* Requires some game design thinking and becomes part of the gameplay. You won't be able to reuse the exact setup in a different game.
* Harder to implement, but also feels native to the game and becomes a part of the fun! Tends to engage players more.
**We've gone into more detail on both ways to add rewards to your games in the next guide!** To learn more about the pros and cons, as well as detailed info on exactly how to implement this (including templates and code snippets), read [Rewarded Play guide #2: Integrating player rewards in a game](/rewards/knowledge-base/rewarded-play/integrating).
# Integrating Player Rewards in a Game
Source: https://docs.zbdpay.com/rewards/knowledge-base/rewarded-play/integrating
From setting up your account, to using our APIs in a secure way and massively engaging your users with Bitcoin rewards!
This guide will take you step by step through everything you need to know to integrate Bitcoin rewards using ZBD API into your game.
Here's what's in this guide:
| Section | What you'll learn | Key points |
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| [Setting up your account](#setting-up-your-account) | Signing up and funding your account. | - Main wallet holds most of your funds
-Project wallets are connected to games and have API keys attached to them |
| [Under the hood: ZBD API in your game](#under-the-hood) | The backend part of using ZBD. | - Store API keys on a secure server!
- The two recommended ZBD integration paths: Send to Email vs Log in with ZBD |
| [The front-end: In-game UI/UX](#the-front-end) | The front end part: How players withdraw rewards and how they earn them in the first place. | - Creating a withdrawal flow (with a premade template) |
| | | - Earning mechanics: Simple on-size-fits-all vs custom integrations to fit a specific game |
**Not into reading?** [Here's a video tutorial](https://www.youtube.com/watch?v=59ucumRqFxA) **taking you through the entire process of integrating time-based rewards into a Unity game.** It literally only takes a bit over an hour.
## Setting up your account
**If you've already set up a ZBD API account, created a Project and put some Bitcoin into it, feel free to skip this section.**
### Step 1: Sign up and verify
Signing up as a developer on ZBD is super easy. Head over to the sign-up page by [clicking here](https://dashboard.zebedee.io/signup).
You will then have to do the following:
1. Verify your email
2. Verify your identity/business
* **If you've received an invite code** from our BD team and signed up with that, then we will be in touch with some forms to verify your business
* **If you didn't sign up with a code**, that's totally fine. Just complete the simple ID verification process in our platform
### Step 2: Create and fund Project
**There are two types of wallets inside the ZBD Dashboard:**
1. Main wallet - this is very secure and should hold most of your Bitcoin
2. Projects - these are connected to API keys and should be topped up in small amounts regularly, to protect your funds from bots, hackers or simple mistakes.
* **RULE OF THUMB**: Create one project per game. So basically ZBD Project = rewards wallet for your game. We recommend you give your project the same name as your game.
* **STATING THE OBVIOUS**: If someone gets a hold of the API keys for your project wallet, they can drain all the Bitcoin inside that project.
**Now, your project needs funds.**
**First, get some Bitcoin to your main wallet**. You can do this by pressing the *charge* button on the [wallet page](https://dashboard.zebedee.io/wallet) and making a transfer from any Bitcoin Lightning wallet or exchange that supports the Lightning protocol.
If you don't have access to an exchange account, our dashboard also features a Sandbox mode to get you started with testing payments. Just make sure you're using our [Sandbox APIs and keys](https://docs.zbdpay.com/api-reference/zbd-gamertag/sandbox/send), they're separate from production ones!
More ways to top up your balance from the ZBD Dashboard are coming soon!
**Second, transfer Bitcoin from your main wallet to your project wallet**. On the [main wallet page](https://dashboard.zebedee.io/wallet), simply press the transfer button. The rest should be obvious.
## Under the hood
### ZBD API in your game
**Before you get started: Do you have a server?**
We realize many games don't require running any server-side code. For hypercasual and casual mobile games especially, it's usually totally fine to run all code on the client. Unfortunately, this won't work when you're integrating any sort of real-money functionality.
**You absolutely must store the following on a secure server, or you will get robbed.**
1. Your ZBD Project API keys - this gives access to sending out rewards
2. User balances - how much a user has earned and not withdrawn yet
**No server? No worries, we have a solution**
We've partnered with **Beamable** to provide game devs without existing server infra with a simple yet powerful and safe solution. Sounds interesting? [Sign up for a Beamable account here](https://beamable.com/?referral=zbd).
For a step by step guide on how to set up ZBD using Beamable for a Unity game:
} href="/rewards/knowledge-base/integrations/beamable">
Step by step integration guide for games using Beamable and ZBD.
View the source code for an example implementation of Beamable and ZBD.
#### Storing your API key
It is important to make sure that your ZBD API key is stored securely in your backend of choice. The API key should NOT be stored in the client.
If your backend is something like Playfab you can use the built in "Internal Title Data" to save sensitive game variables such as API keys, as data stored here cannot be accessed by the client but you can retrieve it via playfab cloud script to make requests to the ZBD API directly from your Playfab backend.
If you're using PlayFab, you can find a guide [here](https://learn.microsoft.com/en-us/gaming/playfab/features/data/titledata/quickstart).
If you are using your own backend such as node.JS or .NET you can put the API key in your .env file.
As mentioned above, if you don't have a backend solution yet, we recommend [Beamable](https://beamable.com/?referral=zbd) (and have a guide [here](https://github.com/zebedeeio/beamable-starter))
#### Storing user balances
Rewards work best when the player sees them accumulating inside the game clearly. More on the UX/UI on this below (including templates), but for now, let's talk about the server-side part of user balances.
You should always store how much a user has earned (and not yet withdrawn) on the server. If you store it on the client, bad actors can decompile your game, change that variable and pay themselves.
**If you're familiar with storing values on a backend, feel free to skip this next section.**
There's three parts to it:
1. Storing user balances on the server
* You need a user identifier, such as Device ID or GAID
* You need to store a value for rewards
2. Resetting the user balance when they withdraw rewards from the game to ZBD
3. Displaying all that inside your game
If you are developing on services such as Unity for your game and PlayFab for your backend, then PlayFab will automatically assign each user a playfabID. You can then use PlayFab's Economy system to store, retrieve and update the user's balance via PlayFab's Cloud Script. [Here](https://learn.microsoft.com/en-us/gaming/playfab/features/economy-v2/tutorials/currencies?tabs=create-currency-gm)'s a guide for this specific setup.
If you are using a custom backend such as NodeJS or .NET, you will need to set up a secure authenticated server and API using something like [Express](https://expressjs.com/), and provision a database such as MongoDB and manually create a user entry when your app loads for the first time. It is typical to use Unity's SystemInfo.deviceUniqueIdentifier as the unique identifier for the user.
At the risk of repeating ourselves... you can also do this using [Beamable](https://beamable.com/?referral=zbd). Especially if you don't have a backend yet.
#### On to the ZBD API
There are a few different ways to integrate the ZBD API. These are the two we recommend for games:
1. Send to Email - easy to set up, very little friction for gamers.
* Ideal for integrating fast, with minimal dev work
* Gamers only need to enter their email to withdraw.
* If they already have a ZBD account -> they get Bitcoin instantly
* If they don't have a ZBD account -> we send them an email with a voucher for the rewards and further instructions
2. Log in with ZBD - a bit more setup, but more powerful features and controls
* Just like "Sign in with Google", but for moving money.
* Ideal for games that want to build deeper integrations and have more insight into users/who is receiving rewards
### The simple way: Send to Email
This is the easiest way to get started with player rewards using the ZBD API.
**The user's perspective**: As simple as writing their email!
#### Using the Send to Email API
To send Bitcoin to a given email, all you need to do is call the Send to Email API with a POST call providing the following properties:
**Header**
Your ZBD Project API key
**Body**
* The Email of the intended recipient (e.g. [info@zebedee.io](mailto:info@zebedee.io))
* The amount for the Payment -> in millisatoshis
* Note / description of this Payment (will be shown to recipient)
To learn more about using Send to Email, please check our docs [here](https://docs.zbdpay.com/api-reference/email/send).
### The advanced way: Log in with ZBD
Similar to Log in with Google/Apple/Facebook. But for moving money.
Gives you access to more detail about your users, which enables advanced controls, like separate settings for ID verified users, querying a user's balance and more.
**The user's perspective**: They push a Log in with ZBD button, then they confirm permissions in the ZBD app.
#### Integrating Log in with ZBD
First, you need to integrate Log in with ZBD - this is built on the OAuth2 protocol, so it should be pretty standard.
**If you are using Unity and Beamable** (described above), we have a step-by-step guide and example projects for you [here](https://docs.zbdpay.com/courses/beamable-integration#zbd-login-example-scene).
**If you are using other engines or backends**, we have a guide for you [here](https://docs.zbdpay.com/docs/zbd-login/integration).
#### Sending rewards with Log in with ZBD
Log in with ZBD is a way to get user data. You can use it to fetch a user's ZBD Gamertag (basically their username on our system). To make payments, you just use our standard Send to Gamertag API.
It's similar to sending to email. To learn how to Send to Gamertag, check our docs [here](https://docs.zbdpay.com/api-reference/zbd-gamertag/send).
## The front-end
**In-game UI/UX**
This part of the guide will look at two things:
1. ZBD Withdrawal flow - how do users cash out from your game to their ZBD App?
2. Reward Mechanics - how do users actually get rewards in your game?
### ZBD Withdrawal flow
Why are we starting with how users claim rewards and not with how they get them? Because this part is simple and we have established very clear best-practices and prototypes. So this should be a breeze!
**The Components**
This is what you'll need to show inside your game:
1. Reward counter - how much the user has earned (and not withdrawn yet)
2. Withdrawal UI - a few simple screens that allow the user to withdraw
That's it! You can check out a prototype of this [here](https://www.figma.com/proto/myeGjehpTyFjpH5QYH3Z0B/ZBD-Unity-Asset-Kit-\(UI-for-Mobile-Games\)?type=design\&node-id=484-163\&t=XtQjZMRzM5mY0Mrk-0\&scaling=min-zoom\&starting-point-node-id=1119%3A129\&show-proto-sidebar=1) and it'll all make sense.
You can find a Unity package with all required elements set up in a way that's easy to customize [here](https://github.com/zebedeeio/zbd-unity-asset-kit).
ZBD integrations come in all shapes and sizes - it's really up to you what you want to build and how complex you want to go. But no matter what you're building, the withdrawal UX will work the same way. And, hopefully, that part is super clear now!
### Reward mechanics
Ok, now the fun part: deciding how users earn rewards in your game. Most ZBD games go custom and build custom mechanics inside the game. But there's also a one size fits all solution.
#### One size fits all: time-based rewards
| | |
| -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| **Great for**: | Incentivizing players to spend a certain amount of time in-game per session and keep coming back every day. |
| **Pros**: | Quick implementation that can be copied to any game. |
| **Cons**: | Only encourages time spent playing, not specific actions. Layers rewards on top, not as part of the game, making it feel a little less native. |
The simplest way to implement real-money rewards into a game is to simply say if a user plays for X amount of time, reward them with Y amount of Bitcoin.
[Here's a video tutorial that takes you through the entire process!](https://youtu.be/59ucumRqFxA?si=1gkamqBXOKP-vPWL)
#### Messaging
It's very important to clearly let the user know when they've earned a reward. We suggest showing a banner overlay every time a user earns a reward, that says:
"You've just earned a bit of Bitcoin! Keep playing to earn more!"
#### How to not get scammed
Any system that gives out real money for playing a game will always attract exploiters. Luckily, there are powerful tools available that ensure only legitimate players can get rewards.
**Security essential: Play Integrity**
We HIGHLY recommend you add Google Play Integrity and iOS Device Check to any game that gives out real-money rewards. This will ensure only users on legitimate devices (not emulators, not rooted) can get rewards. Firebase offers a convenient Wrapper called App Check for both services that you can integrate inside of Unity.
[Here's](https://docs.zbdpay.com/courses/game-security/app-check) how you do it.
**Validating gameplay: Quago**
You should validate real gameplay before giving out any rewards. Because you don't want to give rewards to users that just open a game and leave it running. You want them actually playing legitimately!
To do that, you need to run some sort of anti-cheat software. Otherwise, you will get scammed! We recommend [Quago](https://www.quago.io/) for this.
You can then make calls from your server or backend (PlayFab Cloud Script, Beamable micro service) to get the user's "game play data" which will tell you if the user has cheated - used a bot, fake device, etc.
Here's how you can implement time-based rewards using [Quago SDK](https://www.quago.io/) (See below)
```csharp Unity code
Quago.initialize(QuagoSettings
.create(appToken, QuagoSettings.QuagoFlavor.PRODUCTION).setLogLevel(QuagoSettings.LogLevel.INFO)
);
var userId = SystemInfo.deviceUniqueIdentifier;
Quago.beginTracking(userId);
API Endpoint to call on the server to get the Users playtime data
https://inference.quago.io/user/userId/?app_token=QUAGO_APP_TOKEN
Example Response
{
"platforms": "Android",
"last_seen_timestamp": "2023-10-29T18:49:00",
"cnt_inauth_days": 0,
"last_inauth_timestamp": null,
"total_playtime_hours": 0.16,
"total_motion_hours": 0.09109083333333333,
"inauth_playtime_percentage": 0,
"emu_playtime_percentage": 0,
"emu_models": "[]",
"input_devices_found": "[]",
"avg_session_playtime_minutes": 1.36,
"avg_daily_playtime_hours": 0.16,
"cnt_device_ids": 1,
"cnt_ips": 1,
"countries": "GB",
"device_model": "SM-S911B",
"system_version": "13"
}
```
You can then use total\_playtime\_hours to calculate how many sats you want to assign to the users balance. If inauth\_playtime\_percentage or emu\_playtime\_percentage is not 0 you can not reward any sats as the user has cheated.
#### Advanced integration: custom mechanics
| | |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Great for: | Making rewards a native and super fun part of your game. |
| Pros: | Brings maximum engagement and feels native to the game. |
| Cons: | Implementation will be different for every game and essentially becomes part of game design. But there's always simple ways to add it to an existing game! |
Every game is different, so we really can't tell you exactly how to integrate rewards as a native part of gameplay. But here's an example that should make it pretty clear how it works and give you some ideas!
**Example: Bitcoin Miner by Fumb Games**
This is a simple crypto mining simulation game. Check it out here: [Android](https://play.google.com/store/apps/details?id=com.fumbgames.bitcoinminor\&hl=en_US) / [iOS](https://apps.apple.com/us/app/bitcoin-miner-idle-tycoon/id1413770650)
Inside, players earn rewards by **tapping on coins with an orange "satoshi icon" on top:**
**That's it! Thanks for reading this guide, now go and create some super rewarding experiences for your players!**
# Introduction
Source: https://docs.zbdpay.com/rewards/oauth2
Learn about the features and capabilities of ZBD Login (ZBD OAuth2 API).
} href="/rewards/oauth2/integration">
Out-of-the-box integration with NextAuth.js and ZBD OAuth2 API.
Detailed information on the ZBD OAuth2 API and test with our API Playground.
Advanced walkthrough on the steps to integrate ZBD Login with your app.
Open-source ZBD OAuth2 Provider for NextAuth.js.
## Quick Start
Using `ZBD Login` is an easy and convenient way for users to log into and grant data access to your apps and games across multiple platforms. It is available on iOS, Android, web and desktop environments.
ZBD Login uses the [OAuth 2.0](https://oauth.net/2/) protocol for authentication and authorization, compatible with common OAuth 2.0 scenarios such as web device apps, client side, installed and limited ingress.
`ZBD Login` is used for easily authenticating on apps using ZBD accounts. Users need to have previously signed up on the ZBD App. It allows users to easily and quickly create an account in your game or app without having to set (and possibly forget) a password.
## Features
### ZBD Gamertags
When users choose to log in with ZBD, they can share their ZBD Gamertags with the game or app through their ZBD profiles. The ZBD profile data includes the user's Gamertag, their Lightning Address, profile pictures, verification status and much more.
### Money-enabled OAuth2
Think of `ZBD Login` as a money-enabled OAuth2. Unlike regular OAuth2 providers such as Google, Twitter, Apple, or Facebook, that only provide your game or application with the user's basic information, `ZBD Login` provides you with money capabilities. Whether through the user's ZBD Gamertag, or their public Lightning Address you can send payments and transactions to this user with ease.
### BYOA (Bring Your Own Auth)
`ZBD Login` functionality complements your existing account system. Give people the option to log in with ZBD, in addition to email or other forms of social login. When an email address obtained from `ZBD Login` matches one on your system, you will be able to log that person into your existing account without the need for additional passwords.
### Multi platform
ZBD follows strictly OAuth2 standards, therefore it is possible to integrate with most clients out there. Once users have a ZBD account, they can easily sign in to their accounts using your game or app on different platforms.
### Granular permissions
`ZBD Login` supports specific scopes and permissions that determine what information users choose to share with your app. This means developers have precise control over what is requested and users have precise control over what they want to approve.
### Data deletion
As conforming to a variety of data privacy guidelines (e.g. GDPR, CCPA) users are able to, at anytime, revoke their permissions from the games and apps they have logged in. Once login is made, the `Connected App` will be available on the ZBD App, on which users can easily revoke data access.
# Overview
Source: https://docs.zbdpay.com/rewards/oauth2/api
Learn about the features and capabilities of ZBD Login (ZBD OAuth2 API).
Section coming soon.
# Authorization
Source: https://docs.zbdpay.com/rewards/oauth2/api/authorization
GET https://api.zebedee.io/v1/oauth2/authorize
Create an authorization URL for ZBD Login.
## Description
In order to properly redirect users to the ZBD Login portal, you must open a browser session containing the built `authorization URL` as the destination address.
This API endpoint helps you create that authorization URL.
* [Read here for more details](/rewards/oauth2) on how to setup ZBD Login (OAuth2) with your platform.
## Configuration
### Query Parameters
# Data Fetching
Source: https://docs.zbdpay.com/rewards/oauth2/api/data-fetching
Learn about the features and capabilities of ZBD Login (ZBD OAuth2 API).
Section coming soon.
# Refresh Token
Source: https://docs.zbdpay.com/rewards/oauth2/api/refresh-token
POST https://api.zebedee.io/v1/oauth2/token
Generate a new accessToken for a ZBD Login user.
## Description
In order to fetch a new `accessToken` for a given ZBD User, make sure to use the `refreshToken` using the token endpoint.
* [Read here for more details](/rewards/oauth2) on how to setup ZBD Login (OAuth2) with your platform.
## Configuration
### Header Parameters
Content Type
### Body
# Fetch Access Token
Source: https://docs.zbdpay.com/rewards/oauth2/api/retrieve-access-token
POST https://api.zebedee.io/v1/oauth2/token
Fetch the user's access token from ZBD Login.
## Description
After accessing the ZBD login portal URL and successfully authenticating, the user will be redirected back to your application with `state` and `code` query parameters included. These two properties allow you to hit the `token` endpoint, and get the user's access token.
Once you have the `code` returned from the previous `authorization` endpoint, you must now make a `POST` request to get the token from this endpoint.
* [Read here for more details](/rewards/oauth2) on how to setup ZBD Login (OAuth2) with your platform.
## Configuration
### Header Parameters
Content Type
### Body
# Get User Data
Source: https://docs.zbdpay.com/rewards/oauth2/api/retrieve-user
GET https://api.zebedee.io/v1/oauth2/user
Fetch user-related information about a logged-in ZBD User.
## Description
You can use this API endpoint to fetch information about a given ZBD User, granted you can pass the provided `accessToken`.
* [Read here for more details](/rewards/oauth2) on how to setup ZBD Login (OAuth2) with your platform.
## Configuration
### Header Parameters
OAuth2 Access Token
ZBD Project API Key
# Get Wallet Data
Source: https://docs.zbdpay.com/rewards/oauth2/api/retrieve-wallet
GET https://api.zebedee.io/v1/oauth2/wallet
Fetch wallet-related information about a logged-in ZBD User.
## Description
You can use this API endpoint to fetch information about a given ZBD User's Wallet, granted you can pass the provided `accessToken`.
## Usage
[Read here for more details](/rewards/oauth2) on how to setup ZBD Login (OAuth2) with your platform.
## Configuration
### Header Parameters
OAuth2 Access Token
ZBD Project API Key
```json Response
{
"data": {
"balance": "98251000",
"remainingAmountLimits": {
"daily": "1000000000",
"maxCredit": "4901749000",
"monthly": "25000000000",
"weekly": "5000000000",
},
},
"message": "Successfully fetched user wallet.",
"success": true,
}
```
# Guidelines
Source: https://docs.zbdpay.com/rewards/oauth2/guidelines
Brand and technical guidelines for using ZBD Login.
## Brand Guidelines
When setting up `ZBD Login` it is important to provide users with consistent UI and UX flows. Therefore we provide you with all of the necessary visual assets you may need to properly integrate `ZBD Login` in your app, game, or system.
Focus on providing the best user experience and best value to your users and customers, and let us do the heavy lifting with the ZBD-specific assets.
### Assets Bundle
Get all ZBD Login Assets.
The ZBD Login Assets Bundle provides you with all ZBD logos and sublogos, download app badges, ZBD Login buttons, and detailed guidelines on how to use ZBD logotypes and brand elements.
## User Attribution
In order to properly attributed users that download the ZBD App from your app, game, or system, you must use the proper download link for your `Download ZBD` buttons.
To get your unique download link, please contact your ZBD Customer agent or [email us](mailto:support@zebedee.io).
# Integrating
Source: https://docs.zbdpay.com/rewards/oauth2/integration
Learn how to integrate ZBD Login into your application.
`ZBD Login` follows the [RFC 6749](https://datatracker.ietf.org/doc/html/rfc6749) standards in order to provide the best and safest experience to users. ZBD's OAuth2 implementation requires [PKCE (Proof Key for Code Exchange)](https://oauth.net/2/pkce/) as an additional feature for making sure the entire authentication flow is secure.
## OAuth2 API
The authorization sequence begins when your app redirects a browser to a ZBD URL. The URL includes query parameters that indicate the type of access being requested. ZBD handles authentication, session selection and user consent. The result is an authorization code, which the application can exchange for an `access token` and a `refresh token`.
The app must store the `refresh token` for future use and use the `access token` to fetch user data through the ZBD API. When the `access token` expires, the app will use the `refresh token` to request a new one.
In order to properly redirect users to the ZBD login portal, you must open a browser session containing the built `authorization URL` as the destination address.
### Authorization URL
* Authorization: `GET` [https://api.zebedee.io/v1/oauth2/authorize](https://api.zebedee.io/v1/oauth2/authorize)
* In case you are building this URL yourself, without the use of libraries that support PKCE, the following properties are needed, as query params:
* `client_id` = \
* `response_type` = code
* `redirect_uri` = \
* `code_challenge_method` = S256
* `code_challenge` = \
> After accessing the ZBD login portal URL and successfully authenticating, the user will be redirected back to your application with `state` and `code` query parameters included. These two properties allow you to hit the `token` endpoint, and get the user's `accessToken`.
### Getting the Token
* Token: `POST` [https://api.zebedee.io/v1/oauth2/token](https://api.zebedee.io/v1/oauth2/token)
* Once you have the `code` returned from the previous `authorization` endpoint, you must now make a `POST` request to the token endpoint, with the following properties:
```json
{
"client_id": "{{client_id}}",
"client_secret": "{{client_secret}}",
"code": "{{code}}",
"code_verifier": "{{code_verifier}}",
"grant_type": "authorization_code",
"redirect_uri": "{{your_url_callback}}"
}
```
* And, as response, you should receive the user's `accessToken`:
```json
{
"accessToken": "{{userAccessToken}}"
}
```
### Getting ZBD User Profile Data
* Profile: `GET` [https://api.zebedee.io/v1/oauth2/user](https://api.zebedee.io/v1/oauth2/user)
* You can now call the ZBD API endpoints passing the provided `accessToken` from the previous endpoint on the request authorization header.
```json
Response: {
"data": {
"email": "testzebedee2@gmail.com",
"gamertag": "testzebedee",
"id": "6109484f-08e6-479a-a044-be930d89b42a",
"image": "https://lh3.googleusercontent.com/a/AATXAJwNvpB49NrxF41KVrEFX9k1v93WoMAMBb4wBF7Q=s96-c",
"isVerified": true,
"lightningAddress": "testzebedee@zbd.gg",
"publicBio": "Welcome to my zbd.gg page!",
"publicStaticCharge": "lnurl1dp68gurn8ghj7ar9wd6zu7n9vfjkget99e5k7tmkxqhhyet3w4jhxapdwd6xzarfvvkkx6rpwfnk2ue0x56nxvrpxuervtfkxa3rgtf5xu6k2ttzxy6nstt9xsurgvejx5exydpjvc9v9tk7",
"social": {
"twitter": "gamertag",
"website": "https://example.com",
},
},
"success": true,
}
```
### Getting ZBD User Wallet Data
* Profile: `GET` [https://api.zebedee.io/v1/oauth2/wallet](https://api.zebedee.io/v1/oauth2/wallet)
* You can now call the ZBD API endpoints passing the provided `accessToken` from the previous endpoints on the request authorization header.
```json
Response: {
"data": {
"balance": "98251000",
"remainingAmountLimits": {
"daily": "1000000000",
"maxCredit": "4901749000",
"monthly": "25000000000",
"weekly": "5000000000",
},
},
"message": "Successfully fetched user wallet.",
"success": true,
}
```
It is common for software libraries and prebuilt packages to handle a lot of
this heavy-lifting for you, except for the `Getting the Token` part, which is
a true secret and should be handled in your secure backend system services.
## Integration
### Get Credentials from ZBD Developer Dashboard
In order to be able to implement `ZBD Login` functionality, you must first get your application/game's OAuth2 `Client ID` and `Client Secret`, and set up proper redirect URLs.
### Getting Keys
After creating a game inside of the ZBD Developer Dashboard, head on over to the `OAuth2` tab inside of that game's single details view.
You can now get your `Client ID` (first field) and `Client Secret` (second field).
Keep your secrets secure and safe. Don't share secrets with others. Don't
commit secrets into your code.
### Setting Redirect URLs
Now its time to set up your OAuth2 redirect URLs. Head on over to the OAuth2 settings modal through the `View Settings` button.
> It is a requirement that the same redirect URL be used in the first step of the OAuth2 flow (`authorization endpoint`) - if you set a redirect URL different from the one being used when building the authorization URL, or if you don't set a redirect URL at all, the Authorization redirect will not work.
From the opened OAuth2 Settings modal, you can add up to 3 redirect URLs (whether native mobile URIs or HTTPS-based URLs). To get started use the `+` button.
Once you've added your redirect URLs / app schemas, you can save by clicking `Update`. You're now all set up for using `ZBD Login` on your application. For more detailed examples [check out the OAuth2 Code Walkthrough for source code and LOC explanation](/rewards/oauth2/walkthrough).
# Implementation Walkthrough
Source: https://docs.zbdpay.com/rewards/oauth2/walkthrough
Detailed walkthrough of an implementation of ZBD Login.
## Client Side
When setting up OAuth2 from client side, you have two options:
* Build the entire flow yourself
* Make a request for building the [authorization URL](/rewards/oauth2/walkthrough#building-authorization-url)
* Handling the Webview with the created URL
* Getting the `code` after authenticating with ZEBEDE
* Making another request for [getting the token](/rewards/oauth2/walkthrough#getting-the-token-and-accessing-zbd-api)
* Make use of some of the available OAuth libraries available for the language you are working on, which would handle the initial steps of the flow
* Install and set up configs accordingly to the library
* If PKCE is available on the library you might receive the `code_verifier` from the response, after authenticating.
* If PKCE is not available, you might need to [build the code\_challenge and code\_verifier](/rewards/oauth2/walkthrough#building-authorization-url) yourself.
* Getting `code` as response
* Making the request for [getting the token](/rewards/oauth2/walkthrough#getting-the-token-and-accessing-zbd-api)
If you chose the second option, there are open-source libraries for handling OAuth2 on Mobile using AppAuth ([iOS](https://github.com/openid/AppAuth-iOS) and [Android](https://github.com/openid/AppAuth-Android)), as well as for React Native using [react-native-app-auth](https://github.com/FormidableLabs/react-native-app-auth).
## Server Side
### Node.js
This flow go over all the steps for Logging in with ZBD, from Building the authorization URL, with proper PKCE Keys, to getting the accessToken and calling ZBD API.
If you are using a library that provides PKCE guidelines, it will most likely be able to handle the initial flow (building auth URL and getting the code) just fine. In this case, feel free to jump to the [Token Section](/rewards/oauth2/walkthrough#building-authorization-url).
### Building Authorization URL
In case you are setting up the PKCE flow yourself (no usage of libraries), we will need to setup the `code_challenge` from a `code_verifier` which will be used later on, on token request.
```js
const crypto = require('crypto');
import OAuth from 'oauth';
function sha256(buffer) {
return crypto.createHash('sha256').update(buffer).digest();
}
function base64URLEncode(str) {
return str
.toString('base64')
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=/g, '');
}
export function GeneratePKCE() {
const verifier = base64URLEncode(crypto.randomBytes(32));
if (verifier) {
const challenge = base64URLEncode(sha256(verifier));
return { challenge, verifier };
}
}
const createZBDOauth = () => {
const { OAuth2 } = OAuth;
const authorizeUrl = 'oauth2/authorize';
const tokenPath = 'oauth2/token';
const oauth2 = new OAuth2(
ZBD_CONSUMER_KEY, // CLient ID
ZBD_CONSUMER_SECRET, // Client Secret
ZEBEDEE_API_URL, // ZBD API URL: https://api.zebedee.io/v0/
authorizeUrl, // Authorization URL: oauth2/authorize/
tokenPath, // Token Path: oauth2/token
null,
);
return oauth2;
};
// Called by the app to get a url it will open in a webview/or browser
export const getZBDLoginUrl = async (userId: string) => {
// generate the PKCE key
const { verifier, challenge } = GeneratePKCE();
// save the verifier/key to the user object so we can access it when validating in the callback
await User.findOneAndUpdate({ userId }, { oauthVerifier: verifier });
const scope = 'user';
const state = userId;
const suffix = `&response_type=code&code_challenge=${challenge}&code_challenge_method=S256&state=${state}`;
const oauth2 = createZBDOauth();
// use NPM module to create the url
const res = await oauth2.getAuthorizeUrl({
redirect_uri: ZBD_REDIRECT_URL,
scope,
});
// npm module doesnt support PKCE so append the url with the code_challenge info
const url = res + suffix;
return url;
};
```
**Code explanation**
* `getZBDLoginUrl` function
* In this function, we initially Generate PKCE keys: `verifier` and `code_challenge`
* Then, `findOneAndUpdate` represents an generic ORM call for updating the User model, on the database. This way we can, afterwards, retrieve that value for getting the token.
* We then Build the URL suffix
* Url prefix and generated from `createZBDOauth`, which uses `oauth` library to do so
* `generatePKCE`
* This is where we setup PKCE Keys.
* initially we set the code verifier:
* `const verifier = base64URLEncode(crypto.randomBytes(32));`
* From the code verifier, the code\_challenge is created:
* `const challenge = base64URLEncode(sha256(verifier));`
When logging in using the provided URL, you will get a response including `state` and `code` which should be user now for getting the token, and user data:
### Getting the token and accessing ZBD API
```js
// called by ZBD oauth on login
export const zbdLoginCallback = async (payload: Object) => {
const { code, state } = payload;
try {
const user = await User.findOne({ userId: state });
const { oauthVerifier } = user;
// get the verifier generated by the PKCE script
const res = await getAccessToken({
code,
client_secret: ZBD_CONSUMER_SECRET,
client_id: ZBD_CONSUMER_KEY,
code_verifier: oauthVerifier,
grant_type: 'authorization_code',
redirect_uri: ZBD_REDIRECT_URL,
});
const { access_token } = res.data;
// get user data now we have the access token
const response = await getUserData(access_token);
const { data } = response;
const userData = data.data;
const { gamertag, email, isVerified, id } = userData;
if (!gamertag || !id || !email) {
throw new Error('gamer tag not found');
}
// save the details to the user object so we now know their email, verification etc
user.gamerTag = gamertag;
user.gamerTagId = id;
user.email = email;
user.isZBDVerified = isVerified;
user.oauthLoginDate = new Date();
await user.save();
// show a webpage that will redirect back to the app app by calling the app schema url
return {
html: path.resolve(`${__dirname}/../callback/oauth-callback.html`),
};
} catch (e) {
console.error(e);
return {
html: path.resolve(`${__dirname}/../callback/oauth-callback-error.html`),
};
}
};
```
**Code explanation**
Once the user is successfully authenticated on ZBD Client, there is a redirect back to your app, sending `code` and `state` as query params.
Those values are send as payload on this next request:
* First of all, remember we registered the verifier on the User (generic ORM update)? now we retrieve that value:
* `const user = await User.findOne({ userId: state });`
* With the proper verifier, we can now make a post request to the token endpoint, and we should have the token returned.
* `const res = await getAccessToken({…body})`
```js
export const getAccessToken = async (payload: Object) => {
const response = await axios({
method: 'POST',
data: payload,
url: `https://api.zebedee.io/v0/oauth2/token`,
headers: {
'Content-Type': 'application/json;charset=UTF-8',
},
});
return response;
};
```
* Now, by adding the accessToken to request headers, we can fetch data from ZBD API
* `const response = await getUserData(access_token);`
```js
export const getUserData = async (accessToken: string) => {
const response = await axios({
method: 'GET',
url: `https://api.zebedee.io/v0/oauth2/user`,
headers: {
'Content-Type': 'application/json;charset=UTF-8',
Authorization: `Bearer ${accessToken}`,
},
});
return response;
};
```
You are now able to proceed with your login logic and send the user data accordingly ⚡
## Code Examples
See the full source code.
See the full source code.
# ZBD Rewards SDK
Source: https://docs.zbdpay.com/rewards/sdk
Real money rewards to boost engagement and retention.
## Overview
The ZBD Rewards Events SDK enables you to credit rewards to your users at your discretion (any amount at any time). However, users can only *withdraw* earned rewards up to a specified threshold based on their gameplay time.
For instance, when a user first downloads the game, you may credit the user 100 sats, but they may be limited to withdraw only up to 50 sats for a few minutes.
The player’s withdrawal limit increases the longer they engage with the game. For example, after 20 minutes of gameplay, they may be able to withdraw up to 100 sats. This system enhances the SDK's security while still providing most users with a quick and easy way to earn and withdraw Bitcoin.
In the following sections, we’ll explore how to send rewards and check a user’s withdrawal limit.
# Google Play Store Guidelines
Source: https://docs.zbdpay.com/rewards/sdk/android-app-store
Instructions for successfully submitting your game to the Google Play Store.
**It is very important to follow the below guidelines to ensure your game does not run into issues with app reviewers on the Google Play Store.**
# Accessing App Content
In the **App Content** section, go to **Actioned**.
After accessing **Data Safety**, click **Next** until you reach the **Data Types** section.
Expand the **App Activity** section and select **Installed Apps**.
Expand the **Device or other IDs** section and select **Device or other IDs**.
Click **Next** to proceed to **Data Usage and Handling**.
### 4. Data Usage and Handling
1. In the **Data Usage and Handling** section, expand **App Activity** and click **Start**.
2. Choose **Collected**
3. This is **NOT** processed ephemerally
4. Select **Data collection is required** (users can’t turn off this data collection) if applicable.
5. Under the reasons for data collection, select **Fraud prevention, security, and compliance**.
| Data Types | Collected | Shared | Processed ephemerally | Required or Optional | Purposes |
| ---------------------- | --------- | ------ | --------------------- | -------------------- | ---------------- |
| Installed applications | Yes | No | No | Required | Fraud Prevention |
| User IDs | Yes | No | No | Required | Fraud Prevention |
| Device or other IDs | Yes | No | No | Required | Fraud Prevention |
### 7. Finalizing and Saving
# Building
Source: https://docs.zbdpay.com/rewards/sdk/building
Comprehensive video guides for mastering Bitcoin apps and games with ZBD.
# Building for Android
### Minimum API Level
Make sure that the minimum API Level is set to **Android 10 API Level 29** in your settings.
### Dependencies
The ZBDSDK in Android requires a few dependenices to be installed. To make this as smooth as possible we included the `External Dependency Manager` in the package. This should automatically install the dependencies and deal with any duplicate classes.
However, you may need to manually resolve the dependencies by going to:
If during the build process you get build errors, specifically mentioning duplicate classes you may need to go to
# Building for iOS
### Target Minimum iOS Version
Make sure that the `Target Minimum iOS Version` is set to at least 13 in your settings.
# Compatibility
Source: https://docs.zbdpay.com/rewards/sdk/compatibility
SDK compatibility with Unity and mobile platforms.
The ZBD Rewards SDK for Unity is only compatible with **iOS** and **Android** mobile environments.
# Requirements
### Unity Version
```bash
2022 and above
```
### iOS Version
```bash
Deployment target 13 and above
```
### Android Version
```bash
Minimum Api Level OS 11/API 30 and Target API Level 34
Build settings: Stripping level to low or minimum
```
# Upgrading from Time Based SDK
If you are upgrading from the ZBD Time-based Rewards SDK version, please follow the steps outlined in this video walkthrough.
# Download SDK
Source: https://docs.zbdpay.com/rewards/sdk/download
Setup your Unity project to use the ZBD Rewards SDK
Contact your ZBD Customer Success Manager to get access to the ZBD Rewards SDK for your Unity project.
# Integrating Rewards SDK
Source: https://docs.zbdpay.com/rewards/sdk/integration
How to import and initialize the ZBD Rewards SDK.
# Import the SDK
Reach out to your ZBD Customer Success Manager to get access to the Unity SDK package.
To import a package, right-click the assets folder in Unity Editor and choose `"Import Package..."`.
Navigate to the newly imported ZBD folder `Prefabs` and drag and drop the ZBDSDK prefab into your scene.
Due to your specific scene resolution settings and orientation you may need to resize/adjust the included UI elements. We will explain how to do this in more detail later in this documentation, but for now we are assuming the UI element has imported correctly.
# Add your App ID
You should have received your `App ID` from your ZBD Customer Success Manager. You’ll need to set this in the `ZBDController` script which is attached to the `ZBDSDK` game object in the ZBDSDK prefab.
If you have not been given an App ID, for testing purposes only you can use the following ID:
```bash
sdkdemo.limitedachievementsats
```
# Initialize the SDK
You must set the `userId` property during initialization of the SDK if you want ZBD to share event data for your users (e.g. `user signed up for ZBD app`).
`userId`: this is **your internal userId** that can be attributed to a ZBD user.
Please reach out to your ZBD Customer Success Manager if you face any issues.
Once the ZBDSDK prefab is added you can initiate the SDK from another script, such as your main controller, via the following call:
```csharp
// Initialize the SDK with your internal userId
using ZBD;
ZBDController.Instance.Init(userId, completion =>
{
if (completion.success) {
Debug.Log("success");
} else {
Debug.LogError(completion.error);
}
}
);
```
### Initializing SDK without `userId`
You can also set the `userId` at any time after initialization by calling:
```csharp
ZBDController.Instance.SetUserId("user_id");
```
```csharp
using ZBD;
ZBDController.Instance.Init(completion =>
{
if (completion.success) {
Debug.Log("success");
} else {
Debug.LogError(completion.error);
}
}
);
```
This will allow the user to start earning, however **in order to withdraw they will need to download the ZBD app, get their ZBD Gamertag and register it with the ZBD Rewards SDK**.
The easiest way to do this is to present the ZBD modal. If the user has not registered their ZBD Gamertag then they will be guided through it inside the modal.
### Presenting SDK Modal
```csharp
ZBDModalController.Instance.ShowModal();
```
`ShowModal()` will present a modal prompting the user to enter a ZBD Gamertag, or to sign in if they were not signed in automatically.
Users can also **view their balance** and **initiate a withdrawal** from this modal.
### Detecting Modal Visibility
You may want to stop the gameplay or trigger some other event when the SDK modal becomes visible. You can **detect when the modal is visible** via 2 methods:
**Subscribe to the `ModalIsVisible` event**
```csharp
private void Start()
{
ZBDController.Instance.ModalIsVisible += WebViewVisible;
}
void WebViewVisible(bool visible)
{
// handle event here
}
private void OnDestroy()
{
ZBDController.Instance.ModalIsVisible -= WebViewVisible;
}
```
**Invoke `IsModalVisible()`**
You can also call `IsModalVisible()` to check the status of the modal.
```csharp
ZBDModalController.Instance.IsModalVisible();
```
**Android Back Button**
In Android you can detect whether the modal is open and close it with the following code snippet.
```csharp
if (Input.GetKeyDown(KeyCode.Escape))
{
if (ZBDModalController.Instance.IsModalVisible())
{
ZBDModalController.Instance.CloseModal();
}
}
```
# Apple App Store Guidelines
Source: https://docs.zbdpay.com/rewards/sdk/ios-app-store
Instructions for successfully submitting your game to the Apple App Store.
**It is very important to follow the below guidelines to ensure your game does not run into issues with app reviewers on the Apple App Store.**
# Privacy Policies
Apple announced that starting [Spring 2024](https://developer.apple.com/news/?id=3d8a9yyh), it will require its developers to declare the reasons for using certain APIs (aka Required Reason APIs) that could be misused to collect data about users' devices within privacy manifest files.
**This needs to be done when integrating the ZBD Rewards SDK.**
Once your Xcode project has successfully built, follow these steps:
Right click the new `PrivacyInfo` file and select `Open As -> Source Code` then copy and paste the following.
Add or change any values below based on what your game is doing!
More information on this Apple policy can be found here: [Apple Developer Documentation](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files).
```xml
NSPrivacyTrackingNSPrivacyTrackingDomainsNSPrivacyCollectedDataTypesNSPrivacyCollectedDataTypeNSPrivacyCollectedDataTypeDeviceIDNSPrivacyCollectedDataTypeLinkedNSPrivacyCollectedDataTypeTrackingNSPrivacyCollectedDataTypePurposesNSPrivacyCollectedDataTypePurposeAppFunctionalityNSPrivacyAccessedAPITypesNSPrivacyAccessedAPITypeNSPrivacyAccessedAPICategoryFileTimestampNSPrivacyAccessedAPITypeReasonsC617.1
```
Your game should now be able to be submitted to the Apple App Store!
If you have any questions, don't hesitate to reach out to your ZBD Customer Success Manager.
# Security
Source: https://docs.zbdpay.com/rewards/sdk/security
Security features and best practices for the ZBD Rewards SDK.
It’s important to explain the security assumptions of the SDK and to reiterate that no game is 100% secure—especially when real-money rewards are involved.
If you do not call the **`SendReward`** endpoint from your own backend server, it must be called from the client, which exposes it to abuse. A malicious attacker could potentially call this endpoint multiple times to reward themselves the maximum amount of Bitcoin.
To mitigate this, **we limit how much a user can withdraw based on how long their device has been online.**
For example, a user may attempt to reward themselves 10,000 sats, but they will only be able to withdraw 2 sats per 5 minutes of "Time Alive", effectively slowing down withdrawals to prevent farming.
# Time Alive
When your app/game is open, the SDK sends a “ping” to the ZBD backend roughly every 20 seconds. This allows the SDK to calculate how long it has been online in a way that cannot be easily spoofed.
Additionally, we use Apple and Google attestation systems to verify that the device is genuine and is running a non-rooted and non-jailbroken OS.
This further restricts malicious users, as they are only able to withdraw a maximum of **X sats every Y minutes per Z real devices**.
However, a more sophisticated operation may involve hundreds of genuine devices kept online in an attempt to farm rewards while passing attestation checks.
To help mitigate this, we can toggle additional verification steps such as CAPTCHAs or facial recognition at the point of withdrawal. We also monitor network and IP address activity —- but none of these measures are foolproof. A determined attacker may still find ways to bypass them.
This is why we **strongly recommend (almost require) calling the `SendReward` method from your own secure backend servers** and providing us with the IP address of that server, so we can restrict access to only trusted sources.
# Attestation
In order to make sure we have everything we need to detect your app/game has not been tampered with as part of our attestation check, we require a couple of pieces of information.
### Android
For Android we need your Bundle ID or package name i.e. `com.domain.appname` -- this is what you set in your Unity build settings.
We also need the SHA256 hash of your app signing key.
To find your app's SHA256 hash key for Google Play:
Find the `App signing key certificate` section and copy the SHA-256 fingerprint.
For development purposes you can generate a SHA256 hash key for your keystore using the following command:
```bash
keytool -list -v -keystore path/to/your.keystore -alias your_alias -storepass your_keystore_password -keypass your_key
```
It should look something like this
```bash
EA:A1:69:AA:2F:FC:6D:16:84:ED:06:11:E0:65:2B:E0:BB:9C:5B:E3:41:96:06:E2:3D:85:8F:2C:22:2A:E9:86
```
### iOS
For iOS we need your Bundle ID (`com.domain.appname`) and your Team ID.
To find your app's Team ID:
Copy the code from the `Team ID` section.
# Sending Rewards
Source: https://docs.zbdpay.com/rewards/sdk/send-rewards
Instructions for sending rewards to users with the ZBD Rewards SDK.
# Reward Unit
In the ZBD Rewards SDK, rewards are sent as units. A unit is a configurable value determined by your ZBD Customer Success Manager and can represent different amounts, such as 1 satoshi or \$0.10.
For example, **if the game is configured so that 1 unit = 1 satoshi, sending 1 reward will send 1 satoshi**. Conversely, if the game is set up so that `1 unit = $0.10`, sending 1 reward will send the equivalent of \$0.10 in satoshis.
# Sending Rewards
To send a reward to a user you can call:
```csharp
ZBDController.Instance.SendReward(1, callback =>
{
if (callback.success)
{
// reward sent
}
else
{
Debug.LogError("send reward error " + callback.message);
}
});
```
However, for improved security it is recommended (almost required!) that you call the `SendReward` API from your app's/game's server after validating actual gameplay.
This can be done using the users ZBD SDK ID which you can obtain after initialization has completed.
```csharp
ZBDController.Instance.Init("customUserId", completion => {
if (completion.success) {
string sdkUserId = completion.userId;
}
});
```
```jsx
curl --location 'https://api.zebedee.io/api/v1/rewards/limited-achievement/reward' \
--header 'Content-Type: application/json' \
--data '{"rewardsUserId":"USER ZBD SDK ID","amount": 1}'
```
Without calling `SendReward` from your backend server the security model downgrades to only relying on device attestation and the withdrawal limit based on time the device is active. More information on this can be found in the [Security](/rewards/sdk/security) section.
# Troubleshooting
Source: https://docs.zbdpay.com/rewards/sdk/troubleshoot
General troubleshooting guides for the ZBD Rewards SDK.
# Build Issues
* If you encounter build issues, it is important to check that the Android and iOS deployment targets and minimum API level are set properly. Refer to [Compatibility](/rewards/sdk/compatibility) for more information.
* If you receive a sign up error, please confirm that your Bundle ID / Package Name is the same as the one used whilst setting up the SDK configuration.
* Make sure the stripping level is set to low or minimum in the Unity build settings.
If you get the following build errors on Android please check the **[Building for Android](/rewards/sdk/building#building-for-android)** section.
# Performance Issues
The ZBD Rewards SDK forces hardware acceleration in Android builds, this can cause some issues with games.
If you notice performance issues after integrating the ZBD Rewards SDK you can delete the `ModifyUnityAndroidAppManifestSample.cs` file in the `Assets/Editor/` folder.
# Retrieving User Balance
Source: https://docs.zbdpay.com/rewards/sdk/user-balance
Instructions for retrieving user balances from the ZBD Rewards SDK.
To check the balance of a user you can invoke `GetBalance()`:
```csharp
ZBDController.Instance.GetBalance(callback=>
{
if (callback.success)
{
// the users balance in satoshis (not millisatoshis)
Debug.Log(callback.balance);
}
else
{
Debug.LogError("get balance error " + callback.message);
}
});
```
# Retrieving User Status
Source: https://docs.zbdpay.com/rewards/sdk/user-status
Instructions for getting the user status with the ZBD Rewards SDK.
To retrieve the SDK user status you should use the `GetUserStatus()` function.
```csharp
ZBDUtilities.Instance.GetUserStatus(callback =>
{
if (callback.success)
{
Debug.Log("user status success");
Debug.Log(callback.data.status);
if (callback.data.status == ZBDConstants.ZBD_LINKED_STATUS)
{
Debug.Log("zbd linked");
}
}
else
{
Debug.LogError("user status error " + callback.message);
}
});
```
This returns a `ZBDUserStatusResponse` object which contains a `ZBDUserStatus` object that has following data:
```csharp
public class ZBDUserStatusResponse
{
public bool success { get; set; }
public string message { get; set; }
public ZBDUserStatus data { get; set; }
}
public class ZBDUserStatus
{
// the user's linked status
public string status { get; set; }
// the user's sdk id
public string rewardsUserId { get; set; }
// the user's zbd id
public string zbdUserId { get; set; }
}
```
# Status Types
The `status` parameter can be:
* **`unlinked`**: User has not signed up for rewards, meaning they have not clicked Start Earning
* **`linked`**: User has signed up for rewards, meaning they have clicked Start Earning
* **`zbdlinked`**: User has signed up for rewards, clicked Start Earning, and linked their ZBD account
# Retrieving Withdrawal Limit
Source: https://docs.zbdpay.com/rewards/sdk/user-withdrawal
Instructions for retrieving user balances from the ZBD Rewards SDK.
You can also check the withdrawal limit of a user from the `GetBalance` response by checking `callback.withdrawalLimit`.
```csharp
ZBDController.Instance.GetBalance(callback=>
{
if (callback.success)
{
// the users withdrawal limit in satoshis (not millisatoshis)
Debug.Log(callback.withdrawalLimit);
}
else
{
Debug.LogError("get balance error " + callback.message);
}
});
```
# Walkthrough
Source: https://docs.zbdpay.com/rewards/sdk/video-walkthrough
Video instructions for integrating the ZBD Rewards SDK into your Unity project.