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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-sdk

PolyPay PHP SDK

Accept cryptocurrency payments (USDT, USDC, etc.) on any PHP website via PolyPay.

ไธญๆ–‡

Features

Requirements

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 resource and method. If your application is behind a proxy, pass the canonical public URL to verifyAndSettle($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:

License

MIT License. See LICENSE for details.


ๅฎ‰่ฃ…

้€š่ฟ‡ Composer๏ผˆๆŽจ่๏ผ‰

ๆ‰‹ๅŠจๅฎ‰่ฃ…

ไธ‹่ฝฝ SDK ๅนถๅผ•ๅ…ฅ่‡ชๅŠจๅŠ ่ฝฝๆ–‡ไปถ๏ผš

ๅฟซ้€Ÿๅผ€ๅง‹

ๆ›ดๅคš็คบไพ‹่ฏทๅ‚่€ƒ examples/ ็›ฎๅฝ•ใ€‚


All versions of php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ponponpay/php-sdk contains the following files

Loading the files please wait ...