iDEAL Advance PHP Integration

iDEAL Advance PHP integration is not that tough but it will be tough when you miss documentation. Before you begin to write code, read “iDEAL_General_EN_v2.1.pdf”, Topic 3.4. Below is summery diagram.

You should be aware of general configuration part before you can begin this portion of code. Read Topic 3.3 in “iDEAL_Advanced_PHP_EN_V2.2.pdf”.

In brief it works in following way:

  1. Make directory request (Get Bank list, Issuer list is what they called)
  2. Make Transaction Request and redirected to iDEAL/bank)
  3. Make Status Request (This is after iDEAL/bank redirect to webshop)

1) Directory Request

Directory Request means you are fetching Issuer List (List of banks) from iDEAL. This is list of banks which are associated with iDEAL and making payment from these banks is possible. Below is code, how can you fetch Issuer List:

  1. $ideal_connector = new iDEALConnector();
  2. $response = $ideal_connector->GetIssuerList();
  3.  
  4. if ($response->errorMessage)
  5. {
  6.  $errorCode = $response->getErrorCode();
  7.  $errorMsg = $response->getErrorMessage();
  8.  $consumerMessage = $response->getConsumerMessage();
  9. }
  10. else
  11. {
  12.  $IssuerList =& $response->getIssuerFullList();
  13. }

If you see line number 3, I have made little bit changes. Original iDEAL document has

  1. if ( ! $response ) {,

There’s no way that $response is false on failure because $ideal_connector->GetIssuerList() returns ErrorRespose Object. So when error is returned by Get $ideal_connector->IssuerList(), you’ll encounter error in next line i.e. $response->getIssuerFullList() because ErrorResponse object do not have getIssuerFullList().

Once you fetch Issuer Lists (Banks), let end user select his/her bank. HTML code looks like below:

  1. <form method="post" action="" id="form1" name="form1">
  2. <td valign="top" class="form-label">
  3.  
  4.      <select name="bank">
  5.   <option value="">Select Your Bank</option>
  6.   <?php foreach($banks as $bank): ?>
  7.      <option value="<?php echo $bank->issuerID ?>"><?php echo $bank->issuerName ?></option>
  8.   <?php endforeach; ?>
  9.      </select>
  10.  </td>
  11.  <td>
  12.     <input class="btn" type="submit" name="submit2" value="Make Your Payment" id="submit2">
  13. </td>
  14. </form>

Note: It is suggested to save issuer list in local cache and run DirectoryRequest query once in 24 hour.

Transaction Request
End user will select banks (issuer is what they called) and submit form. Now you have to make Transaction request and redirect issuer’s website. Code looks like below

  1. $ideal_connector = new iDEALConnector();
  2. $response = $ideal_connector->RequestTransaction($issuerId,$purchaseId,$amount,$description,$entranceCode);
  3. if($response->transactionID)
  4. {
  5.  $url = $response->getIssuerAuthenticationURL();
  6.  header("Location:".$url);
  7. }

After this, end user login to his bank and make payment. On successful, iDEAL/bank redirect customer to webshop again (you have to define redirect page in config, they call it MerchantReturnURL).

Parameters for RequestTransaction():
IssuerId: the ID of the issuer the consumer has selected from the pick list
PurchaseId: the purchase number according to the online shop’s system
Amount: the amount in whole cents (no decimals; 1 Euro = 100)
Description: the description of the product
EntranceCode: a code determined by the online shop with which the purchase can be
authenticated upon redirection to the online shop (see section 4.2.2 for details).
(optional) ExpirationPeriod: if different from the configured value.
(optional) MerchantReturnURL: if different from the configured value.

Status Request
When iDEAL/bank redirect end user to webshop, it will automatically add two parameters entranceCode and TransactionId. entranceCode is hold by ec variable and TransectionId is hold by trxid variable. So, you have TransactionId (trxid) in landing page, you should make status request. If you do not make status request, payment will not be guaranteed. Following is code to make status request:

  1. $connector = new iDEALConnector();
  2. $transactionId = $_GET['trxid'];
  3. $response = $connector->RequestTransactionStatus($transactionId);
  4. if ($response->errorMessage)
  5. {
  6.  $errorCode = $response->getErrorCode();
  7.  $errorMsg = $response->getErrorMessage();
  8.  $consumerMessage = $response->getConsumerMessage();
  9. } else {
  10.  $status =& $response->getStatus();
  11.  
  12.  if ($status === IDEAL_TX_STATUS_SUCCESS )
  13.  {
  14.   $consumerName = $response->getConsumerName();
  15.   $consumerAccNumber = $response->getConsumerAccountNumber();
  16.   $consumerCity = $response->getConsumerCity();
  17.  }
  18. }

(Issue request can be made manually from iDEAL Dashboard as well).

iDEAL Basic (ING Bank) Integration

iDEAL Basic integration method is different from iDEAL Advance. Sumit Bankskota has provided code for basic integration, thanks Sumit. Below is complete code, try on your own:

  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  4. </head>
  5. <body>
  6. <FORM METHOD="post" ACTION="https://idealtest.secure-ing.com" name="frm1" id="frm1">
  7. <INPUT type="hidden" NAME="merchantID" value="xxxxxxx" />
  8. <INPUT type="hidden" NAME="subID" value="0" />
  9. <INPUT type="hidden" NAME="amount" VALUE="xxxxx" />
  10. <INPUT type="hidden" NAME="purchaseID" VALUE="xxxx" />
  11. <INPUT type="hidden" NAME="language" VALUE="nl" />
  12. <INPUT type="hidden" NAME="currency" VALUE="EUR" />
  13. <INPUT type="hidden" NAME="description" VALUE="iDEAL Basic purchase" />
  14. <INPUT type="hidden" NAME="itemNumber1" VALUE="xxxx" />
  15. <INPUT type="hidden" NAME="itemDescription1" VALUE="xxxxx" />
  16. <INPUT type="hidden" NAME="itemQuantity1" VALUE="xxxx" />
  17. <INPUT type="hidden" NAME="itemPrice1" VALUE="xxxxx" />
  18. <INPUT type="hidden" NAME="paymentType" VALUE="ideal" />
  19.  
  20. <INPUT type="hidden" NAME="validUntil" VALUE=" 2009-01-01T12:00:00:0000Z" />
  21.  
  22. <input type="hidden" name="PSPID" value="PSP-id" />
  23.  
  24. <input type="hidden" name="accepturl" value="http://www.hosturl.nl/path/accept_url.php" />
  25. <input type="hidden" name="declineurl" value="http://www.hosturl.nl/path/decline_url.php" />
  26. <input type="hidden" name="exceptionurl" value="http://www.hosturl.nl/path/exception_url.php" />
  27. <input type="hidden" name="cancelurl" value="http://www.hosturl.nl/path/cancel_url.php" />
  28. <input type="hidden" name="homeurl" value="http://www.hosturl.nl/home">
  29.  
  30. <input type="submit" value="Bevestig bestelling" id="submit2" name="submit2" />
  31. </form>
  32. </body>
  33. </html>

Parameter values in hidden control are hypothetical (dummy). So you need to replace with right values.

For iDEAL Advance, click this link.

If you have done for any other Bank or other way, let me know.

iDEAL payment – ING Bank – iDEAL Advance Integration

It’s always not easy to work with payment gateway service as each gateway service has different of configuration options, parameters. Lastly, I found iDEAL as weired/tough. You will hardly find documentation in English. So, I thought share idea how I did configure iDEAL Advance using PHP (ING bank).

In summery, it takes following steps to setup iDEAL Advance:

  1. Registration
  2. Integration
  3. Run mandatory test cases in iDEAL test environment
  4. iDEAL approve test cases and contract (you should sign up contract)
  5. Live account has to be activated (See below Mandatory Test)
  6. So, your live sale can be done in iDEAL.

Follow details steps below:

  1. Login to iDEAL/ING Dashboard (Given below are URL for dashboard)
    Test environment: https://idealtest.secure-ing.com
    Production environment: https://ideal.secure-ing.com
    Note: Merchant ID and Login name is same for both test and live. But password is different for live and test.
  2. Once you login, first thing you need to go to Document link. There you can download documentation and Advance integration code. Documentation is available in English and Dutch.
    Important Downloads:
    a) iDEAL General – Introduction and procedure (Click on link to get manual)
    b) iDEAL Advanced Integration Manual PHP (Click on link to get manual)
    c) iDEAL Advanced Integration Code PHP (Sorry,  no links, ups!!)
    Note: You should be aware about registration process. Look “Registration process (2)” in iDEAL General – Introduction and procedure
  3. To integrate Advance iDEAL in PHP, follow instruction in “iDEAL Advanced Integration Manual PHP”, there are lot of steps you should follow carefully. In summery:
    1) Generate private key using openSSL
    2) Generate certificate using private key.
    3) Upload certificate to configuration (Login to iDEAL dashboard -> Go to sign up process -> Click on Configuration tab)
    4) Change params value in config.conf which available in /includes/security.
    5) Also you should edit iDEALConnector_config.inc.php if you move security folder then then default.
  4. Upload scripts (PHP Advanced Code)
  5. Run 6 tests in iDEAL test environment. Wait for iDEAL response on your test.  (See below Mandatory Test)
  6. iDEAL has to set live account activate. Now your gateway is ready!!

Mandatory Test:

You should run mandatory test before you can set iDEAL live. Look “Registration process (2)” in iDEAL General – Introduction and procedure. It’s not easy to setup online store to configure to meet test suite requirement. Hence, you can use iDEAL Tester, which you can download from http://www.ideal-simulator.nl/ideal-professional-tester.html.

Once you download scripts, make changes on idealprofessional.cfg.php file which is located inside library folder. Upload scripts to server and access it http://<host>/ideal-professional-tester/index.php

You can confirm tests status from iDEAL dashboard.

  1. Login to Dashboard (test and live has different dashboard)
  2. Click on Sign up Process
  3. Click on Status (You’ll see following screen if test successes).

    iDEAL mandatory test results

    iDEAL mandatory test results

  4. Once you finish test suits, iDEAL will activate live account. It may take several hours, so I suggest you to call their support dept. and ask them to activate (it speed up).
  5. Once they activate your live account, your live dashboard looks different as given below.

iDEAL live dashboard (after activated)
Note: You should run this test on same domain where your online store will resides.

Note: this post describe process how to integrate iDEAL Adanced (ING Bank) using PHP APIs.

Configuring iDEAL basic is very easy which works with post method by redirecting URL to their gateway.

If you have done for any other Bank or other way, let me know.

Update: for iDEAL Basic click this link