JanePay Express API Payment Gateway Developer Documentation

Payer

If payer wants to fund payments using JanePay, set the payer to JanePay.

Amount

Specify a payment amount and the currency.

Transaction

Is a function where the amount object has to be defined.

RedirectUrls

Define the urls where user should be redirected after transaction is completed or cancelled.

Payment

Is a function where the Payer, Amount, RedirectUrls and Merchant Credentials (Client ID and Client Secret) have to be defined. After initializing the Payment object, the create function is called and will generate a redirect URL. Users must redirect into this URL to complete the transaction.


Installation Instruction :

Click HERE to download the package

Go to php-sdk/src/JanePay/Rest/Connection.php then change BASE_URL value to your hostname
(ex: If localhost then define( 'BASE_URL' , 'http://localhost' ) )

Example :
 require 'vendor/autoload.php';
 use JanePay\Api\Payer;
 use JanePay\Api\Amount;
 use JanePay\Api\Transaction;
 use JanePay\Api\RedirectUrls;
 use JanePay\Api\Payment;

 $payer = new Payer();
 $payer->setPaymentMethod('JanePay');

                                     $amountIns = new Amount();
                                     $amountIns->setTotal(20)
                                     ->setCurrency('USD'); //currency must be in merchant wallet list

                                     $trans = new Transaction();
                                     $trans->setAmount($amountIns);
                                            
                                     $urls = new RedirectUrls();
                                     $urls->setReturnUrl('http://localhost/return-url')
                                     ->setCancelUrl('http://localhost/cancel-url');

                                     $payment = new Payment();
                                     //Client ID & Secret = Merchants->setting(gear icon)
                                     $payment->setCredentials([
                                     'client_id' => 'ID',
                                     'client_secret' => 'secret'
                                     ])

                                     ->setRedirectUrls($urls)
                                     ->setPayer($payer)
                                     ->setTransaction($trans);

                                     try {
                                     $payment->create();
                                     // redirecting to the approved url
                                     header("Location: ".$payment->getApprovedUrl());
                                     } catch (\Exception $ex) {
                                     print $ex;
                                     exit;
                                     }
                                            

Follow Us

Language