PHP code example of shivella / ideal-bundle

1. Go to this page and download the library: Download shivella/ideal-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shivella / ideal-bundle example snippets

 php

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Usoft\IDealBundle\UsoftIDealBundle(),
    );
}
 php

// Acme/Bundle/OrderController.php

public function paymentAction(Request $request)
{   
    $form = $this->createForm(IdealType::class);
    $form->handleRequest($request);

    if ($form->isValid()) {
    
        $mollie = $this->get('mollie');
        $bank = new Bank($form->get('bank')->getData());
        $amount = (float) 120.99;

        return $mollie->execute($bank, $amount, 'route_to_confirm_action');
    }
    
    return $this->render('payment.html.twig', ['form' => $form->createView()]);
}

/**
 * @Route("/order/confirm", name="route_to_confirm_action")
 *
 * @param Request $request
 */
public function confirmAction(Request $request)
{
    if ($this->get('mollie')->confirm($request)) {
        // handle order....
    } else {
        // Something went wrong...
    }
}