PHP code example of 99roomz / razorpay

1. Go to this page and download the library: Download 99roomz/razorpay 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/ */

    

99roomz / razorpay example snippets


use Razorpay\Api\Api;

$api = new Api($api_key, $api_secret);
$api->payment->all($options); // Returns array of payment objects
$payment = $api->payment->fetch($id); // Returns a particular payment
$api->payment->fetch($id)->capture(array('amount'=>$amount)); // Captures a payment
$api->payment->fetch($id)->refund(); // Refunds a payment 
$api->payment->fetch($id)->refund(array('amount'=>$refundAmount)); // Partially refunds a payment

// To get the payment details
echo $payment->amount;
echo $payment->currency;
// And so on for other attributes