Skip to content

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:

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 immediately

Installing SDKs

PHP (Composer)

bash
# Coming soon - official SDK
# For now, use Guzzle or cURL
composer require guzzlehttp/guzzle

Node.js (npm)

bash
# Coming soon - official SDK
# For now, use axios or fetch
npm install axios

Python (pip)

bash
# Coming soon - official SDK
# For now, use requests
pip install requests

Environment 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.net

Never commit credentials to version control!

Built for game developers, by game developers.