CPay PHP SDK
Accept USDT and USDC on any PHP website — a custom store, a SaaS billing page or a framework app. The SDK creates signed invoices on your server, sends the customer to the secure payment page and verifies the payment proof when the money arrives. Funds go straight to your wallet; nobody holds them in between.
- Package
dappcrypto/cpay(Composer)- Requirements
- PHP 8.0 or newer
- Wallets
- MetaMask, Trust Wallet
- Currencies
- USDT, USDC, ETH, BNB
- Networks
- Ethereum, BNB Smart Chain and more
- License
- MIT, open source
Why merchants choose it
- No KYC / no KYB. Your wallet address is your shop — no documents, no approval, no account freezes.
- Self-custody. Payments land in your own wallet the moment they are confirmed on-chain.
- Invoices signed locally. The signing key stays on your server and is never sent anywhere.
- Cryptographic confirmation. A webhook brings a proof you verify with one call — no trust in plain request parameters.
- AML check. The payer's wallet is screened before the payment.
- Small and open. One Composer package, MIT license, readable source code.
How it works
Your server creates an invoice
The SDK builds the invoice — order number, amount in USDT/USDC, start and deadline — and signs it with your shop account key.
The customer pays
You redirect the customer to the payment link. They pay from MetaMask or Trust Wallet on the network they choose.
The payment is confirmed
The payment service calls your webhook with a proof and sends the customer back to your success page.
You fulfil the order
getWebhook()orgetOrderData()verifies the proof. Mark the order as paid and ship.
Quick start
Create a shop
Make a new MetaMask account just for the shop. With it, create a shop at dappcrypto.github.io on every network you want to accept, and set the webhook and success page URLs.
Install the package
Run
composer require dappcrypto/cpayin your project.Create invoices at checkout
Call
CPay::instance()->createInvoice()with the shop address, your payout wallet, the order number and the amount. Redirect the customer toLinkInvoicefrom the result.Handle the webhook
On the webhook URL call
CPay::instance()->getWebhook($aRecipient). Whenerroris0, the order inorderData.nOrderis paid.Double-check on the success page
If the customer returns before the webhook arrives, call
getOrderData($aRecipient, $nOrder)to confirm the payment.
The README on GitHub has complete, copy-ready examples for each step: invoice creation, the webhook page and the success page.
Invoice fields
| Field | What it means |
|---|---|
aRecipient | Address of the shop account that registered the shop and signs invoices. |
aRecipientExt | Your payout wallet that receives USDT/USDC. Must be a different wallet. |
nOrder | Your order ID. Must be unique for the shop. |
nRToken | Amount in USDT/USDC, for example 1.50. |
nRType | Receive token type: 1 — USDT/USDC. |
start, deadline | Validity of the invoice as UTC Unix timestamps. |
nTax2, aTax2 | Optional partner commission: 100 = 1% to the aTax2 wallet. |
Two wallets, always
Use a separate shop account only to register and manage the shop and to sign invoices. Receive money on a different wallet whose private key you never put on a server. Mixing them can lead to loss of funds.
Keep the key out of your code
Store the shop account key in an environment variable or server config, never in a public repository or front-end code.
Supported networks
- Ethereum gas in ETH
- BNB Smart Chain gas in BNB
- Arbitrum gas in ETH
- Base gas in ETH
- Polygon gas in POL
Smart contract
Payment gateway (CPays)
Registers shops, accepts signed invoices, swaps the payment token and issues on-chain receipts.
| Network | Chain ID | Address | Version |
|---|---|---|---|
| Ethereum Mainnet | 1 | 0xfC462Cf46EFAaa0CF4FC715E9e686F252bc3fb2B | v1 |
| Binance Smart Chain Mainnet | 56 | 0xfC462Cf46EFAaa0CF4FC715E9e686F252bc3fb2B | v1 |
| Arbitrum One | 42161 | 0x75013B806bD872cF682237d41a7C713c3d6866FE | v1 |
| Base | 8453 | 0xb477a930e96F41B1263157839FA55CcA7A775f5e | v1 |
| Polygon Mainnet | 137 | 0x1480BB923fC06bc14d8d5D17a70d6A8fe559297e | v1 |
FAQ
Do I need a merchant account or an API key?
No. A CPay shop is created from your wallet in one transaction. The SDK needs only the shop account key to sign invoices.
What does it cost?
The SDK is free and open source. 99% of every payment goes to you and 1% is the DAppCrypto service fee; connecting a shop costs a one-time network fee.
Which PHP frameworks are supported?
Any. The SDK is a plain Composer package that works with Laravel, Symfony, WordPress, custom code and anything else on PHP 8.0+.
My store runs on a CMS. Do I need to code?
Not for OpenCart and WooCommerce — use the ready-made OpenCart extension or WooCommerce plugin. Both already bundle the SDK.
Start with a shopThe SDK signs invoices for a CPay shop. Create one with a dedicated MetaMask account, then use its key in the SDK.
Create your shop