PHP code example of payabbhi / payabbhi-php

1. Go to this page and download the library: Download payabbhi/payabbhi-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

payabbhi / payabbhi-php example snippets






// Set your credentials
$client = new \Payabbhi\Client('access_id', 'secret_key');

// Optionally set your app info.
// app_version and app_url are optional

$client->setAppInfo('app_name','app_version','app_url');


// Create order
$order = $client->order->create(array('merchant_order_id' => $merchantOrderID,
                                      'amount' => $amount,
                                      'currency' => $currency));

// Retrieve a particular order object
$order = $client->order->retrieve($orderId);

// Retrieve a set of order objects based on given filter params
$orders = $client->order->all(array('count' => 2));

// Retrieve a set of payments for a given order
$payments = $client->order->retrieve($orderId)->payments();

// Retrieve all payments
$payments = $client->payment->all();

// Retrieve a particular payment
$payment = $client->payment->retrieve($id);

// Capture a payment
$payment->capture();

// Fully Refund a payment
$refund = $payment->refund();

// Retrieve a set of refund objects for a given payment with optional filter params
$refunds = $payment->refunds();

// Create a refund
$fullRefund = $client->refund->create($paymentID);

// Create a partial refund
$partialRefund = $client->refund->create($paymentID, array('amount'=>$refundAmount));

// Retrieve a set of orders with the given filter params
$refunds = $client->refund->all(array('count' => 2));

// Retrieve a particular refund object
$refund = $client->refund->retrieve($refundId);

$attributes = array(
                    'payment_id'        => $payment_id,
                    'order_id'          => $order_id,
                    'payment_signature' => $payment_signature
                   );
$client->utility->verifyPaymentSignature($attributes);


$client->utility->verifyWebhookSignature($payload,$actualSignature,$secret);

// replayInterval is optional
$client->utility->verifyWebhookSignature($payload,$actualSignature,$secret,$replayInterval);

bash
$ composer