- How do I install moip/moip-sdk-php in a Laravel application?
- Install it with Composer using composer require moip/moip-sdk-php. The library is a plain PHP client built on Guzzle and is not Laravel-specific, so it works in any Composer-based project. After installing, configure your Moip credentials and instantiate the client inside a service provider or a dedicated adapter class.
- Does moip/moip-sdk-php support Laravel 10 or Laravel 11?
- The SDK is framework-agnostic, so Laravel compatibility depends on whether its PHP, PSR, and Guzzle constraints resolve under your target version. Laravel 10 and 11 ship newer Guzzle releases, so run a Composer dependency audit before adopting. If the 3.x line still pins an older Guzzle major, isolate the SDK or test the upgrade on a branch first.
- Is there a Laravel service provider or facade for moip/moip-sdk-php?
- No. The package ships no service provider, publishable config, or facade; it remains a thin object-oriented wrapper over Moip's REST API. Most teams add their own service provider that binds a configured singleton and exposes a gateway interface. Keep SDK types out of controllers and Eloquent models so the rest of the application stays provider-agnostic.
- How do I create a customer and an order with the Moip SDK?
- Use the customers resource to create a customer with name, email, tax document, phone, and address, then use the orders resource to attach items, shipping, and the customer reference. Both calls map closely to Moip's REST endpoints and return objects you can persist references from. Wrap these flows in your own DTOs so domain code never depends on SDK classes directly.
- How do I charge a credit card or boleto with moip/moip-sdk-php?
- Create an order first, then submit a payment using the chosen method: credit card with hashed card data, boleto, or another supported instrument. Store the returned Moip payment ID and status so you can reconcile against webhooks later. Never log full card data; use Moip's client-side hashing approach to keep PCI scope minimal.
- How do I issue refunds and handle payment notifications with the SDK?
- Refunds are issued against a payment ID through the payments resource, either in full or partially depending on the API behavior. Notifications arrive as webhooks, so verify signatures and treat delivery as at-least-once by making handlers idempotent. Persist the event before processing so a failed handler can be safely replayed.
- Does moip/moip-sdk-php support OAuth for marketplace integrations?
- Yes, the SDK includes OAuth authentication support aimed at marketplace scenarios where you act on behalf of sellers. You exchange the authorization code for an access token and use it when calling Moip endpoints for each connected account. Confirm the current OAuth flow and scopes against Moip's documentation, since the SDK only wraps the API.
- How can I test Moip payments without hitting production?
- Use Moip's sandbox environment with separate credentials and point the client at the sandbox base URL. Unit tests should mock the HTTP layer, while a small set of sandbox end-to-end tests should cover order and payment flows. Never reuse production tokens or card data in CI.
- Is moip/moip-sdk-php still maintained?
- Recent tagged releases such as v3.1.0 show commits and fixes, which is a stronger signal than the previously archived state. One release is not a trend, though, so check release cadence, issue triage, and whether a named maintainer or organization owns the project. Keep the fork option as a contingency rather than the default plan.
- What risks and alternatives should I weigh before adopting moip/moip-sdk-php?
- The main risks are dependency resolution against your Laravel version, the absence of a published security disclosure process, and the possibility of bursty rather than sustained maintenance. Always wrap the SDK behind an adapter interface so you can fork or swap providers without touching domain code. In production, verify webhook signatures, enforce idempotency, and read the 2.x to 3.x changelog before upgrading.