Mangopay api implementation for Symfony
Clone or download
Latest commit d7446b8 Sep 23, 2018


Gitter License Version Packagist DL SensioLabsInsight Twitter Follow



This bundle provides integration of the official SDK PHP for Mangopay api V2 into Symfony.


    client_id: your_mangopay_client_id
    client_password: your_mangopay_client_password
    base_url: your_mangopay_base_url

How to use it ?

The official sdk provides a "MangoMapApi" class which is a shortcut to all the "tools" like "ApiPayIns", "ApiWallets", "ApiUsers"... You can access those "tools" through the service "troopers_mangopay.mango_api".

    $payIn = new PayIn();


Additionnaly, there is some helpers that handle most of the mangopay actions. Feel free to fork and implement yours.


It can register user BankInformations as it implements BankInformationInterface

    $bankInformation = new BankInformation();


It can register a CardPreauthorisation and execute it

    $cardRegistration = new CardRegistration();

    $cardPreAuthorisation = new CardPreAuthorisation();
    $this->get('troopers_mangopay.payment_helper')->executePreAuthorisation($cardPreAuthorisation, $user, $wallet);


It can create a new direct payment

    $transaction = new Transaction();


It can create a new user in mangopay as the User object implements the UserInterface

    $user = new User();


It can create a user wallet

    $user = new User();

General workflow

This is the general workflow for the mangopay payment page:

  1. Displaying the payment form to user

Step 1

  1. Create mangopay user and the card registration through mangopay API

Step 2

  1. Call the tokenisation server to validate the user credit card, use 3d secure if needed, update the CardR egistration with tokenized Card, create the PreAuthorisation then redirect the user to success page. Step 3