Skip to content

Latest commit

 

History

History
51 lines (36 loc) · 1.96 KB

mollie_connect.md

File metadata and controls

51 lines (36 loc) · 1.96 KB

Mollie

Using Mollie Connect with Laravel Socialite (Oauth)

Mollie Connect allows you to create apps for Mollie merchants via OAuth.

Why should I use OAuth?

Mollie Connect is built on the OAuth standard. The OAuth connection enables you to access other merchants’ accounts with their consent, without having to exchange API keys. Whether you are just looking to improve your customers’ experiences, to automate essential business processes, or to whitelabel our platform completely, it is all possible with OAuth.

Our OAuth platform allows you to:

  • Create payments and refunds on behalf of merchants
  • Manage merchants’ website profiles
  • View a merchants’ transaction and settlement data
  • Show the next settlement and balance at Mollie in your app
  • Integrate merchants’ invoices from Mollie in your app
  • Charge merchants for payments initiated through your app (application fees)

Installation

Make sure the Laravel Socialite package is installed.

Then update config/services.php by adding this to the array:

'mollie' => [
    'client_id' => env('MOLLIE_CLIENT_ID', 'app_xxx'),
    'client_secret' => env('MOLLIE_CLIENT_SECRET'),
    'redirect' => env('MOLLIE_REDIRECT_URI'),
],

Then add the corresponding credentials (MOLLIE_CLIENT_ID, MOLLIE_CLIENT_SECRET, MOLLIE_REDIRECT_URI) to your .env file.

Example usage

Route::get('login', function () {
    return Socialite::with('mollie')
        ->scopes(['profiles.read']) // Additional permission: profiles.read
        ->redirect();
});

Route::get('login_callback', function () {
    $user = Socialite::with('mollie')->user();

    Mollie::api()->setAccessToken($user->token);

    return Mollie::api()->profiles->page(); // Retrieve payment profiles available on the obtained Mollie account
});