PHP SDK for FasterPay Integration
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
LICENSE
README.md
composer.json

README.md

Welcome to FasterPay PHP SDK

FasterPay PHP SDK enables you to integrate the FasterPay's Checkout Page seamlessly without having the hassle of integrating everything from Scratch. Once your customer is ready to pay, FasterPay will take care of the payment, notify your system about the payment and return the customer back to your Thank You page.

Downloading the FasterPay PHP SDK

$ git clone https://github.com/FasterPay/fasterpay-php.git

Setting up the PHP SDK for your project

$ cp fasterpay-php path-to-project/lib/fasterpay-php

Initiating Payment Request using Python SDK

<?php
include('lib/autoload.php');

$gateway = new FasterPay\Gateway(array(
'publicKey' 	=> '<your public key>',
'privateKey'	=> '<your private key>',
));

$form = $gateway->paymentForm()->buildForm(
array(
  'description' => 'Test order',
  'amount' => '10',
  'currency' => 'USD',
  'merchant_order_id' => 'xxxxxx',
  'success_url' => 'https://yourcompanywebsite.com/success'
)
);

echo $form;
?>

For more information on the API Parameters, refer to our entire API Documentation here

Handling FasterPay Pingbacks

<?php
include('lib/autoload.php');

$gateway = new Fasterpay\Gateway(array(
    'publicKey'     => '<your public key>',
    'privateKey'    => '<your private key>',
));

$pingbackData = json_decode(file_get_contents('php://input'), true);
if(!empty($pingbackData)){

    if($gateway->pingback()->validate(
      array("apiKey" => $_SERVER["HTTP_X_APIKEY"]))
    ){
        #TODO: Write your code to deliver contents to the End-User.
        echo "OK"; exit();
    }
}

echo "NOK";
?>

FasterPay 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.

Initiating FasterPay Gateway in Test-Mode

<?php
include('lib/autoload.php');

$gateway = new FasterPay\Gateway(array(
  'publicKey'   => '<your public key>',
  'privateKey'  => '<your private key>',
  'apiBaseUrl'  => 'https://pay.sandbox.faterpay.com'
));
?>

Questions?