mangopay/php-sdk-v2
Mangopay PHP SDK is a client library for the Mangopay REST API, letting PHP developers integrate payment flows, wallets, and transactions. Requires PHP 5.6+, cURL, OpenSSL, and psr/log; installable via Composer.
ApiExtendedPreauthorizations (exposed as $api->ExtendedPreauthorizations) as a deliberate mirror of the existing deposits API, so the mental model, method surface (Create(), Get(), Update(), GetAllForUser(), GetAllForCard(), GetTransactions()), and error behaviour are consistent with what the team already knows.Get(), Update(), and GetAllForUser() return either a PayPalExtendedPreauthorization or an ExtendedPreauthorization depending on how the preauthorization was created. This is an implicit type-dispatch that Laravel services must handle explicitly (instance checks or a mapped DTO), otherwise downstream code will hit type errors that surface only for PayPal-originated records.ExtendedPreauthorizationStatus (CREATED, SUCCEEDED, FAILED) is a bounded, PHP 8.1-friendly enum that maps cleanly to Eloquent enum casts, unlike the older DepositStatus class-constant pattern.EventType. This is a webhook-contract change, not an SDK-call change — the risk sits in the Laravel webhook consumer, not in the package.MangopayServiceProvider binding remains valid. No new configuration keys are required, though the team may want a feature flag (e.g. services.mangopay.preauthorization_mode) to gate the deposits → extended-preauthorization cutover per environment.ApiDeposits, DepositStatus, Transaction::$DepositId, and ApiPayIns::CreatePayInDepositPreauthorizedWithoutComplement() all still function but are marked for removal in a future major version. This is a scheduled migration, not an emergency.ApiPayIns::CreatePayInExtendedPreauthorized() opens the extended-preauthorized PayIn flow (full capture) without requiring a deposit object first — a genuine product capability, not just a rename.ProfilingAttemptReference on UserNaturalSca and UserLegalSca is an optional field that lets the platform pass its own profiling/KYC attempt reference into Mangopay, improving reconciliation between internal onboarding records and vendor-side SCA checks.ApiDeposits and Transaction::$DepositId. Any persisted deposit_id column, report, or reconciliation job becomes technical debt with an unknown expiry.EventType values will now fail on 18 new constants the moment Mangopay starts emitting them.TemporaryFolder still needs a Laravel filesystem abstraction and periodic cleanup.Transaction::$DepositId anywhere (columns, ledgers, exports)? Renaming to ExtendedPreauthorizationId needs a schema migration and a reconciliation-window plan, not just a code change.PayPalExtendedPreauthorization vs ExtendedPreauthorization — a mapped internal DTO, or an interface check at the boundary?EventType values gracefully? If not, that change should ship before Mangopay begins emitting extended-preauthorization and settlement events.SETTLEMENT_* events in scope for this quarter's reconciliation work, or explicitly deferred? Scope creep here is easy to absorb silently.ProfilingAttemptReference something we can populate from existing KYC records, or does it require a new identifier?.env vs config/services.php vs secrets manager), mTLS certificate custody, rate-limit monitoring against Mangopay's ~1000 req/min, and idempotency-key handling on retries all remain open.app/Services/MangopayExtendedPreauthorizationService alongside the existing deposit service during the transition, then retire the deposit service once traffic is fully cut over.ExtendedPreauthorization and PayPalExtendedPreauthorization into local models. Cast ExtendedPreauthorizationStatus via Eloquent's enum cast (PHP 8.1 backed enum) rather than string comparison.App\Support\Mangopay\Preauthorization) that both SDK entity types collapse into, so controllers and jobs never branch on vendor class names.switch statements over EventType with a lookup table (config/mangopay-events.php or an enum-keyed handler map) that resolves to a job class and has an explicit default that logs and acknowledges.ExtendedPreauthorizationStatus, and every new EventType constant — these are the paths most likely to be untested.mangopay4/php-sdk to ^5.1 and ship the "unknown event type is logged, not thrown" change before enabling anything new. This is the cheapest risk reduction available.$api->ExtendedPreauthorizations and ApiPayIns::CreatePayInExtendedPreauthorized(). No new deposits code is written.Transaction::$DepositId → $ExtendedPreauthorizationId schema migration and run both fields in parallel through one reconciliation cycle.ExtendedPreauthorizationId should follow, not precede, the service-layer cutover, so the old column remains readable during rollback.^5.1 and monitor Mangopay's changelog for the major that removes deposits. Treat the deprecation list as a tracked backlog item with an owner, not a comment in code.ApiDeposits, Deposits->, DepositStatus, DepositId, and CreatePayInDepositPreauthorizedWithoutComplement and record every hit as a migration ticket. This is a finite, enumerable list — which makes the effort estimable.config/services.php as before, adding a mode flag for the preauthorization cutover so the same codebase serves sandbox, staging, and production with different behaviour.php artisan mangopay:clean-temp; extended preauthorizations do not change the SDK's temp-folder usage.EventType values as configuration so adding a handler is a config change plus a job, not a code edit buried in a controller.App\Exceptions\Handler as before for ResponseException, and add explicit handling for type mismatches in polymorphic preauthorization responses so they surface as actionable alerts rather than generic 500s.EventType values with the raw payload retained for one cycle. This turns a potential outage into a backlog item.CREATED → SUCCEEDED/FAILED) and for settlement events received per day, so a silently broken webhook route is visible without waiting for a merchant to report a missing payment.Create → Get → CreatePayInExtendedPreauthorized), so effective request volume per checkout rises modestly.PayPalExtendedPreauthorization returned where only the standard type is handled — fails only on PayPal traffic, so it needs dedicated fixtures rather than hoping sandbox coverage catches it.ExtendedPreauthorizationStatus value, a strict enum cast will throw. Decide now whether unknown statuses are logged-and-mapped or hard failures.DepositId will silently under-count.How can I help you explore Laravel packages today?