Requirements
- PHP 8.1+
- Composer
Installation
Install the SDK with Composer:Configuration
The SDK loads configuration in this order:- Config array passed to
Client - Environment variables
- Default base URL
Environment variables (recommended)
Create a.env file in your project root:
.env to version control.
Passing config manually
You can pass options when creating the client:Quick start (plain PHP)
Authentication
All Merchant API requests use:Products API
The merchant is inferred from your secret key. The SDK uses these endpoints:List products
Create product
Get product
Update product
Delete product
Checkout sessions (Merchant API)
Use checkout sessions for backend-driven flows (e.g. WooCommerce-style plugins). Endpoints:POST /merchant-api/{merchant_id}/checkout-sessions— create sessionGET /merchant-api/{merchant_id}/{session_id}— get/verify session
Create checkout session
Verify checkout session
Laravel usage
.env
Add to your.env:
config/services.php
Register the PkPayPlus config:Example usage
Testing
The SDK ships with:- Unit tests — mocked HTTP
- Integration tests — real API (opt-in)
Run unit tests
Integration tests (real API)
Integration tests are skipped unless you enable them. Add to.env:
Common errors
Missing secret key
Ensure your environment has:Security notes
- Never expose your secret key in frontend or client-side code.
- Use the publishable key for client-side checkout.
- Use the secret key only on the backend.
