mangopay/php-sdk-v2
PHP SDK for the MANGOPAY REST API v2.01+. Provides a client to authenticate and interact with MANGOPAY endpoints (payments, users, wallets, transfers, etc.). Install via Composer (mangopay4/php-sdk). Requires PHP 5.6+, cURL, OpenSSL.
ApiPayIns deposit-preauthorized PayIn methods – The following methods have been deprecated in favour of new names aligned with the API resource (/payins/deposit-preauthorized/...). The old methods still work but will be removed in a future major version. The new methods have the same functionality, only the naming is changed:
ApiPayIns::CreateCardPreAuthorizedDepositPayIn() (#795) → use ApiPayIns::CreatePayInDepositPreauthorizedWithoutComplement() instead.ApiPayIns::CreateDepositPreauthorizedPayInWithoutComplement() → use ApiPayIns::CreatePayInDepositPreauthorizedWithoutComplement() instead.ApiPayIns::CreateDepositPreauthorizedPayInPriorToComplement() → use ApiPayIns::CreatePayInDepositPreauthorizedPriorToComplement() instead.ApiPayIns::CreateDepositPreauthorizedPayInComplement() → use ApiPayIns::CreatePayInDepositPreauthorizedComplement() instead.ApiPayIns recurring PayIn methods (#794) – The following methods have been deprecated in favour of new names and a unified creation entry point. The old methods still work but will be removed in a future major version:
ApiPayIns::CreateRecurringRegistration() → use ApiPayIns::CreateRecurringPayInRegistration() instead.ApiPayIns::GetRecurringRegistration() → use ApiPayIns::GetRecurringPayInRegistration() instead.ApiPayIns::UpdateRecurringRegistration() → use ApiPayIns::UpdateRecurringPayInRegistration() instead.ApiPayIns::CreateRecurringPayInRegistrationCIT() → use ApiPayIns::CreateRecurringPayIn() instead.ApiPayIns::CreateRecurringPayInRegistrationMIT() → use ApiPayIns::CreateRecurringPayIn() instead.ApiPayIns::CreateRecurringPayPalPayInCIT() → use ApiPayIns::CreateRecurringPayIn() instead.ApiPayIns::CreateRecurringPayPalPayInMIT() → use ApiPayIns::CreateRecurringPayIn() instead.PayPalDepositPreauthorization entity (extends Deposit) with PayPal-specific fields (PaypalPayerID, PaypalOrderID, BuyerFirstname, BuyerLastname, BuyerPhone, BuyerCountry, PaypalBuyerAccountEmail, CancelURL, Trackings, ShippingPreference, Reference, LineItems, RedirectURL, ReturnURL, DataCollectionId). New method ApiDeposits::CreatePayPalDepositPreauthorization() (POST /deposit-preauthorizations/payment-methods/paypal) with optional $idempotencyKey.
ApiDeposits::Get / Cancel / Update / GetAllForUser now automatically hydrate PayPal deposits as PayPalDepositPreauthorization (instead of the base Deposit type), so PayPal-specific fields are accessible without any extra casting.RecurringPayInRegistration entity returned by the new registration methods (with Status, ResultCode, ResultMessage, CurrentState, RecurringType, TotalAmount, CycleNumber, AuthorId, CreditedUserId, CreditedWalletId, Billing, Shipping, EndDate, Frequency, FixedNextAmount, FractionedPayment, FreeCycles, FirstTransactionDebitedFunds, FirstTransactionFees, NextTransactionDebitedFunds, NextTransactionFees, ProfilingAttemptReference, PaymentType, CardInfo, CardId, Migration, PaymentData).ApiPayIns::CreateRecurringPayInRegistration(), ApiPayIns::GetRecurringPayInRegistration(), and ApiPayIns::UpdateRecurringPayInRegistration() methods returning the new RecurringPayInRegistration type.ApiPayIns::CreateRecurringPayIn() method which dispatches to the correct endpoint based on the PayIn's PaymentType / ExecutionType, replacing the per-scheme CIT/MIT methods.POST /payins/payment-methods/applepay/recurring.POST /payins/payment-methods/googlepay/recurring.Report.DateFilterBy (#787) – New optional DateFilterBy property on Report to control which date field the report filter applies to.LocalAccount extra bank-identifier fields (#793) – Added BankCode (4-digit bank code), BSBCode (6-digit Bank State Branch code), and BCNumber (5-digit bank clearing number). Existing properties (Iban, Bic, AchNumber, FedWireNumber, AccountType, BranchCode, InstitutionNumber) gained inline doc comments; behavior unchanged.ApiRecipients::GetUserRecipients() honours the Pagination argument; no API change.GetSubObjects() mappings across response and request DTOs. Properties that were previously returned as raw stdClass are now hydrated as typed Mangopay entities. Code that read those nested properties as plain objects (e.g. via array-style access, property_exists, or by passing them to functions that expect stdClass) must be updated to use the typed classes. Affected classes:
BankingAliasIBAN (LocalAccountDetails → LocalAccountDetailsBankingAlias)BanksByCountry (Banks → Bank[])CardPreAuthorization (added BrowserInfo → BrowserInfo, Shipping → Shipping)CardValidation (added CardInfo → CardInfo)Check (Data, Reasons → CheckData[])Conversion (DebitedFunds, CreditedFunds, Fees → Money; RequestedFees → CustomFees; ConversionRateResponse → ConversionRate; MarginsResponse → MarginsResponse)ConversionQuote (DebitedFunds, CreditedFunds → Money; Fees, RequestedFees → CustomFees; ConversionRateResponse → ConversionRate; UserMargin → UserMargin; MarginsResponse → MarginsResponse)CreateClientWalletsInstantConversion (DebitedFunds, CreditedFunds → Money)CreateInstantConversion (DebitedFunds, CreditedFunds → Money; Fees → CustomFees; UserMargin → UserMargin)IdentityVerification (Checks → Check[])InstantPayout – now extends Libraries\Dto; UnreachableReason → FallbackReasonIntentSplits (Splits → PayInIntentSplit[])InternationalAccountDetails (Address → VirtualAccountAddress, Account → InternationalAccount)LocalAccountDetails (Address → VirtualAccountAddress, Account → LocalAccount)MarginsResponse (Mangopay, User → UserMargin)PayIn (AuthenticationResult → AuthenticationResult)PayInExecutionDetailsExternalInstruction (DebitedBankAccount → DebitedBankAccount)PayInIntent (LineItems → PayInIntentLineItem[]; Captures → PayInIntentCapture[]; Capture → PayInIntentCapture; Refunds → PayInIntentRefund[]; Refund → PayInIntentRefund; Disputes → PayInIntentDispute[]; Dispute → PayInIntentDispute; Splits → PayInIntentSplitInfo[])PayInIntentCapture, PayInIntentDispute, PayInIntentRefund, PayInIntentSplitInfo (LineItems → PayInIntentLineItem[])PayInPaymentDetailsBlik (BrowserInfo → BrowserInfo)PayInPaymentDetailsCard (BrowserInfo → BrowserInfo, Shipping → Shipping)PayInRecurringRegistration (FirstTransactionDebitedFunds, FirstTransactionFees, NextTransactionDebitedFunds, NextTransactionFees → Money; Billing → Billing; Shipping → Shipping)PayInRecurringRegistrationGet (CurrentState → RecurringPayInCurrentState)PayInRecurringRegistrationRequestResponse (TotalAmount → Money)PayInRecurringRegistrationUpdate (Shipping → Shipping, Billing → Billing)PayOutEligibilityRequest (DebitedFunds, Fees → Money)PayOutEligibilityResponse (InstantPayout → InstantPayout)RecurringPayInCIT (BrowserInfo → BrowserInfo; DebitedFunds, Fees → Money)RecurringPayInCurrentState (CumulatedDebitedAmount, CumulatedFeesAmount → Money)RecurringPayInMIT (DebitedFunds, Fees → Money)RecurringPayPalPayInCIT (Shipping → Shipping)RecurringPayPalPayInMIT (DebitedFunds, Fees → Money; Shipping → Shipping)Report (Filters → ReportFilters)ReportRequest (Filters → FilterReports)ScaStatus (ConsentScope → ConsentScope)SettlementValidation (FooterErrors → SettlementValidationFooter[]; LinesErrors → SettlementValidationLine[])SupportedBank (Countries → BanksByCountry[])VirtualAccount (LocalAccountDetails → LocalAccountDetails; Capabilities → VirtualAccountCapabilities; see InternationalAccountDetails fix below)VirtualAccountAvailabilities (Collection, UserOwned → VirtualAccountAvailability[])VirtualAccount.InternationalAccountDetails type fix (#790) – The VirtualAccount.$InternationalAccountDetails property is now correctly typed as InternationalAccountDetails[] (an array) instead of a single InternationalAccountDetails object, matching the API response. Code that previously accessed this property as a single object (e.g. $virtualAccount->InternationalAccountDetails->Iban) must be updated to iterate the array (e.g. $virtualAccount->InternationalAccountDetails[0]->Iban).GetObjectForIdempotencyUrl updated with missing/corrected mappings; previously unmapped POST endpoints now return typed entities instead of stdClass. Several API methods were missing the $idempotencyKey parameter; it has been added as an optional last argument to ApiPayIns::CreateDepositPreauthorizedPayIn, ApiConversions::Create, ApiDeposits::Create, ApiBankingAliases::Create, and ApiUsers::ValidateTheFormatOfUserData.ApiPayIns::CreatePayconiq(), PayInPaymentDetailsPayconiq, PayInPaymentType::Payconiq, and the related URL keys from ApiBase.ApiAcquiring class ($api->Acquiring) with CreatePayIn, CreatePayPalDataCollection, CreatePayInRefund, and CreateCardValidation methods supporting Card Direct, iDEAL, Apple Pay, Google Pay, and PayPal.PreferredCardNetwork field on card pay-in payment details.SettlementId field on report filters.LineItem discount (#781) – Discount support added to LineItem objects used in Klarna pay-ins.https://github.com/Mangopay/mangopay4-php-sdk/pull/779/changes/011296e13901bd6ece848d9f052de9f93dd43346
On POST Create a Payout, platforms can now request to pay all SWIFT fees using the OUR value of the new ChargeBearer property (API release note):
ChargeBearer paramAuthenticationResult.AuthenticationType response property is now returned on card pay-inshttps://github.com/Mangopay/mangopay4-php-sdk/pull/779/changes/e69cc7af27f9384c3d02bac91774b21f76061035
To support the TelephoneOrder property on POST Create a Recurring PayIn (MIT) and POST Create a Recurring PayIn (CIT):
PaymentCategory param#771 To support percentage-based FX fees (API release note):
CreateInstantConversion.Fees type is now CustomFees instead of Money, to support the new FX fees structure of Type (PERCENTAGE | FIXED) and ValueConversionQuote.Fees type is now CustomFees instead of Money, to support the new FX fees structure of Type (PERCENTAGE | FIXED) and ValueRequestedFees to ConversionQuote and Conversion#771 To support the FX user margin (API release note):
UserMargin to CreateInstantConversion and ConversionQuoteMarginsResponse to Conversion and ConversionQuote#767
To support the new behavior of the POST Create a Settlement endpoint to obtain an UploadUrl:
settlement_sample.csv and testsFileName and UploadUrl to SettlementGenerateSettlementUploadUrl interfaceupload method in ApiSettlements with GenerateUploadUrlupdate method in ApiSettlements with GenerateNewUploadUrl#767 To support the GET View validations for a Settlement endpoint:
SettlementValidation, SettlementValidationFooter, SettlementValidationLine classesGetValidations method to ApiSettlements#767 To support the PUT Cancel a Settlement endpoint:
Cancel method to ApiSettlements#768
SplitOriginWalletId to PayInIntentLineItem, PayInIntentSplit
#761UnfundedSellerAmount to PayInIntentLineItemUnfundedAmount to PayInIntent#763 To support POST Create a Refund of an Intent:
Refund and Capture to PayInIntentCreatePayInIntentRefund method to ApiPayins#763 To support POST Reverse the Refund of an Intent:
ReversePayInIntentRefund method to ApiPayins#763 To support POST Create a Dispute of an Intent:
Dispute to PayInIntentCreatePayInIntentDispute method to ApiPayins#763 To support PUT Update an Intent Dispute:
Decision to PayInIntentUpdatePayInIntentDisputeOutcome method to ApiPayins#760
LocalPayInAvailable and InternationalPayInAvailable in VirtualAccountCapabilities classSCA_CONTACT_INFORMATION_UPDATE_CONSENT_GIVEN, SCA_CONTACT_INFORMATION_UPDATE_CONSENT_REVOKED, SCA_TRANSFER_CONSENT_GIVEN, SCA_TRANSFER_CONSENT_REVOKED, SCA_RECIPIENT_REGISTRATION_CONSENT_GIVEN, SCA_RECIPIENT_REGISTRATION_CONSENT_REVOKED, SCA_VIEW_ACCOUNT_INFORMATION_CONSENT_GIVEN, SCA_VIEW_ACCOUNT_INFORMATION_CONSENT_REVOKED, SCA_EMAIL_VERIFIED, SCA_PHONE_NUMBER_VERIFIED (#765) (thank you @williamdes)RecipientId property on payouts (API release note) (#759)Release PR: #770
ScaContext on POST Create a Recipient for platforms taking action by proxy with consent from the user (API release note, #753)USER_NOT_PRESENT value for ScaContext (API release note, #751)ScaContext request parameter newly added on all user POST and PUT endpoints, enabling the platform to request these actions with USER_NOT_PRESENT – provided the proxy is in place, activated, and the user has given consent (API release note, #750 )Licensor property on GET View a Client (#749 )x-tenant-id deprecated as no longer necessary for UK platforms; the parameter is ignored by Mangopay (#749 )RecipientVerificationOfPayee and sub-properties) on the endpoints GET View a Recipient, POST Create a Recipient, POST Create a Payout (API release note, #739)ProfilingAttemptReference on all payment methods for Mangopay's Fraud Prevention solution #743INTENT_AUTHORIZED,INTENT_CAPTURED,INTENT_REFUNDED,INTENT_REFUND_REVERSED,INTENT_DISPUTE_CREATED,INTENT_DISPUTE_DEFENDED,INTENT_DISPUTE_WON,INTENT_DISPUTE_LOST,INTENT_SETTLED_NOT_PAID,INTENT_PAID,SPLIT_CREATED,SPLIT_PENDING_FUNDS_RECEPTION,SPLIT_AVAILABLE,SPLIT_REJECTED,SPLIT_REVERSED #742VirtualAccountPurpose on Banking Alias object #745Fees on ConversionQuote #736 (thank you @pkly #647)GetSchema #732 (#717 thanks for raising @tarsFromTesseract).⚠️Caution – Potentially breaking The new
GetSchematypings may result in a breaking change if your integration relies on thestdClassreturned previously.
PendingUserAction nullable #730 (#726 thanks for raising @williamdes)Support for new Splits endpoints for Echo (#727, API release note):
New ReportTypes for Echo (#728, API release note)):
ECHO_INTENTECHO_INTENT_ACTIONECHO_SETTLEMENTECHO_SPLITSku parameter on LineItem, for Klarna PayInsEndpoints for Mangopay Echo, a solution for platforms working with another third-party PSP for funds acquisition (including via the Mirakl Connector) #720 :
SCA_ENROLLMENT_SUCCEEDEDSCA_ENROLLMENT_FAILEDSCA_ENROLLMENT_EXPIREDUserCategory change (API release note ):
USER_CATEGORY_UPDATED_TO_OWNERUSER_CATEGORY_UPDATED_TO_PAYERUSER_CATEGORY_UPDATED_TO_PLATFORMPLATFORM value to UserCategory enumPendingUserAction cast to \MangoPay\PendingUserAction instead of stdClass (thanks for raising @renanwingly #713)Endpoints for new Reporting Service feature:
Webhook event types for new Reporting Service:
REPORT_GENERATEDREPORT_FAILEDSupport for GET List Disputes for a PayIn endpoint.
RecipientScope query parameter on GET List Recipients for a UserStatus enum value on Identity Verification object changed from OUTDATED to OUT_OF_DATEEvent types for user account webhooks, relevant to SCA enrollment in user endpoints and account closure:
USER_ACCOUNT_VALIDATION_ASKEDUSER_ACCOUNT_ACTIVATEDUSER_ACCOUNT_CLOSEDEvent types for instant and quoted FX conversions:
INSTANT_CONVERSION_CREATEDINSTANT_CONVERSION_SUCCEEDEDINSTANT_CONVERSION_FAILEDQUOTED_CONVERSION_CREATEDQUOTED_CONVERSION_SUCCEEDEDQUOTED_CONVERSION_FAILEDSupport for 30-day deposit preauthorization features:
NO_SHOW_REQUESTED on updateDeposit method for PUT Cancel a Deposit Preauthorization or request a no-showThe following endpoints have been refined following the beta phase, and are now generally available:
Checks in response)The previously available endpoint GET View Checks for an IDV Session has been removed (as Checks were integrated into the GET by ID).
See the guide for more details.
The Country property has been added to Recipients, as a required query parameter on GET View the schema for a Recipient and as a required body parameter on POST Validate data for a Recipient and POST Create a Recipient.
ScaContext query parameter added on wallet access endpoints for the introduction of SCA:
If SCA is required, Mangopay responds with a 401 response code. The PendingUserAction RedirectUrl is in the dedicated WWW-Authenticate response header.
See the tests for examples on handling this error.
RECIPIENT_ACTIVERECIPIENT_CANCELEDRECIPIENT_DEACTIVATEDScaContext body parameterPendingUserAction response field containing RedirectUrlPAYIN_NORMAL_PROCESSING_STATUS_PENDING_SUCCEEDED webhook event typeRTGS_PAYMENT for PayoutModeRequested on POST Create a PayoutPaymentType value PAYPAL on Recurring PayIn Registrations and new endpoints (POST Create a Recurring PayPal PayIn (CIT) and POST Create a Recurring PayPal PayIn (MIT)SDKVersion (Language/LanguageVersion)TotalAmountNew endpoints for strong customer authentication (SCA) on Owner users:
New endpoint for Payconiq:
Rate limiting headers interpreted dynamically based on X-RateLimit-Reset time and for a variable number of bucket values.
New endpoints for hosted Identity Verification and relevant webhooks:
New endpoint for The Swish PayIn object:
New endpoints for client wallet conversations:
Revised tests to improve reliability and address any outdated tests.
How can I help you explore Laravel packages today?