Skip to content

OptimoApps/razorpay-x

Repository files navigation

RazorPay X Laravel Payment Gateway

Latest Version on Packagist Total Downloads run-tests Check & fix styling License

RazorPay X Laravel Package. Supports JsonMapper

RazorPay X Laravel requires PHP 7.4. Supports Laravel 6 , 7 & 8.

Installation

You can install the package via composer:

composer require optimoapps/razorpay-x

Usage

 <?php
 use RazorPayX;

 /**
 *  Create Account
 *  Returns Account
 */
 $bankAccount = new Bank();
 $bankAccount->name = 'Gaurav Kumar';
 $bankAccount->account_number = '765432123456789';
 $bankAccount->ifsc = 'HDFC0000053';
 $account = new Account();
 $account->contact_id = 'cont_EyrHb3f1S0axBg';
 $account->account_type = AccountTypeEnum::BANK_ACCOUNT;
 $account->bank_account = $bankAccount;
 RazorPayX::account()->create($account);
 
 /* To Create a Payment */
 $payment = new Payment();
 $payment->account_number = '2323230002025787';
 $payment->fund_account_id = 'fa_EzFCyMGCEwTgmS';
 $payment->amount = 102;
 $payment->currency = 'INR';
 $payment->mode = PaymentModeEnum::IMPS;
 $payment->purpose = 'payout';
 RazorPayX::payment()->create($account);

/* To fetch Account */
 $account = new Account();
 $account->account_type = AccountTypeEnum::BANK_ACCOUNT;
 RazorPayX::account()->fetch($account);
 
/* result AccountCollection */

OptimoApps\RazorPayX\Entity\AccountCollection {#7246
  +entity: "collection"
  +count: 3
  +items: array:3 [
    0 => OptimoApps\RazorPayX\Entity\Account {#8386
      +id: "fa_F41TFrtuUZDim2"
      +entity: "fund_account"
      +contact_id: "cont_F0Rb5C4ZpfaTAV"
      +account_type: "bank_account"
      +bank_account: OptimoApps\RazorPayX\Entity\Bank {#9582
        +name: "Gaurav Kumar"
        +ifsc: "HDFC0000053"
        +account_number: "765432123456789"
        +bank_name: "HDFC Bank"
      }
      +vpa: null
      +active: true
      +batch_id: ""
      +created_at: 1592469241
    }
    1 => OptimoApps\RazorPayX\Entity\Account {#8369
      +id: "fa_F0RsxScNwK4C0t"
      +entity: "fund_account"
      +contact_id: "cont_F0Rb5C4ZpfaTAV"
      +account_type: "bank_account"
      +bank_account: OptimoApps\RazorPayX\Entity\Bank {#11794
        +name: "sathish kumar"
        +ifsc: "HDFC0000053"
        +account_number: "765432123456789"
        +bank_name: "HDFC Bank"
      }
      +vpa: null
      +active: true
      +batch_id: ""
      +created_at: 1591688903
    }
    2 => OptimoApps\RazorPayX\Entity\Account {#9580
      +id: "fa_EzFCyMGCEwTgmS"
      +entity: "fund_account"
      +contact_id: "cont_EyrHb3f1S0axBg"
      +account_type: "bank_account"
      +bank_account: OptimoApps\RazorPayX\Entity\Bank {#13996
        +name: "Gaurav Kumar"
        +ifsc: "HDFC0000053"
        +account_number: "765432123456789"
        +bank_name: "HDFC Bank"
      }
      +vpa: null
      +active: true
      +batch_id: ""
      +created_at: 1591425919
    }
  ]
}

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.