Developerby BirrPay Engineering Team
Getting Started with BirrPay API: A Complete Guide
Getting Started with BirrPay API
This guide will walk you through integrating BirrPay into your application. You'll be accepting payments in minutes!
Prerequisites
- A BirrPay account (join our waitlist to be notified when the dashboard is ready)
- Your API keys from the dashboard
- Basic knowledge of REST APIs
- Any HTTP client (fetch, axios, curl, etc.)
Making Your First API Call
BirrPay uses a simple REST API that works with any HTTP client. Here's how to create a payment:
const response = await fetch('https://api.birrpay.io/payments', {
method: 'POST',
headers: {
'api-key': 'sk_test_your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 1000, // ETB in cents
currency: 'ETB',
description: 'Order #123',
customer: {
email: '[email protected]',
name: 'John Doe'
}
})
});
const payment = await response.json();
Using cURL
curl https://api.birrpay.io/payments \
-X POST \
-H "api-key: sk_test_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"amount": 1000,
"currency": "ETB",
"description": "Order #123"
}'
Handle Webhooks
app.post('/webhook', async (req, res) => {
const signature = req.headers['birrpay-signature'];
const payload = req.body;
// Verify webhook signature (implementation depends on your framework)
// if (verifySignature(payload, signature)) {
// Handle webhook event
// }
if (payload.type === 'payment.succeeded') {
// Handle successful payment
console.log('Payment succeeded:', payload.data);
}
res.status(200).send();
});
Generate SDKs
You can generate SDKs for your preferred language using our OpenAPI specification available in our documentation.
Next Steps
- Read our full documentation with API reference, guides, and examples
- Explore the API endpoints for detailed endpoint documentation
- Check out our code examples
- Join our developer community
Happy building! 🚀