bitpay/sdk
Official BitPay PHP SDK for integrating Bitcoin and crypto payments into Laravel/PHP apps. Create and manage invoices, handle payment notifications, and access merchant APIs with a clean, Composer-installable client.
What the package is. bitpay/sdk is BitPay's first-party PHP client for its REST API: key-pair generation, token/pairing flow, invoice creation and retrieval, refunds, payouts, ledger and settlement endpoints. It is a transport-and-crypto wrapper, not a framework component — no Laravel service provider, no facades, no config publishing.
Architecture fit. Good, provided it is kept at the edge. The SDK maps cleanly onto a hexagonal boundary: a CryptoPaymentGateway interface in the domain, a BitPayAdapter implementing it, and SDK value objects confined to the adapter/infrastructure layer. Do not let BitPay invoice payloads leak into Eloquent models or controllers — the token/key model and the "invoice" lifecycle are vendor-specific and will not survive a provider swap. The main architectural friction is that the SDK owns its own HTTP transport and error model, so retry, circuit-breaking, and observability policies must be re-implemented or wrapped rather than inherited from Laravel's HTTP client.
Integration feasibility. Straightforward mechanically: composer require bitpay/sdk, a singleton binding, a config file, and encrypted credential storage. Real effort sits in non-code prerequisites:
.env or VCS" enforcement.Technical risk. Ranked:
composer why-not before committing. Crypto primitives depend on ext-openssl behavior across PHP minors.Key questions for the vendor/team.
Stack fit. Laravel 9–11 / PHP 8.1+ is a comfortable host. Recommended shape:
| Layer | Component |
|---|---|
| Config | config/bitpay.php (env-driven, secrets referenced by vault key, not inline) |
| Binding | BitPayServiceProvider registering an authenticated client singleton |
| Domain port | CryptoPaymentGateway interface (createInvoice, getInvoice, refund) |
| Adapter | BitPayAdapter translating SDK objects ↔ domain DTOs |
| Persistence | crypto_payments table: invoice id, fiat amount, crypto amount/asset, rate, expiry, status, raw payload |
| Ingress | POST /webhooks/bitpay — signature/IP check, persist-then-dispatch, queued job |
| Reconciliation | Scheduled command polling non-terminal invoices every N minutes |
| Resilience | Wrapped transport with timeouts, bounded retries, circuit breaker, structured logging |
Migration path. Additive, not invasive:
CryptoPaymentGateway port and retro-fit the existing card/PSP integration behind it first, so BitPay is a second implementation rather than a special case.Compatibility checks. Pin the major version exactly; run the full composer why-not bitpay/sdk diff against the current lockfile; run CI against the lowest and highest supported PHP minors; verify OpenSSL and CA bundle behavior in the container image, not just locally.
Sequencing (suggested ~6–8 weeks elapsed, ~2–3 engineer-weeks of build).
created → paid → confirmed → settled | expired | invalid), reconciliation job.Maintenance. Low code churn, non-trivial domain churn. The SDK surface is small, but the crypto domain is not: new assets, network upgrades, fee-market shifts, and BitPay policy changes will generate work independent of package releases. With 42 stars and no dependents, we are the de facto QA function — budget an owner, a version-upgrade cadence each quarter, and a monitoring task on the upstream repo and changelog. Assume a fork-and-patch capability is required, and keep the adapter thin enough that a fork stays viable.
Support. This is the largest hidden cost. Customers will hit wallet-compatibility issues, network fees exceeding the purchase value, invoice expiry mid-checkout, and underpayment. Support needs written playbooks for: expired-but-paid, paid-below-quote, paid-after-expiry, duplicate payment, and refund-request. Refunds require an outbound payout with manual review — a workflow, not an API call. Expect higher contact rate per transaction than card payments.
Scaling. Compute cost is negligible: no nodes, no chain indexing, no local wallet. Bottlenecks are BitPay API rate limits on invoice creation, webhook ingress burst capacity (queue-backed, autoscaled), and the reconciliation job's cursor discipline at volume. All manageable. The genuine scaling constraints are financial, not technical: settlement latency, liquidity/conversion, and treasury exposure if crypto is held rather than converted at receipt.
Failure modes to design for.
Ramp-up. For a competent Laravel engineer, the SDK itself is 2–3 days of learning — it is a thin REST wrapper and the README covers the pairing flow. The real ramp is the ~2 weeks of crypto payment operations literacy: confirmation semantics, volatility handling, refund mechanics, and reconciliation. Add non-engineering ramp: Finance needs a settlement reconciliation process, Legal needs jurisdiction and sanctions review, and Support needs the exception playbooks. Plan for a single named owner with a documented secondary, because institutional knowledge on a 42-star dependency will not arrive from the community.
Bottom line for a TPM. Technically low-risk to integrate, operationally medium-risk to run, and strategically gated on BitPay account approval and Finance/Legal sign-off rather than on the package. The low adoption numbers argue for keeping the adapter thin and the exit cheap — but as a first-party, MIT-licensed wrapper behind a clean port, it is an acceptable dependency if crypto payments are a genuine product requirement rather than an experiment.
How can I help you explore Laravel packages today?