Bank code list

In order to display the iDeal payment form to your customers, you must first get a list of the available banks that participate in the iDeal program. The idealBankCodes method in the REST wrapper was created with this in mind.

First, you must query PayLane for the bank list:

1
2
3
4
5
6
7
8
9
10
11
12
 try {
    $status = $client->idealBankCodes();
  }
  catch (Exception $e) {
    // handle exception
  }
 
  if (!$client->isSuccess()) {
    $error_number = $status['error']['error_number'];
    $error_description = $status['error']['error_description'];
    // handle error
  }
1
2
3
4
5
begin
  status = client.ideal_bank_codes()
rescue PayLane::ClientError => e
  # handle exception here
end
1
2
3
4
5
6
try:
  status = client.ideal_bank_codes()
except Exception, e:
  # handle exception
  print e
  sys.exit()

Now you can display the payment options to your customer, which will differ based on your programming stack. Here’s a general example:

1
2
3
4
5
6
7
<select name="bank-code">
  <?php
    foreach ($status['data'] as $bank) {
      echo sprintf('<option value="%s">%s</option>', $bank['bank_code'], $bank['bank_name']), "\n";
    }
  ?>
</select>
1
2
3
4
5
6
7
8
9
10
if client.success?
  status['data'].each do |bank|
    # inject the returned bank data into your payment form, example:
    puts '<option value="%s">%s</option>' % [bank['bank_code'], bank['bank_name']]
  end
else
    puts "Error number: #{status["error"]["error_number"]}, \n"\
         "Error description: #{status["error"]["error_description"]}"
    exit
end
1
2
3
4
5
6
7
if client.is_success():
  for bank in status['data']:
    # inject the returned bank data into your payment form, example:
    print '<option value="%s">%s</option>' % (bank['bank_code'], bank['bank_name'])
else:
    sys.exit('Error number: ' + str(status["error"]["error_number"]) + '\n' \
             'Error description: ' + str(status["error"]["error_description"]))

After the form is submitted you should follow the documentation of the ideal/sale method, which will allow you to complete the payment process.