Download the PHP package ponponpay/php-sdk without Composer
On this page you can find all versions of the php package ponponpay/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ponponpay/php-sdk
More information about ponponpay/php-sdk
Files in ponponpay/php-sdk
Package php-sdk
Short Description PonponPay Crypto Payment Gateway - Official PHP SDK
License MIT
Homepage https://ponponpay.com
Informations about the package php-sdk
PolyPay PHP SDK
Accept cryptocurrency payments (USDT, USDC, etc.) on any PHP website via PolyPay.
ไธญๆ
Features
- ๐ Simple Setup โ Just provide your API Key
- ๐ Framework Agnostic โ Works with any PHP project (Laravel, WordPress, custom, etc.)
- ๐ฆ Zero Dependencies โ Pure PHP with cURL, no external packages required
- ๐ Webhook Verification โ Built-in HMAC-SHA256 signature validation with replay protection
- ๐ค Agent Payments โ x402 helper for API/resource payments by agents
- ๐ฐ Multi-Currency โ Support USDT, USDC on Tron, Ethereum, BSC, Polygon, Solana
Requirements
- PHP >= 7.4
- ext-curl
- ext-json
Installation
Via Composer (Recommended)
Manual Installation
Download the SDK and include the autoloader:
Quick Start
1. Initialize
Sandbox Testing
Use a sandbox API key that starts with sk_sandbox_ to create sandbox orders:
The API base URL stays the same. PolyPay separates production and sandbox data by the API key environment. Sandbox orders use SB... trade IDs and virtual payment addresses, and you can simulate payment states from the merchant dashboard.
2. Redirect to Hosted Checkout with API Key Mode
PolyPay returns a signed hosted checkout URL such as:
PolyPay displays the payment method selection page. If your site already has a confirmed payment method, pass currency and network to skip selection and go directly to the payment page:
Use PolyPay::buildCheckoutUrl() only when you already manage Public Key hosted checkout parameters yourself:
3. Create an Order with API Key Mode
For normal merchant checkout, prefer hosted checkout so PolyPay owns payment method selection.
4. Query Order
5. Handle Webhook Callback
6. Protect an API with x402 Agent Payments
API Reference
PolyPay Class
| Method | Description | Returns |
|---|---|---|
createCheckoutUrl(array $params) |
Request a signed hosted checkout URL with API Key Mode | string |
buildCheckoutUrl(array $params, array $options = []) |
Build a Public Key signed hosted checkout URL manually | string |
generateCheckoutSignature(array $params, string $publicKey) |
Generate hosted checkout signature | string |
getPaymentMethods() |
Get available payment methods | PaymentMethod[] |
createOrder(array $params) |
Create a payment order | Order |
getOrderByTradeId(string $tradeId) |
Query order by trade ID | Order |
getOrderByMchOrderId(string $mchOrderId) |
Query order by merchant order ID | Order |
getMerchantDetail() |
Get merchant info | Merchant |
activatePlugin(string $type) |
Activate plugin | bool |
webhook(?NonceStorageInterface $nonce) |
Create webhook handler (shares API Key) | WebhookHandler |
x402(array $options) |
Create x402 agent payment helper | X402 |
x402 Resource Options
| Parameter | Required | Description |
|---|---|---|
payTo |
โ | Merchant EVM wallet address receiving USDC |
resource |
โ | Canonical protected resource URL |
price |
โ * | Human-readable price, e.g. $0.01 |
maxAmountRequired |
โ * | USDC base-unit amount; required if price is omitted |
method |
โ | Protected HTTP method |
description |
โ | Description shown to agents |
mimeType |
โ | Resource MIME type |
scheme |
โ | Defaults to exact |
network |
โ | Defaults to eip155:8453; supported: eip155:8453, eip155:1, eip155:137 |
asset |
โ | Defaults to USDC |
assetContract |
โ | Defaults to the network-specific Circle USDC contract |
maxTimeoutSeconds |
โ | Defaults to 60 |
x402 verification binds the payment to
resourceandmethod. If your application is behind a proxy, pass the canonical public URL toverifyAndSettle($headers, $method, $url)so it matches the URL advertised in the 402 requirement.
Supported standard x402 networks:
| Network | Chain | USDC Contract |
|---|---|---|
eip155:8453 |
Base | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
eip155:1 |
Ethereum | 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 |
eip155:137 |
Polygon | 0x3c499c542cef5e3811e1192ce70d8cc03d5c3359 |
Only standard EVM exact payments with Circle USDC transferWithAuthorization are supported. BSC, Tron, Solana, TON, and BTC are not part of this standard exact flow.
createOrder Parameters
| Parameter | Required | Description |
|---|---|---|
mch_order_id |
โ | Your unique order ID |
currency |
โ | Cryptocurrency: USDT, USDC |
network |
โ | Network: tron, ethereum, bsc, polygon, solana |
amount |
โ | Payment amount (in fiat currency) |
notify_url |
โ | Webhook callback URL |
redirect_url |
โ | URL to redirect after payment |
Order Model Properties
| Property | Type | Description |
|---|---|---|
tradeId |
string |
PolyPay trade ID |
paymentUrl |
string |
Payment page URL |
amount |
float |
Order amount |
actualAmount |
float |
Actual crypto amount |
address |
string |
Payment address |
expiresAt |
?int |
Expiry timestamp (Unix) |
currency |
string |
Cryptocurrency |
network |
string |
Network |
status |
string |
Order status |
txHash |
string |
Transaction hash |
mchOrderId |
string |
Merchant order ID |
Webhook Callback Status Codes
| Status Code | Meaning | Resolved Status |
|---|---|---|
| 1 | Pending payment | pending |
| 2 | Payment successful | paid |
| 3 | Expired | expired |
| 4 | Cancelled | cancelled |
| 5 | Manual recharge | paid |
Configuration Options
Custom Nonce Storage
By default, the webhook handler uses file-based nonce storage. For high-traffic scenarios, implement NonceStorageInterface with Redis:
Error Handling
Examples
See the examples/ directory for complete, runnable examples:
create_order.phpโ Create a payment orderquery_order.phpโ Query order statuswebhook.phpโ Handle payment callbackpayment_methods.phpโ List available methodshosted_checkout.phpโ Redirect to hosted checkoutpayment_page.phpโ Hosted checkout redirect example
License
MIT License. See LICENSE for details.
ๅฎ่ฃ
้่ฟ Composer๏ผๆจ่๏ผ
ๆๅจๅฎ่ฃ
ไธ่ฝฝ SDK ๅนถๅผๅ ฅ่ชๅจๅ ่ฝฝๆไปถ๏ผ
ๅฟซ้ๅผๅง
ๆดๅค็คบไพ่ฏทๅ่ examples/ ็ฎๅฝใ
All versions of php-sdk with dependencies
ext-curl Version *
ext-json Version *