Code Examples
Ready-to-use code examples in multiple programming languages to help you integrate with Pixlpay quickly.
Quick Start Examples
Get started with our API in your preferred language:
- PHP - Laravel, vanilla PHP
- Node.js - Express, vanilla Node
- Python - Flask, requests
- Go - net/http, gorilla
Use Case Examples
Real-world integration patterns:
- Order Fulfillment - Auto-deliver purchases
- Inventory Sync - Keep products in sync
- Analytics Dashboard - Custom reporting
Common Patterns
API Client Pattern
All examples follow this pattern:
PixlpayClient
├── Authentication (Bearer token)
├── Request handling (with retry logic)
├── Error handling (typed exceptions)
└── Response parsing (typed objects)Webhook Handler Pattern
1. Receive raw request body
2. Verify HMAC signature
3. Parse JSON payload
4. Process event asynchronously
5. Return 200 OK immediatelyInstalling SDKs
PHP (Composer)
bash
# Coming soon - official SDK
# For now, use Guzzle or cURL
composer require guzzlehttp/guzzleNode.js (npm)
bash
# Coming soon - official SDK
# For now, use axios or fetch
npm install axiosPython (pip)
bash
# Coming soon - official SDK
# For now, use requests
pip install requestsEnvironment Setup
Store your credentials securely:
bash
# .env file
PIXLPAY_API_TOKEN=your_api_token_here
PIXLPAY_WEBHOOK_SECRET=whsec_your_secret_here
PIXLPAY_STORE_URL=https://yourstore.pixlpay.netNever commit credentials to version control!