Accept crypto payments with the PHP SDK
The official CryptoPayr PHP SDK lets any PHP application accept Bitcoin, Ethereum, USDT and 30+ other cryptocurrencies. Create a payment, send the customer to the hosted checkout, and confirm the order from a signed webhook — no card data, no chargebacks, settlement to your USD wallet balance.
How to accept crypto payments with the PHP SDK
Follow these steps to start taking Bitcoin, Ethereum, USDT and 30+ other coins.
-
Install the SDK
Install with Composer using
composer require cryptopayr/cryptopayr-php, or drop the standalone file in andrequireit — the library works with or without Composer. -
Initialise the client
Create the client with your secret API key from Dashboard → Developers:
$cp = new CryptoPayr\Client('sk_live_…'); -
Create a payment
Call
$cp->payments->create([...])with the amount, currency and yourorder_idas metadata. You get back a transaction id and a hostedcheckout_url. -
Redirect to the hosted checkout
Send the buyer to the returned
checkout_url, where they pick a coin and pay. CryptoPayr handles the wallet address, network fees and confirmations. -
Verify the webhook
On your webhook endpoint, validate the
X-CryptoPayr-Signatureheader withCryptoPayr\Webhook::verify($body, $sig, $apiKey), then fulfil the order whenstatusisCOMPLETED.
Need the full reference? See the API & webhook documentation, or read about the crypto payment gateway.
Requirements & compatibility
- PHP 7.2 or newer (cURL + JSON)
- Composer or standalone — your choice
- A free CryptoPayr account & API key
- An HTTPS endpoint to receive webhooks
Frequently asked questions
Do I need Composer?
No. The SDK ships as a single standalone file you can require directly, and is also published on Packagist for Composer projects.
How do I prevent fake webhook calls?
Every webhook is signed with HMAC-SHA256 using your API key. The SDK's Webhook::verify() helper checks the signature so only genuine CryptoPayr events are processed.
Which coins can customers pay with?
Bitcoin, Ethereum, USDT, USDC, BNB, Litecoin and 30+ more across multiple networks. The buyer chooses at the hosted checkout.
Where can I see full code examples?
The complete reference lives in the API documentation, including payments, payouts, refunds, balances and live rates.