PHP code example of optimoapps / razorpay-x
1. Go to this page and download the library: Download optimoapps/razorpay-x 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/ */
optimoapps / razorpay-x example snippets
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
}
]
}