Test Mode
FasterPay has a Sandbox environment called Test Mode. Test Mode is a virtual testing environment which is an exact replica of the live FasterPay environment. This allows businesses to integrate and test the payment flow without being in the live environment. Businesses can create a FasterPay account, turn on the Test Mode and begin to integrate the widget using the test integration keys.
How to use the Test Mode:
- Sign up and open a FasterPay account here.
There is no need to enter any business information yet, therefore skip this step if you would like to go straight into the Test Mode environment. - Activate Test Mode on the top right side of your account.
- Go to the Integration tab on the left of your account and here are your Test integration keys.
- Begin your integration using these Test keys
To exit of the Test Mode and enter the live production, all you need to do is turn off the Test Mode toggle.
Initiating Payment Request on Test Mode.
<?phpinclude('path/to/fasterpay-php/lib/autoload.php');
$gateway = new FasterPay\Gateway(array(
'publicKey' => '<your public key>',
'privateKey' => '<your private key>',
'isTest' => 1
));
$form = $gateway->paymentForm()->buildForm(
[
'description' => 'Test order',
'amount' => '10',
'currency' => 'USD',
'merchant_order_id' => time(),
'success_url' => 'https://yourcompanywebsite.com/success',
'pingback_url' => 'https://yourcompanywebsite.com/pingback',
'sign_version' => 'v2' // use version 1 please skip this param or set it 'v1'
],
[
'autoSubmit' => false,
'hidePayButton' => false
]
);
echo $form;
from fasterpay.gateway import Gateway
if __name__ == "__main__":
gateway = Gateway("<your private key>", "<your public key>", is_test=False)
parameters = {
"payload": {
"description": "Golden Ticket",
"amount": "0.01",
"currency": "EUR",
"merchant_order_id": random.randint(1000, 9999),
"success_url": "http://localhost:12345/success.php",
},
"auto_submit_form": True
}
paymentForm = gateway.payment_form().build_form(parameters)
print paymentForm
const fasterpay = require('fasterpay-node');
let gateway = new fasterpay.Gateway({
publicKey: '<your public key>',
privateKey: '<your private key>',
isTest: 1 // Use 1 for Test Method
});
app.get('/one-time', (req, res) => {
let paymentForm = gateway.PaymentForm().buildForm({
'description': 'Test order',
'amount': '10',
'currency': 'USD',
'merchant_order_id': new Date().getTime().toString(),
'sign_version': 'v2',
'success_url': baseurl + '/success',
'pingback_url': baseurl + '/pingback'
},{
'autoSubmit': false,
'hidePayButton': false,
});
res.send(paymentForm);
});
public class TransactionServlet extends HttpServlet {
private Gateway gateway = Gateway.builder()
.publicApi("<your public key>")
.privateApi("<your private key>")
.isTest(true)
.build();
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
PrintWriter writer = resp.getWriter();
Form form = gateway.paymentForm()
.amount("5.00")
.currency("USD")
.description("Golden ticket")
.merchantOrderId(UUID.randomUUID().toString())
.sign_version(SignVersion.VERSION_2)
.isAutoSubmit(true);
writer.println("<html><body>");
writer.println(form.build());
writer.println("</body></html>");
}
}
class MainActivity : AppCompatActivity() {
val fasterPay: FasterPay by lazy {
FasterPay("<your public key>", true)
}
private fun requestPayment() {
val form = gateWay.form()
.amount("0.5")
.currency("USD")
.description("Golden Ticket")
.merchantOrderId(UUID.randomUUID().toString())
.successUrl("<your definition url>")
startActivity(gateWay.prepareCheckout(this, form))
}
}
curl https://pay.sandbox.fasterpay.com/payment/form \
-d "api_key: [YOUR_PUBLIC_KEY]" \
-d "merchant_order_id=w2183261236" \
-d "amount=9.99" \
-d "currency=USD" \
-d "email=user@host.com" \
-d "description=Golden Ticket" \
-d "hash=<hash generated using the combination of post params and merchant private key>"
Test Cards
You can use the following credit card details when in Test Mode.
All cards work with any valid expiration date / CVV.
- 4242 4242 4242 4242
- 4111 1111 1111 1111
- 4000 0000 0000 0002
- 4444 3333 2222 1111
For Failure statuses use card “5555 4444 3333 1111”.