Quick Start Guide
Get up and running with BLAQPAY in under 10 minutes
Quick Start Guide
This guide will help you accept your first crypto payment in under 10 minutes.
Prerequisites
- A BLAQPAY account (sign up here)
- Basic knowledge of REST APIs
- Your favorite programming language or platform
Step 1: Get Your API Keys
- Log in to your BLAQPAY Dashboard
- Navigate to Settings → API Keys
- Click Create API Key
- Copy your Secret Key (it starts with
sk_test_for test mode)
⚠️ Important: Keep your secret key safe and never share it publicly.
Step 2: Create Your First Transaction
Use our API to create a payment transaction. Here’s an example:
curl -X POST https://blaqpay.io/api/transactions/create
-H "Authorization: Bearer sk_test_YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{
"amount": 100.00,
"customer_email": "customer@example.com",
"order_description": "Test payment",
"success_url": "https://yoursite.com/success",
"cancel_url": "https://yoursite.com/cancel"
}' Response
{
"success": true,
"transaction": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"transaction_number": "TXN-2024-001234",
"status": "created",
"amount_usd": 100.0,
"currency": "USD",
"payment_url": "https://blaqpay.io/pay/550e8400-e29b-41d4-a716-446655440000",
"expires_at": "2024-01-01T12:00:00Z",
"created_at": "2024-01-01T11:00:00Z"
},
"payment_url": "https://blaqpay.io/pay/550e8400-e29b-41d4-a716-446655440000"
} Step 3: Redirect Customer to Payment Page
Redirect your customer to the payment_url from the response. They’ll see a beautiful checkout page where they can complete the payment.
// JavaScript example
window.location.href = response.payment_url; Step 4: Handle Payment Confirmation
There are two ways to confirm a payment:
Option A: Webhooks (Recommended)
Set up a webhook endpoint to receive real-time notifications:
// Express.js example
app.post('/webhooks/blaqpay', (req, res) => {
const event = req.body;
if (event.event === 'transaction.completed') {
// Payment successful! Fulfill the order
console.log('Payment received:', event.transaction.id);
}
res.status(200).send('OK');
}); Learn more about webhooks.
Option B: Polling
Poll our API to check the transaction status:
curl https://blaqpay.io/api/transactions/550e8400-e29b-41d4-a716-446655440000
-H "Authorization: Bearer sk_test_YOUR_API_KEY" Step 5: Test the Integration
Use test mode by using a test API key (sk_test_...). In test mode:
- All transactions are marked as
testing_mode: true - Use testnet tokens for payments
- No real funds are involved
Code Examples
JavaScript/Node.js
const axios = require('axios');
const blaqpay = axios.create({
baseURL: 'https://blaqpay.io/api',
headers: {
Authorization: 'Bearer sk_test_YOUR_API_KEY',
'Content-Type': 'application/json'
}
});
// Create a transaction
const response = await blaqpay.post('/transactions/create', {
amount: 100.0,
order_description: 'Premium subscription',
customer_email: 'customer@example.com',
success_url: 'https://yoursite.com/success',
cancel_url: 'https://yoursite.com/cancel'
});
console.log('Payment URL:', response.data.payment_url); Python
import requests
API_KEY = 'sk_test_YOUR_API_KEY'
BASE_URL = 'https://blaqpay.io/api'
headers = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json'
}
# Create a transaction
response = requests.post(f'{BASE_URL}/transactions/create', headers=headers, json={
'amount': 100.00,
'order_description': 'Premium subscription',
'customer_email': 'customer@example.com',
'success_url': 'https://yoursite.com/success',
'cancel_url': 'https://yoursite.com/cancel'
})
data = response.json()
print(f"Payment URL: {data['payment_url']}") PHP
<?php
$apiKey = 'sk_test_YOUR_API_KEY';
$baseUrl = 'https://blaqpay.io/api';
$data = [
'amount' => 100.00,
'order_description' => 'Premium subscription',
'customer_email' => 'customer@example.com',
'success_url' => 'https://yoursite.com/success',
'cancel_url' => 'https://yoursite.com/cancel'
];
$ch = curl_init($baseUrl . '/transactions/create');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json'
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
echo "Payment URL: " . $data['payment_url'];
?> Next Steps
Congratulations! You’ve successfully integrated BLAQPAY. Here’s what to explore next:
- Set up webhooks for real-time notifications
- Explore the API with our interactive playground
- Learn about testing your integration
- Go live and switch to production mode
Need Help?
If you get stuck, we’re here to help:
- Check out our full documentation
- Try the API playground
- Email support@blaqpay.io
