1. Go to this page and download the library: Download cmpayments/orderapi-sdk-php 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/ */
cmpayments / orderapi-sdk-php example snippets
$client = new CMPayments\OrderApi\Client('<username>', '<password>');
$merchantOrderReference = time();
$paymentPreferences = new CMPayments\OrderApi\Requests\Elements\PaymentPreference();
$paymentPreferences->setProfile('<payment_profile>')
->setNumberOfDaysToPay(14)
->addPeriod(7, 'unknown')
->addPeriod(7);
$menuPreference = new CMPayments\OrderApi\Requests\Elements\MenuPreferences();
$menuPreference->setCssId(1);
$shopper = new CMPayments\OrderApi\Requests\Elements\Shopper();
$name = new CMPayments\OrderApi\Requests\Elements\Name();
$name->setFirstname('Testpersoon-nl')
->setLastname('Approved');
/* Note: date of birth must be a \DateTime */
$dateOfBirth = DateTime::createFromFormat('Y-m-d', '1970-07-10');
$shopper->setShopperId('<customer_id>')
->setName($name)
->setEmail('[email protected]')
->setLanguageCode('nl')
->setGender('M')
->setDateOfBirth($dateOfBirth)
->setPhoneNumber('0612345678');
$paymentMethodData = new CMPayments\OrderApi\Requests\Elements\PaymentInput\IdealPaymentInput();
$paymentMethodData->setIssuerId('RABO');
$shopperInfo = new CMPayments\OrderApi\Requests\Elements\ShopperInfo();
$shopperInfo->setBrowserAccept('*/*')->setBrowserUserAgent('notfound')->setShopperIp('10.0.0.1');
$startRequest = $client->createStartRequest($createResponse->createSuccess->key);
$startRequest->addPaymentAmount($paymentAmount) /* from above */
->addPaymentMethodData($paymentMethodData) /* from above */
->addReturnUrl('https://www.yourdomain.tld/return?status=redirect')
->addShopperInfo($shopperInfo)
->addIntegrationInfo(new CMPayments\OrderApi\Requests\Elements\IntegrationInfo('My webshop name or plugin', 'v1.0.0'));
$startResponse = $client->executeStartRequest($startRequest);
// Store the payment ID somewhere, you will need it later
$_SESSION['payment_id'] = $startResponse->startSuccess->paymentResponse->paymentSuccess->id
//In the response there is an redirect url to redirect the customer to
header('Location: ' . $startResponse->startSuccess->redirect->url);
//Create a proceeed request
$proceedRequest = $client->createProceedRequest(<payment_id>);
//Tell the request that it has to be an iDEAL proceed
$proceedRequest->Ideal();
//Execute the request
$proceedResponse = $client->executeProceedRequest($proceedRequest);