aporat/store-receipt-validator
A Laravel/PHP package for validating Apple App Store receipts, including auto-renewable subscriptions and StoreKit purchases. It supports sandbox and production environments, provides a simple API, helps verify transactions, and adds secure receipt validation to your app's backend.
Architecture fit: This is a framework-agnostic PHP receipt-validation library, not a Laravel-native billing platform. It fits best as an infrastructure adapter behind a domain service such as PurchaseVerificationService, with normalized result DTOs for Apple, Google, and Amazon. Controllers, jobs, and webhooks should never call the library directly. In a Laravel app, bind the adapter through a service provider, configure credentials through config/services.php plus a secrets manager, and keep entitlement decisions in application-owned domain logic.
Integration feasibility: Composer-based installation should be straightforward for a standard Laravel/PHP stack. The real effort is not package installation but correct store-specific behavior: product/package/bundle ID checks, sandbox vs production handling, subscription state mapping, replay protection, idempotency, and separation of receipt validation from entitlement persistence. Confirm whether the library supports current Apple App Store Server API/StoreKit 2 patterns or only legacy verifyReceipt; similarly confirm Google Play Developer API and Amazon RVS coverage.
Technical risk: The supplied metadata has no repository URL, which is a due-diligence gap. Stars and Apache-2.0 licensing are positive signals, but they do not prove active maintenance, security posture, or store API currency. Main risks are stale store integrations, undocumented response edge cases, credential-handling mistakes, unclear HTTP client coupling, and accidental reliance on client-supplied receipt data without server-side ownership checks. Treat it as a validation component, not an entitlement, fraud, refund, or subscription-lifecycle system.
Key questions: Does it support Apple App Store Server API and StoreKit 2 JWS transactions, or only legacy receipt validation? Does it handle Google Play real-time developer notifications and Amazon RVS notifications, or only pull-based validation? What PHP/Laravel versions and HTTP clients are supported? Are responses normalized across stores? How are sandbox/production environments selected? Does it expose raw store responses for audit? What is the upstream release, issue, and security-patch cadence? Are there known gaps for subscriptions, refunds, revocations, and family sharing?
Stack fit: Good fit for a Laravel/PHP backend that already owns purchase records and entitlements. Wrap the library in an application service with one interface and three store adapters. Keep provider credentials out of code and never expose them to mobile clients. Persist normalized transaction records keyed by store, environment, original transaction ID or purchase token, product ID, and user/account ID.
Migration path: Start with a time-boxed spike against sandbox purchases for all three stores. Implement the wrapper and feature flag before replacing any existing verification path. Run shadow validation in parallel with the current process, compare outcomes, and only then make the new path authoritative. Keep a rollback switch to the existing verifier or manual review queue.
Compatibility: Verify PHP version, Laravel support, PSR/HTTP client compatibility, and required extensions such as OpenSSL, JSON, and cURL. If the package does not support dependency injection for its HTTP client, isolate it behind the adapter so future replacement is contained. Confirm response formats for legacy Apple receipts, StoreKit 2 transactions, Google purchase tokens, and Amazon receipts before designing database fields.
Sequencing: First complete upstream due diligence and store-API coverage review. Second build the adapter contract, config, and normalized DTOs. Third validate sandbox purchases and error cases. Fourth add persistence, idempotency, and audit logging. Fifth run shadow mode in production. Sixth enable by cohort with monitoring and rollback. Seventh add renewal/refund/revocation handling through store notifications or scheduled reconciliation rather than relying solely on receipt validation.
Maintenance: The package becomes part of the purchase-critical path, so assign an internal owner. Track upstream releases, security advisories, and store API changes. The supplied last-release date should be verified against the actual repository. Budget recurring work for credential rotation, sandbox account upkeep, store console configuration, and response-schema drift.
Support: Create runbooks for invalid receipts, duplicate transactions, store outages, expired Google service accounts, Apple shared-secret rotation, Amazon credential issues, and sandbox/production mismatches. Support teams need clear distinction between “receipt invalid,” “store unavailable,” and “valid receipt but entitlement mismatch.” Log sanitized receipt metadata and correlation IDs, never full secrets or unnecessary personal data.
Scaling: The library is likely stateless, so scaling depends on outbound HTTP calls, store rate limits, queue capacity, and database idempotency. Use async jobs with backoff for non-interactive verification and reconciliation. Apply per-store timeouts, circuit breakers, and bounded retries. Cache only safe, short-lived verification results keyed by transaction identity; do not let caching mask refunds, revocations, or subscription state changes.
Failure modes: Expect store API outages, throttling, malformed or unexpected responses, expired credentials, sandbox/production confusion, replayed receipts, duplicate purchase tokens, subscription renewals not reflected by one-time validation, refunds/revocations, and legacy Apple receipt gaps. Design each as a first-class state with retry, manual review, or reconciliation paths rather than a generic validation failure.
Ramp-up: A Laravel/PHP developer can integrate the package quickly, but correct production use requires store billing knowledge. Plan for one to two engineering weeks for a careful adapter, sandbox validation, persistence, and monitoring in a typical app, plus additional time for subscriptions, notifications, reconciliation, and fraud controls.
How can I help you explore Laravel packages today?