quantumtecnology/pagarme-sdk
A lightweight Laravel/PHP SDK for the Pagar.me payment gateway, offering a simple integration layer for transactions, customers, cards, plans, subscriptions, and webhooks. Add Brazilian payment processing to your app quickly with a fluent API and Laravel service provider support.
Architecture fit. The package is a thin, community-built PHP SDK that wraps Pagar.me's REST API — the Brazilian payment gateway. Typical of this genre, it likely ships a Laravel service provider and facade (Pagarme::class) that registers config, credentials, and a Guzzle-based HTTP client. For a Laravel codebase already on Composer, this is a natural-shaped dependency: one line to install, a published config file for the public/secret keys, and facades or injected services for charges, customers, transactions, and possibly recipients/splits. It fits the "payment integration" slot cleanly, provided we accept it is a client library and not a business-logic layer. The SDK does not own reconciliation, ledgering, or idempotency semantics for us — those stay in our domain.
Integration feasibility. Feasibility is high in the narrow sense and low in the confidence sense. High: it is a standard Composer package with an MIT license, so procurement and legal are trivial; no native extensions, no daemons, no infra. Low: with 0 stars and 0 dependents there is essentially no community signal that the package matches the current Pagar.me API surface (v4 vs. v5 has been a meaningful breaking change in the ecosystem), no evidence of test coverage, and no visible CI. The decisive feasibility question is not "does it install" but "does it map to the API version our Pagar.me account is provisioned on."
Technical risk. Ranked by severity:
Key questions for the spike.
Stack fit. Works as a drop-in for a Laravel application on a supported PHP version. The integration seams are predictable: composer require, publish config, set PAGARME_SECRET_KEY in the environment, and inject the client where needed. The SDK should live behind an internal port — a PaymentGateway interface with methods our domain cares about (authorize, capture, refund, createSubscription, handleWebhook) — with the SDK as the concrete adapter. That adapter boundary is the single highest-leverage decision here; it caps the blast radius if we later swap to Pagar.me's official SDK, another community package, or direct REST.
Migration path. Two paths, depending on outcome of the spike:
Avoid the anti-pattern of calling the facade directly from controllers. Payment integrations that skip the port become the hardest thing in the codebase to change.
Compatibility. Verify three axes before committing: Pagar.me API version alignment, PHP/Laravel constraint compatibility with our lockfile, and Guzzle/PSR-7 version agreement with packages already in the graph. Run composer why-not against our current dependencies during the spike.
Sequencing.
PaymentGateway interface against our domain, not the SDK's.Maintenance. Treat this as a vendored dependency with a maintenance tax, not a utility. Budget for: monitoring the upstream repo for commits, a quarterly audit against Pagar.me's changelog, and a standing decision to fork if upstream goes quiet for two consecutive quarters. The MIT license makes the fork option legally trivial — the cost is engineering, not legal. Assign an explicit owner (one engineer, named) so this doesn't drift.
Support. No commercial SLA, no vendor relationship. Support is GitHub issues on a zero-star repo, which in practice means self-support. Escalation for SDK bugs is "we fix it," and that needs to be priced into the roadmap. Pagar.me's own support will not cover third-party SDKs.
Scaling. Most of the scaling surface belongs to Pagar.me's API, not the SDK: rate limits, idempotency keys, and connection pooling. The SDK's contribution is whether the HTTP client is configurable enough to set timeouts, retries with backoff, and a shared connection pool. Audit for a hardcoded timeout — community SDKs frequently ship with none or with a 60-second default that stalls request workers under load. Also confirm the SDK does not hold state across requests that would break under Octane or horizontal scaling.
Failure modes to plan for.
Ramp-up. Low-to-moderate. Any Laravel engineer can call the facade in an afternoon. The real ramp is domain knowledge: Pagar.me's model (transactions vs. charges, capture semantics, split rules, PIX lifecycle, settlement timing) and the SDK's abstraction leaks — the places where it doesn't cleanly expose what the API offers. Plan for one engineer to own the payment domain and write the runbook, with a second engineer able to operate the canary and rollback. Two to three weeks of one person's time gets a competent integration; the operational maturity (reconciliation, alerting on failure rates, dispute handling) is a longer, ongoing commitment.
TPM recommendation. Do not adopt on the strength of the package alone — zero adoption means zero validation. Run the spike, wrap it in a port, and treat the fork as a live option from day one. If the spike shows API-version alignment and reasonable code quality, adopt with the wrapper; if not, consume Pagar.me's REST API directly or use their official SDK and skip this dependency entirely.
How can I help you explore Laravel packages today?