birkof/netopia-mobilpay
NETOPIA Payments API integration for Laravel/PHP. Composer-ready mirror of the official MobilePay PHP_CARD library with PSR-0 autoloading, helping you work with NETOPIA/MobilPay card payments using a familiar upstream codebase.
Spatie\Payment\Payment or Laravel Cashier) or as a standalone service.MobilpayPaymentService).MobilpayTransactionRepository.MobilpayPaid, MobilpayFailed events for async processing (e.g., inventory updates, notifications).hmac signature) and idempotency (prevent replay attacks). Laravel’s middleware (VerifyMobilpaySignature) or queue listeners can handle this.mobilpay_transactions (status, amount, metadata, webhook_data).mobilpay_webhook_logs (for replay safety).Mobilpay\Payment\Request and Mobilpay\Payment\Invoice.https://sandbox.mobilepay.dk) with Guzzle HTTP interceptors.| Risk | Mitigation | Owner |
|---|---|---|
| Deprecated API | Wrap library calls in an adapter pattern (e.g., MobilpayApiClient). |
Backend Engineer |
| Webhook Security | Implement HMAC validation middleware + rate-limiting (e.g., throttle:60,1). |
Security Engineer |
| Idempotency Gaps | Add idempotency_key to transactions; reject duplicates via MobilpayTransaction::where(). |
Backend Engineer |
| Error Handling | Centralize exceptions (e.g., MobilpayException) with Sentry integration. |
DevOps/Backend |
| OpenSSL 3.0+ Compatibility | Test with PHP 8.3+ and validate aes-256-cbc + IV handling. |
QA Engineer |
| Multi-Currency Support | Extend Invoice class to support DKK, EUR, SEK; validate with MobilePay’s API limits. |
Product/Backend |
MobilpayRetryJob with jitter (e.g., sleep(rand(1, 5))).MobilpayTransaction events to a message broker (e.g., Laravel Echo + Pusher).Invoice class or use Laravel’s Money package.Spatie\CircuitBreaker) with fallback logic.MobilpayService as a singleton or context-bound instance.ext-openssl must be enabled).monolog/monolog for structured logging.Cashier::addGateway('mobilpay')).MobilpayGateway).| Phase | Tasks | Dependencies | Owner |
|---|---|---|---|
| 1. Setup | Install package + configure .env (merchant ID, secret, certificates). |
Composer, MobilePay sandbox access. | Backend Engineer |
| 2. Core | Create MobilpayService facade and MobilpayTransaction model. |
Database schema. | Backend Engineer |
| 3. Webhooks | Implement /mobilpay/webhook route + HMAC validation middleware. |
Service layer. | Backend/Security |
| 4. Payment Flow | Add MobilePay to checkout (e.g., CheckoutController). |
Webhook setup. | Frontend/Backend |
| 5. Testing | Test sandbox transactions + webhook validation. | All prior. | QA Engineer |
| 6. Monitoring | Set up Laravel Telescope for transaction logs + Sentry for errors. | CI/CD pipeline. | DevOps |
| 7. Go-Live | Switch from sandbox to production API (secure.mobilepay.dk). |
Staging validation. | Product/DevOps |
ramsey/uuid or symfony/polyfill for older Laravel versions./v1/payments → /v2/payments).Cashier::addGateway('mobilpay')).sandbox.YOUR-SIGNATURE.public.cer).composer require birkof/netopia-mobilpay..env:
MOBILPAY_MERCHANT_ID=your_merchant_id
MOBILPAY_SECRET=your_secret_key
MOBILPAY_PUBLIC_CERT=/path/to/sandbox.YOUR-SIGNATURE.public.cer
MOBILPAY_PRIVATE_KEY=/path/to/sandbox
How can I help you explore Laravel packages today?