In sandbox environment, you can force the response given to payment attempts.
General guidelines
Our sandbox has its own anti-fraud 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);
}