Table Of Contents

Testing

In sandbox environment, you can force the response given to payment attempts.

General guidelines

Our sandbox has its own antifraud checks, which means that if you want to try several payments, or do some load/concurrency testing, we recommend you to:

  • Use a random email address every time. To do so, the easiest is to use address tags. The most common way to do this is to append a ‘+’ to the local part of the email, followed by anything (like a timestamp), e.g. yourname+1395846197@yourmail.com.
  • Generate a random card number every time. (if what you’re testing are creditcard payments)
  • If you are using the server-2-server flow, generate a random IP for each request

Sample PHP code to generate random IPs

<?php

public function getRandomIp($publicOnly = true)
{
    // See http://en.wikipedia.org/wiki/Reserved_IP_addresses
    $reserved = array(0, 100, 127, 169, 198, 203, 224, 225, 226, 227, 228, 229, 230, 231,
                        232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
                        245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255);
    $skip = array_merge($reserved, $publicOnly?array(10, 172, 192):array());
    $ip = array();
    do {
        $ip[0] = rand(1, 255);
    } while (in_array($ip[0], $skip));
    $ip[1] = rand(0, 255);
    $ip[2] = rand(0, 255);
    $ip[3] = rand(0, 255);
    return implode('.', $ip);
}

Creditcard payments

  • Card Number: Any 16 digits card number starting with ‘4’ (VISA) or ‘5’ (Mastercard) that passes the LUHN test

  • Security Code: The validation follows the scheme of the card used, so any 3 digits for VISA/MC, or 4 digits for Amex

  • Expiration Date:
    • 01/2030
      • SUCCESS payment
    • 02/2030
      • FAILED payment
      • INSUFFICIENT_FUNDS reason
    • 03/2030
      • FAILED payment
      • SOFT_DECLINE reason
    • 04/2030
      • FAILED payment
      • HARD_DECLINE reason
    • 12/2030
      • ERROR mandate
    • 01/2028
      • SUCCESS payment
      • With 3DS redirection (This should be tested when implementing the server-2-server flow)
      • Note: 3DS must be enabled on the API configuration for the test
    • 02/2028
      • FAILED payment
      • With 3DS redirection (This should be tested when implementing the server-2-server flow)
      • Note: 3DS must be enabled on the API configuration for the test

Sample PHP code to generate fake card numbers

<?php

function isLuhnNum($num, $length=null) {
    if (empty($length)) {
        $length = strlen($num);
    }
    $tot = 0;
    for($i = $length - 1; $i >= 0; $i--) {
        $digit = substr($num, $i, 1);
        if ((($length - $i) % 2) == 0) {
            $digit = $digit*2;
            if ($digit > 9) {
                $digit = $digit-9;
            }
        }
        $tot += $digit;
    }
    return (($tot % 10) === 0);
}


function getCardNumber () {
    $cardNumber = str_pad('4'.rand('10', '99').date('U'), 15, '0', STR_PAD_RIGHT);
    for ($i=0; $i<10; $i++) {
        if (isLuhnNum($cardNumber.$i)) {
            return $cardNumber.$i;
        }
    }
    return null;
}

print getCardNumber() . "\n";

Sepa Direct Debit (SDD) payments

To test SDD mandates signatures and payments, you will need to use the SLMPFRP1 BIC code as well as a matching and syntactically valid IBAN starting with FR7616348000019. This IBAN must have a length of 27 characters.

Note that:

  • The zipcode provided on the payment page must be valid for the selected country.
  • The phone number provided must be recognized as a potentially valid mobile number but, unlike in production environment, will not be actually used to receive a confirmation code by SMS.

In order to generate such an IBAN for your tests, you can use the following PHP example:

<?php

function generateRandomIBAN() {
    $ibanNumber  = str_pad(48 + (97 * rand(1, 1000000)), 12, '0', STR_PAD_LEFT);
    return 'FR7616348000019' . $ibanNumber;
}

Once redirected to the mandate signature page, you will be prompted to enter a code received by SMS. Enter 0000 and tick the box that confirms that the provided information is accurate.

Once signed, you will be taken back to our confirmation page. If a payment was requested together with the mandate creation, the payment will be in WAITING status and will turn to SUCCESS automatically within the next hour. When this happens, a relevant event will be sent to your callback URL.

iDEAL payments

iDeal can be tested by providing different payment amounts giving a different result per amount value. Also note that iDEAL is not a recurring payment method, meaning that you will not be able to take further payments without having the customer inserting his bank details.

  • Payment amount:
    • SUCCESS payment with amount = 1.00
    • CANCELLED payment with amount = 2.00
    • FAILED payment with amount = 3.00 (expired failure category)
    • OPEN payment with amount = 4.00
    • FAILED payment with amount = 5.00

SOFORT banking

Sofort can be tested by using specific sort codes to represent the account’s country

  • Sort Code:
    • 88888888 - Germany
    • 999 - Belgium
    • 00000 - Other Countries