File manager - Edit - /home/premiey/www/wp-includes/images/media/razorpay.tar
Back
razorpay/.github/dependabot.yml 0000666 00000000221 15165415146 0012612 0 ustar 00 version: 2 updates: - package-ecosystem: composer directory: "/" schedule: interval: daily time: "04:00" timezone: Asia/Calcutta razorpay/.travis.yml 0000666 00000003340 15165415146 0010540 0 ustar 00 dist: precise language: php php: - 5.3 - 5.6 - 5.5 - 5.4 - '7.0' - 7.1 - 7.2 - 7.3 - 7.4 - 8.0 install: composer install before_script: - cp phpunit.xml.dist phpunit.xml # These two are required in the build step for non-composer-tests - mkdir -p libs - cd libs && wget https://github.com/rmccue/Requests/archive/v1.8.0.zip -O requests.zip && unzip requests.zip && rm requests.zip && cd .. - rm -rf libs/Requests-1.8.0/examples libs/Requests-1.8.0/docs libs/Requests-1.8.0/bin libs/Requests-1.8.0/tests script: # Run a syntax validation check on all PHP files - find . -path ./vendor -prune -o -iname '*.php' |xargs -n1 php -l - ./vendor/bin/phpunit notifications: slack: secure: fLT1x7BCXi8+sP1Qk1lP74+60JIBCw2clUTSOmB0OuoQGWYIJ4qelKcGH5FFsADGuC1GX2pf0fKRiLdavVrGpBkD4MGFPpyYKPYb0S/FyArN3PjdaNvAqE1VgQCtKkbugP5bHH9bp631+lo2EGQVLWTjlwiijWbCEyDu3L0YVMY= # We are doing the releases for non-composer folks # So this includes the vendor directory before_deploy: - echo $TRAVIS_TAG > version.txt - cat release.txt |zip -r@ "razorpay-php.zip" deploy: provider: releases # Otherwise, we lose the vendor/ directory skip_cleanup: true api_key: secure: bHcu1jUASH6aVSD1LmzXdjQC4hc0o8EBbVs9X8e5j+/OC7+UuBBRu+jh6gQje/XWu9Nj1W2LkWhv0IKX1tJbcs0uRstggx+xC0ZayRzkscsqErqeM4WeyJjxe5ewb2eeGujtl9+WWFB3wpUQJtxXaaPuGYtroYGGYuI23wzKN4A= # travis doesn't support multi file deployes yet, not that we need them file: razorpay-php.zip on: # Only do the release for one build every tag php: 5.6 # GitHub refuses to accept releases that are not tagged tags: true # Allow builds for non-master branches as well all_branches: true # Only do the releases if the repo is not a fork repo: razorpay/razorpay-php razorpay/doc.md 0000666 00000001211 15165415146 0007511 0 ustar 00 This document talks about the implementation of the code for the Api. Everything comes under namespace Razorpay\Api\. Namespaces put a requirement of PHP 5.3 minimum ```php namespace Razorpay\ class Api { // Contains a __get function that returns the appropriate // class object when one tries to access them. } namespace Razorpay\ class Client { // Handles request and response // Uses Composer:Requests internally } class Payment { public function get($id) { } public function fetch($options) { } public function capture($id) { } public function refund($id) { } } ``` razorpay/release.txt 0000666 00000000120 15165415146 0010601 0 ustar 00 src/ libs/ README.md Razorpay.php composer.lock composer.json doc.md version.txt razorpay/non_composer_tests/RazorpayTest.php 0000666 00000000675 15165415146 0015542 0 ustar 00 <?php namespace Razorpay\Api\Test; include 'Razorpay.php'; use Razorpay\Api\Api; class RazorpayTest extends \PHPUnit_Framework_TestCase { function setUp() { $this->api = new Api($_SERVER['KEY_ID'], $_SERVER['KEY_SECRET']); } public function testApiAccess() { $this->assertInstanceOf('Razorpay\Api\Api', $this->api); } public function testRequests() { $this->assertTrue(class_exists('\Requests')); } } razorpay/README.md 0000666 00000006712 15165415146 0007714 0 ustar 00 # razorpay-php [](https://travis-ci.org/razorpay/razorpay-php) [](https://packagist.org/packages/razorpay/razorpay) [](https://packagist.org/packages/razorpay/razorpay) Official PHP library for [Razorpay API](https://docs.razorpay.com/docs/payments). Read up here for getting started and understanding the payment flow with Razorpay: <https://docs.razorpay.com/docs/getting-started> ### Prerequisites - A minimum of PHP 5.3 is required ## Installation - If your project using composer, run the below command ``` composer require razorpay/razorpay:2.* ``` - If you are not using composer, download the latest release from [the releases section](https://github.com/razorpay/razorpay-php/releases). **You should download the `razorpay-php.zip` file**. After that, include `Razorpay.php` in your application and you can use the API as usual. ##Note: This PHP library follows the following practices: - Namespaced under `Razorpay\Api` - API throws exceptions instead of returning errors - Options are passed as an array instead of multiple arguments wherever possible - All requests and responses are communicated over JSON ## Documentation Documentation of Razorpay's API and their usage is available at <https://docs.razorpay.com> ## Basic Usage Instantiate the razorpay php instance with `key_id` & `key_secret`. You can obtain the keys from the dashboard app ([https://dashboard.razorpay.com/#/app/keys](https://dashboard.razorpay.com/#/app/keys)) ```php use Razorpay\Api\Api; $api = new Api($api_key, $api_secret); ``` The resources can be accessed via the `$api` object. All the methods invocations follows the following pattern ```php // $api->class->function() to access the API //Example $api->payment->fetch($paymentId); ``` ## Supported Resources - [Customer](documents/customer.md) - [Token](documents/token.md) - [Order](documents/order.md) - [Payments](documents/payment.md) - [Settlements](documents/settlement.md) - [Refunds](documents/refund.md) - [Invoice](documents/invoice.md) - [Item](documents/item.md) - [Subscriptions](documents/subscription.md) - [Add-on](documents/addon.md) - [Payment Links](documents/paymentLink.md) - [Smart Collect](documents/virtualaccount.md) - [Route](documents/transfer.md) - [QR Code](documents/qrcode.md) - [Emandate](documents/emandate.md) - [Cards](documents/card.md) - [Paper NACH](documents/papernach.md) - [UPI](documents/upi.md) - [Register Emandate and Charge First Payment Together](documents/registeremandate.md) - [Register NACH and Charge First Payment Together](documents/registernach.md) - [Payment Verification](documents/paymentVerfication.md) ## Development See the [doc.md](doc.md) file for getting started with development. ## Release Steps to follow for a release: 0. Merge the branch with the new code to master. 1. Bump the Version in `src/Api.php`. 2. Rename Unreleased to the new tag in `CHANGELOG.md` 3. Add a new empty "Unreleased" section at the top of `CHANGELOG.md` 4. Fix links at bottom in `CHANGELOG.md` 5. Commit 6. Tag the release and push to GitHub 7. A release should automatically be created once the travis build passes. Edit the release to add some description. ## License The Razorpay PHP SDK is released under the MIT License. See [LICENSE](LICENSE) file for more details. razorpay/Razorpay.php 0000666 00000002430 15165415146 0010746 0 ustar 00 <?php // Include Requests only if not already defined if (class_exists('Requests') === false) { require_once __DIR__.'/libs/Requests-1.8.0/library/Requests.php'; } try { Requests::register_autoloader(); if (version_compare(Requests::VERSION, '1.6.0') === -1) { throw new Exception('Requests class found but did not match'); } } catch (\Exception $e) { throw new Exception('Requests class found but did not match'); } spl_autoload_register(function ($class) { // project-specific namespace prefix $prefix = 'Razorpay\Api'; // base directory for the namespace prefix $base_dir = __DIR__ . '/src/'; // does the class use the namespace prefix? $len = strlen($prefix); if (strncmp($prefix, $class, $len) !== 0) { // no, move to the next registered autoloader return; } // get the relative class name $relative_class = substr($class, $len); // // replace the namespace prefix with the base directory, // replace namespace separators with directory separators // in the relative class name, append with .php // $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; // if the file exists, require it if (file_exists($file)) { require $file; } }); razorpay/CHANGELOG.md 0000666 00000015635 15165415146 0010252 0 ustar 00 # Change Log Changelog for Razorpay-PHP SDK. Follows [keepachangelog.com](https://keepachangelog.com/en/1.0.0/) for formatting. ## Unreleased ## [2.8.1] - 2021-11-08 ### Added - Added Item Api - Added Unit Tests ## [2.8.0][2.8.0] - 2021-10-07 ### Added - QR code end point API [[#235](https://github.com/razorpay/razorpay-php/pull/235)] - Update, cancel, create subscription link,fetch details of a Pending Update,cancel, pause and resume subscription API[[#236](https://github.com/razorpay/razorpay-php/pull/236)] - Smart Collect(Virtual Account) TPV API's [[#238](https://github.com/razorpay/razorpay-php/pull/238)] - Add/Delete TPV Bank Account [[#239](https://github.com/razorpay/razorpay-php/pull/239)] - Card end point api [[#240](https://github.com/razorpay/razorpay-php/pull/240)] - Route end point api [[#241](https://github.com/razorpay/razorpay-php/pull/241)] - Register emandate and charge first payment together [[#245](https://github.com/razorpay/razorpay-php/pull/245)] - PaperNACH/Register NACH and charge first payment together [[#246](https://github.com/razorpay/razorpay-php/pull/246)] - Added payment and Settlements methods [[#247](https://github.com/razorpay/razorpay-php/pull/247)] - Added edit and notify API's for payment links [[#248](https://github.com/razorpay/razorpay-php/pull/248)] - Added fetch, fetch multiple refund,edit and notify API's for refunds [[#250](https://github.com/razorpay/razorpay-php/pull/250)] - Added edit order API [[#251](https://github.com/razorpay/razorpay-php/pull/251)] - Fund API's end point [[#252](https://github.com/razorpay/razorpay-php/pull/252)] - UPI [[#253](https://github.com/razorpay/razorpay-php/pull/253)] - Added payment link paymentverification [[#255](https://github.com/razorpay/razorpay-php/pull/255)] - Update readme file [[#254](https://github.com/razorpay/razorpay-php/pull/254)] ## [2.7.1][2.7.1] - 2021-09-16 ### Added - Added Payment Link end point API [[#233](https://github.com/razorpay/razorpay-php/pull/233)] ## [2.7.0][2.7.0] - 2021-05-07 ### Added - Adds support for payment page enity API [[#224](https://github.com/razorpay/razorpay-php/pull/224)] ## [2.6.1][2.6.1] - 2021-04-30 ### Changed - Upgrades [requests](https://github.com/rmccue/Requests/) to v1.8. [[#221](https://github.com/razorpay/razorpay-php/pull/221)] ## [2.6.0][2.6.0] - 2021-04-05 ### Added - Adds support for webhook enity API [[#212](https://github.com/razorpay/razorpay-php/pull/212)] ## [2.4.0-beta][2.4.0-beta] - 2018-11-28 ### Changed - Upgrades [requests](https://github.com/rmccue/Requests/) to v1.7. [[#89](https://github.com/razorpay/razorpay-php/pull/89)] - Enforces TLS1.1+ for all requests. Workaround for a bug in RHEL 6. [[#76](https://github.com/razorpay/razorpay-php/pull/76)] ## [2.3.0][2.3.0] - 2018-09-15 ### Added - Add parameters to Subscription Cancel API - Support for fetching Settlements ## [2.2.1][2.2.1] - 2018-05-28 ### Added - Support for fetching all customer entities ## [2.2.0][2.2.0] - 2017-10-23 ### Added - Support for VirtualAccount entity - Support for Subscriptions ## [2.1.0][2.1.0] - 2017-10-10 ### Added - Support for new actions(cancel, notifyBy, edit, issue, delete) on invoices - Removes PHP 5.3 from list of versions to test build against ## [2.0.2][2.0.2] - 2017-08-03 ### Added - Support for creating and fetching Transfers - Support for creating Reversals on transfers ## [2.0.1][2.0.1] - 2017-07-31 ### Fixed - Webhook signature verification - Conditional require of Request class ## [2.0.0][2.0.0] - 2017-03-07 ### Added - Support for custom Application header - Support for card entity - Support for Webhook and Order Signature verification - Support for direct refund creation via Razorpay\Api\Refund::create() - Support for Utility functions via Razorpay\Api\Utility::verifyPaymentSignature and Razorpay\Api\Utility::verifyWebhookSignature - Support for case insensitive error codes - Support for 2xx HTTP status codes ### Changed - Razorpay\Api\Payment::refunds() now returns a Razorpay\Api\Collection object instead of Razorpay\Api\Refund object - Razorpay\Api\Api::$baseUrl, Razorpay\Api\Api::$key and Razorpay\Api\Api::$secret are now `protected` instead of `public` ## [1.2.9][1.2.9] - 2017-01-03 ### Added - Support for creating and fetching Invoices ## [1.2.8][1.2.8] - 2016-10-12 ### Added - Support for Customer and Token entities ## [1.2.7][1.2.7] - 2016-09-21 ### Added - Increases the request timeout to 30 seconds for all requests. ## [1.2.6][1.2.6] - 2016-03-28 ### Added - Adds better tracing when client is not able to recognize server response. ## [1.2.5][1.2.5] - 2016-03-28 ### Added - Add support for overriding request headers via setHeader ## [1.2.3][1.2.3] - 2016-02-24 ### Added - Add support for Orders ## [1.2.2][1.2.2] - 2016-02-17 ### Changed - Razorpay\Api\Request::checkErrors is now `protected` instead of `private` - The final build is now leaner and includes just requests, instead of entire vendor directory ## [1.2.1][1.2.1] - 2016-01-21 ### Added - Add version.txt in release with current git tag - This changelog file - `Api\Request::getHeaders()` method ## [1.2.0][1.2.0] - 2015-10-23 ### Added - Add version string to User Agent ### Changed - New release process that pushes pre-packaged zip files to GitHub ## 1.0.0 - 2015-01-18 ### Added - Initial Release [unreleased]: https://github.com/razorpay/razorpay-php/compare/2.5.0...HEAD [1.2.1]: https://github.com/razorpay/razorpay-php/compare/1.2.0...1.2.1 [1.2.0]: https://github.com/razorpay/razorpay-php/compare/1.1.0...1.2.0 [1.2.2]: https://github.com/razorpay/razorpay-php/compare/1.2.1...1.2.2 [1.2.3]: https://github.com/razorpay/razorpay-php/compare/1.2.2...1.2.3 [1.2.4]: https://github.com/razorpay/razorpay-php/compare/1.2.3...1.2.4 [1.2.5]: https://github.com/razorpay/razorpay-php/compare/1.2.4...1.2.5 [1.2.6]: https://github.com/razorpay/razorpay-php/compare/1.2.5...1.2.6 [1.2.7]: https://github.com/razorpay/razorpay-php/compare/1.2.6...1.2.7 [1.2.8]: https://github.com/razorpay/razorpay-php/compare/1.2.7...1.2.8 [1.2.9]: https://github.com/razorpay/razorpay-php/compare/1.2.8...1.2.9 [2.0.0]: https://github.com/razorpay/razorpay-php/compare/1.2.9...2.0.0 [2.0.1]: https://github.com/razorpay/razorpay-php/compare/2.0.0...2.0.1 [2.0.2]: https://github.com/razorpay/razorpay-php/compare/2.0.1...2.0.2 [2.1.0]: https://github.com/razorpay/razorpay-php/compare/2.0.2...2.1.0 [2.2.0]: https://github.com/razorpay/razorpay-php/compare/2.1.0...2.2.0 [2.2.1]: https://github.com/razorpay/razorpay-php/compare/2.2.0...2.2.1 [2.3.0]: https://github.com/razorpay/razorpay-php/compare/2.2.1...2.3.0 [2.4.0-beta]: https://github.com/razorpay/razorpay-php/compare/2.3.0...2.4.0-beta [2.5.0]: https://github.com/razorpay/razorpay-php/compare/2.4.0-beta...2.5.0 [2.8.0]: https://github.com/razorpay/razorpay-php/compare/2.7.1...2.8.0 [2.8.1]: https://github.com/razorpay/razorpay-php/compare/2.8.0...2.8.1 razorpay/.gitignore 0000666 00000000064 15165415146 0010417 0 ustar 00 composer.lock phpunit.xml vendor/ libs/ **/.DS_Store razorpay/phpunit.xml.dist 0000666 00000002346 15165415146 0011607 0 ustar 00 <?xml version="1.0" encoding="UTF-8"?> <!-- http://www.phpunit.de/manual/current/en/appendixes.configuration.html --> <phpunit backupGlobals = "false" backupStaticAttributes = "false" colors = "true" convertErrorsToExceptions = "true" convertNoticesToExceptions = "true" convertWarningsToExceptions = "true" processIsolation = "false" stopOnFailure = "false" syntaxCheck = "false" bootstrap = "tests/bootstrap.php" > <php> <!-- copy this file to phpunit.xml and replace with your API key to run tests --> <!-- Also uncomment the following two lines--> <!--<server name="KEY_ID" value="" /> <server name="KEY_SECRET" value="" /> --> </php> <testsuites> <testsuite> <directory>./non_composer_tests/</directory> </testsuite> <testsuite> <directory>./tests</directory> </testsuite> </testsuites> <filter> <whitelist> <directory>./src</directory> <exclude> </exclude> </whitelist> </filter> </phpunit> razorpay/tests/TransferTest.php 0000666 00000012547 15165415146 0012737 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class TransferTest extends TestCase { private $transferId = 'trf_IEn4KYFgfD7q3F'; private $accountId = 'acc_HjVXbtpSCIxENR'; private $paymentId = 'pay_I7watngocuEY4P'; public function setUp() { parent::setUp(); } /** * Direct transfers */ public function testDirectTransfer() { $data = $this->api->transfer->create(array('account' => $this->accountId, 'amount' => 500, 'currency' => 'INR')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Create transfers from payment */ public function testCreateTransferPayment() { $data = $this->api->payment->fetch($this->paymentId)->transfer(array('transfers' => array(array('account'=> $this->accountId, 'amount'=> '100', 'currency'=>'INR', 'notes'=> array('name'=>'Gaurav Kumar', 'roll_no'=>'IEC2011025'), 'linked_account_notes'=>array('branch'), 'on_hold'=>'1', 'on_hold_until'=>'1671222870')))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Create transfers from order */ public function testCreateTransferOrder() { $data = $this->api->order->create(array('amount' => 100,'currency' => 'INR','transfers' => array(array('account' =>$this->accountId,'amount' => 100,'currency' => 'INR','notes' => array('branch' => 'Acme Corp Bangalore North','name' => 'Gaurav Kumar'),'linked_account_notes' => array('branch'),'on_hold' => 1,'on_hold_until' => 1671222870)))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('transfer',$data->toArray())); } /** * Fetch transfer for a payment */ public function testFetchTransferPayment() { $data = $this->api->payment->fetch($this->paymentId)->transfers(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Fetch transfer for an order */ public function testFetchTransferOrder() { $order = $this->api->order->all(); if($order['count'] !== 0){ $data = $this->api->order->fetch($order['items'][0]['id'])->transfers(array('expand[]'=>'transfers')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('order',$data->toArray())); } } /** * Fetch transfer */ public function testFetchTransfer() { $data = $this->api->transfer->fetch($this->transferId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('order',$data->toArray())); } /** * Fetch transfers for a settlement */ public function testFetchSettlement() { $settlement = $this->api->transfer->all(array('expand[]'=> 'recipient_settlement')); if($settlement['count'] !== 0){ $data = $this->api->transfer->all(array('recipient_settlement_id'=> $settlement['items'][0]['recipient_settlement_id'])); $this->assertTrue(is_array($data->toArray())); } } /** * Fetch settlement details */ public function testFetchSettlementDetails() { $data = $this->api->transfer->all(array('expand[]'=> 'recipient_settlement')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Refund payments and reverse transfer from a linked account */ public function testRefundPayment() { $data = $this->api->payment->fetch($this->paymentId)->refund(array('amount'=> '100')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('refund',$data->toArray())); } /** * Fetch payments of a linked account */ public function testFetchPaymentsLinkedAccounts() { $data = $this->api->payment->fetch($this->paymentId)->refund(array('amount'=> '100')); $this->assertTrue(is_array($data->toArray())); } /** * Reverse transfers from all linked accounts */ public function testReverseLinkedAccount() { $transfer = $this->api->transfer->create(array('account' => $this->accountId, 'amount' => 100, 'currency' => 'INR')); $data = $this->api->transfer->fetch($transfer->id)->reverse(array('amount'=>100)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('refund',$data->toArray())); } /** * Hold settlements for transfers */ public function testHoldSettlements() { $data = $this->api->payment->fetch($this->paymentId)->transfer(array('transfers' => array(array('account' => $this->accountId, 'amount' => '100', 'currency' => 'INR', 'on_hold'=>'1')))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Modify settlement hold for transfers */ public function testModifySettlements() { $data = $this->api->transfer->fetch($this->transferId)->edit(array('on_hold'=>1)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('transfer',$data->toArray())); } } razorpay/tests/EmandateTest.php 0000666 00000006332 15165415146 0012664 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class EmandateTest extends TestCase { private $customerId = 'cust_BMB3EwbqnqZ2EI'; private $invoiceId = 'inv_IF37M4q6SdOpjT'; private $tokenId = 'token_IF1ThOcFC9J7pU'; public function setUp() { parent::setUp(); } /** * Create customer */ public function testCreateCustomerEmandate() { $data = $this->api->customer->create(array('name' => 'Razorpay User 71', 'email' => 'customer71@razorpay.com', 'contact'=> 9999999999, 'fail_existing'=>'0')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer',$data->toArray())); } /** * Create Order */ public function testCreateOrderEmandate() { $data = $this->api->order->create(array('amount' => 100,'currency' => 'INR','method' => 'emandate','customer_id' => $this->customerId,'receipt' => 'Receipt No. '.time(), 'notes' => array('notes_key_1' => 'Beam me up Scotty','notes_key_2' => 'Engage'),'token' => array('auth_type' => 'netbanking','max_amount' => 9999900,'expire_at' => 4102444799,'notes' => array('notes_key_1' => 'Tea, Earl Grey, Hot','notes_key_2' => 'Tea, Earl Grey… decaf.'),'bank_account' => array('beneficiary_name' => 'Gaurav Kumar','account_number' => '1121431121541121','account_type' => 'savings','ifsc_code' => 'HDFC0000001')))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Create registration link */ public function testCreateSubscriptionRegistrationEmandate() { $data = $this->api->subscription->createSubscriptionRegistration(array('customer'=>array('name'=>'Gaurav Kumar','email'=>'gaurav.kumar@example.com','contact'=>'7000569565'),'type'=>'link','amount'=>100,'currency'=>'INR','description'=>'Registration Link for Gaurav Kumar','subscription_registration'=>array('method'=>'card','max_amount'=>'500','expire_at'=> strtotime("+1 month") ),'receipt'=>'Receipt No. '.time(),'email_notify'=>1,'sms_notify'=>1,'expire_by'=>strtotime("+1 month"),'notes' => array('note_key 1' => 'Beam me up Scotty','note_key 2' => 'Tea. Earl Gray. Hot.'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer',$data->toArray())); } /** * Send/Resend notifications */ public function testSendNotification() { $data = $this->api->invoice->fetch($this->invoiceId)->notifyBy('email'); $this->assertTrue(is_array($data)); $this->assertTrue(in_array('success',$data)); } /** * Fetch token by payment ID */ public function testFetchTokenByPaymentId() { $payment = $this->api->payment->all(); $data = $this->api->payment->fetch($payment['items'][0]['id']); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Fetch tokens by customer id */ public function testFetchTokenByCustomerId() { $data = $this->api->customer->fetch($this->customerId)->tokens()->all(); $this->assertTrue(is_array($data->toArray())); } } razorpay/tests/TestCase.php 0000666 00000000512 15165415146 0012013 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Api; use Razorpay\Api\Request; class TestCase extends \PHPUnit_Framework_TestCase { public function setUp() { $apiKey = 'rzp_test_1DP5mmOlF5G5ag'; $apiSecret = 'thisissupersecret'; $this->api = new Api( $apiKey, $apiSecret); } } razorpay/tests/registerNachtest.php 0000666 00000011147 15165415146 0013624 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class registerNachTest extends TestCase { private $customerId = 'cust_BMB3EwbqnqZ2EI'; private $invoiceId = 'inv_IF37M4q6SdOpjT'; private $orderId = 'order_IF1TQZozl6Leaw'; private $tokenId = 'token_IF1ThOcFC9J7pU'; public function setUp() { parent::setUp(); } /** * Create customer */ public function testCreateCustomerForNachTest() { $data = $this->api->customer->create(array('name' => 'Razorpay User 21', 'email' => 'customer21@razorpay.com','fail_existing'=>'0')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer',$data->toArray())); } /** * Create Order */ public function testCreateOrderForNachTest() { $data = $this->api->order->create(array('receipt' => '123', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Send/Resend notifications */ public function testSendNotification() { $data = $this->api->invoice->fetch($this->invoiceId)->notifyBy('email'); $this->assertTrue(in_array('success',$data)); } /** * Create registration link */ public function testCreateSubscriptionRegistration() { $data = $this->api->subscription->createSubscriptionRegistration(array('customer' => array('name' => 'Gaurav Kumar','email' => 'gaurav.kumar@example.com','contact' => '9123456780'),'amount' => 0,'currency' => 'INR','type' => 'link','description' => '12 p.m. Meals','subscription_registration' => array('method' => 'nach','auth_type' => 'physical','bank_account' => array('beneficiary_name' => 'Gaurav Kumar','account_number' => '11214311215411','account_type' => 'savings','ifsc_code' => 'HDFC0001233'),'nach' => array('form_reference1' => 'Recurring Payment for Gaurav Kumar','form_reference2' => 'Method Paper NACH'),'expire_at' => 1636772800,'max_amount' => 50000),'receipt' => 'Receipt No. '.time(),'sms_notify' => 1,'email_notify' => 1,'expire_by' => 1636772800,'notes' => array('note_key 1' => 'Beam me up Scotty','note_key 2' => 'Tea. Earl Gray. Hot.'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Fetch Payment ID using Order ID */ public function testFetchPaymentByorderId() { $data = $this->api->order->fetch($this->orderId)->payments(); $this->assertTrue(is_array($data->toArray())); } /** * Fetch tokens by customer id */ public function testFetchTokenByCustomerId() { $data = $this->api->customer->fetch($this->customerId)->tokens()->all(); $this->assertTrue(is_array($data->toArray())); } /** * Fetch token by payment ID */ public function testFetchTokenByPaymentId() { $payment = $this->api->payment->all(); if(!empty($payment)){ $data = $this->api->payment->fetch($payment['items'][0]['id']); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } } /** * Create an order to charge the customer */ public function testCreateOrderCharge() { $data = $this->api->order->create(array('receipt' => '122', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Create a Recurring Payment */ public function testCreateRecurring() { $order = $this->api->order->create(array("amount" => 100, "currency" => "INR","method" => "emandate", "payment_capture" => "1","customer_id" => $this->customerId ,"token" => array("auth_type" => "netbanking","max_amount" => 9999900,"expire_at" => 2147483647,"bank_account" => array("beneficiary_name" => "Gaurav Kumar","account_number" => "1121431121541121","account_type" => "savings","ifsc_code" => "HDFC0000001") ),"receipt" => "Receipt No. 1")); $data = $this->api->payment->createRecurring(array('email'=>'gaurav.kumar@example.com','contact'=>'9123456789','amount'=>100,'currency'=>'INR','order_id'=>$order->id,'customer_id'=>$this->customerId,'token'=>$this->tokenId,'recurring'=>'1','description'=>'Creating recurring payment for Gaurav Kumar')); $this->assertTrue(is_array($data->toArray())); } } razorpay/tests/qrCodeTest.php 0000666 00000004541 15165415146 0012363 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class qrCodeTest extends TestCase { private $qrCodeId = 'qr_IEjmDxjAY3iCnw'; private $customerId = 'cust_IEfAt3ruD4OEzo'; public function setUp() { parent::setUp(); } /** * Create Qr code */ public function testCreateQrCode() { $data = $this->api->qrCode->create(array("type" => "upi_qr","name" => "Store_1", "usage" => "single_use","fixed_amount" => 1,"payment_amount" => 300,"customer_id" => $this->customerId, "description" => "For Store 1","close_by" => 1681615838,"notes" => array("purpose" => "Test UPI QR code notes"))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('qr_code',$data->toArray())); } /** * Fetch all Qr code */ public function testFetchAllQrCode() { $data = $this->api->plan->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch a Qr code */ public function testFetchQrCode() { $data = $this->api->qrCode->fetch($this->qrCodeId); $this->assertTrue(is_array($data->toArray())); } /** * Fetch a Qr code for customer id */ public function testFetchQrCodeByCustomerId() { $data = $this->api->qrCode->all(["customer_id" => $this->customerId ]); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch a Qr code for payment id */ public function testFetchQrCodePaymentById() { $data = $this->api->qrCode->all(); $this->assertTrue(is_array($data->toArray())); } /** * Close a QR Code */ public function testCloseQrCode() { $qrCodeId = $this->api->qrCode->create(array("type" => "upi_qr","name" => "Store_1", "usage" => "single_use","fixed_amount" => 1,"payment_amount" => 300,"customer_id" => $customer['items'][0]['id'], "description" => "For Store 1","close_by" => 1681615838,"notes" => array("purpose" => "Test UPI QR code notes"))); $data = $this->api->qrCode->fetch($qrCodeId->id)->close(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('qr_code',$data->toArray())); } } razorpay/tests/settlementTest.php 0000666 00000004643 15165415146 0013335 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class settlementTest extends TestCase { private $settlementId = 'setl_IAj6iuvvTATqOM'; public function setUp() { parent::setUp(); } /** * Create on-demand settlement */ public function testCreateOndemandSettlement() { $data = $this->api->settlement->createOndemandSettlement(array("amount"=> 1221, "settle_full_balance"=> false, "description"=>"Testing","notes" => array("notes_key_1"=> "Tea, Earl Grey, Hot","notes_key_2"=> "Tea, Earl Grey… decaf."))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('settlement.ondemand',$data->toArray())); } /** * Fetch all settlements */ public function testAllSettlements() { $data = $this->api->settlement->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Fetch a settlement */ public function testFetchSettlement() { $data = $this->api->settlement->fetch($this->settlementId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('settlement',$data->toArray())); } /** * Settlement report for a month */ public function testReports() { $data = $this->api->settlement->reports(array("year"=>2021,"month"=>9)); $this->assertTrue(is_array($data->toArray())); } /** * Settlement recon */ public function testSettlementRecon() { $data = $this->api->settlement->settlementRecon(array('year' => 2021, 'month' => 9)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch all on-demand settlements */ public function TestFetchAllOndemandSettlement() { $data = $api->settlement->fetchAllOndemandSettlement(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch on-demand settlement by ID */ public function TestFetchAllOndemandSettlementById() { $data = $api->settlement->fetch($this->settlementId)->TestFetchAllOndemandSettlementById(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } } razorpay/tests/refundTest.php 0000666 00000004156 15165415146 0012433 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class refundTest extends TestCase { private $paymentId = 'pay_IEjvQO0923IqEu'; private $refundId = 'rfnd_IEjzeVghAS4vd1'; public function setUp() { parent::setUp(); } /** * Create an instant refund */ public function testCreateRefund() { $data = $this->api->payment->fetch($this->paymentId)->refund(array("amount"=> "100", "speed"=>"optimum", "receipt"=>"Receipt No. ".time())); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('refund',$data->toArray())); } /** * Fetch multiple refunds for a payment */ public function testFetchMultipalRefund() { $data = $this->api->payment->fetch($this->paymentId)->fetchMultipleRefund(array("count"=>1)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch a specific refund for a payment */ public function testFetchRefund() { $data = $this->api->payment->fetch($this->paymentId)->fetchRefund($this->refundId); $this->assertTrue(is_array($data->toArray())); } /** * Fetch all refunds */ public function testFetchAllRefund() { $data = $this->api->refund->all(array("count"=>1)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch particular refund */ public function testParticularRefund() { $data = $this->api->refund->fetch($this->refundId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('refund',$data->toArray())); } /** * Update the refund */ public function testUpdateRefund() { $data = $this->api->refund->fetch($this->refundId)->edit(array('notes'=> array('notes_key_1'=>'Beam me up Scotty.', 'notes_key_2'=>'Engage'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('refund',$data->toArray())); } } razorpay/tests/OrdersTest.php 0000666 00000003242 15165415146 0012401 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class OrdersTest extends TestCase { private $orderId = 'order_IEfF1OrQbqxYJq'; public function setUp() { parent::setUp(); } /** * Create order */ public function testCreateOrder() { $data = $this->api->order->create(array('receipt' => '123', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Fetch all orders */ public function testAllOrders() { $data = $this->api->order->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch particular order */ public function testFetchOrder() { $data = $this->api->order->fetch($this->orderId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('order',$data->toArray())); } /** * Fetch payments for an order */ public function testOrderFetchById() { $data = $this->api->order->fetch($this->orderId)->payments(); $this->assertTrue(is_array($data->toArray())); } /** * Update Order */ public function testUpdateOrder() { $data = $this->api->order->fetch($this->orderId)->edit(array('notes'=> array('notes_key_1'=>'Beam me up Scotty. 1', 'notes_key_2'=>'Engage'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('entitiy',$data->toArray())); } } razorpay/tests/virtualAccountTest.php 0000666 00000005545 15165415146 0014156 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class virtualAccountTest extends TestCase { private $customerId = 'cust_IEm1ERQLCdRGPV'; private $paymentId = 'pay_IEljgrElHGxXAC'; private $virtualAccountId = 'va_IEmC8SOoyGxsNn'; public function setUp() { parent::setUp(); } /** * Create a virtual account */ public function testCreateVirtualAccount() { $data = $this->api->virtualAccount->create(array('receivers' => array('types' => array('bank_account')),'description' => 'Virtual Account created for Raftar Soft','customer_id' => $this->customerId ,'close_by' => 1681615838,'notes' => array('project_name' => 'Banking Software'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer',$data->toArray())); } /** * Create a virtual account with TPV */ public function testCreateVirtualAccountTpv() { $data = $this->api->virtualAccount->create(array('receivers' => array('types'=> array('bank_account')),'allowed_payers' => array(array('type'=>'bank_account','bank_account'=>array('ifsc'=>'RATN0VAAPIS','account_number'=>'2223330027558515'))),'description' => 'Virtual Account created for Raftar Soft','customer_id' => $this->customerId, 'notes' => array('project_name' => 'Banking Software'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer',$data->toArray())); } /** * Fetch all virtual account */ public function testFetchAllVirtualAccounts() { $data = $this->api->virtualAccount->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('collection',$data->toArray())); } /** * Fetch payments for a virtual account */ public function testFetchPayment() { $data = $this->api->virtualAccount->fetch($this->virtualAccountId)->payments(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Refund payments made to a virtual account */ public function testFetchRefund() { $payment = $this->api->payment->all(); $data = $this->api->payment->fetch($this->paymentId)->refunds(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Close virtual account */ public function testCloseVirtualAccount() { $payment = $this->api->virtualAccount->all(); if($payment['count'] !== 0){ $data = $this->api->virtualAccount->fetch($payment['items'][0]['id'])->close(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } } } razorpay/tests/CustomerTest.php 0000666 00000002723 15165415146 0012747 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class CustomerTest extends TestCase { private $customerId = 'cust_IEfAt3ruD4OEzo'; public function setUp() { parent::setUp(); } /** * Create customer */ public function testCreateCustomer() { $data = $this->api->customer->create(array('name' => 'Razorpay User 38', 'email' => 'customer38@razorpay.com' ,'fail_existing'=>'0')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer',$data->toArray())); } /** * Edit customer */ public function testEditCustomer() { $data = $this->api->customer->fetch($this->customerId)->edit(array('name' => 'Razorpay User 21' ,'contact'=>'9123456780')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array($this->customerId, $data->toArray())); } /** * Fetch customer All */ public function testFetchAll() { $data = $this->api->customer->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch a customer */ public function testFetchCustomer() { $data = $this->api->customer->fetch($this->customerId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array($this->customerId, $data->toArray())); } } razorpay/tests/AddonTest.php 0000666 00000003013 15165415146 0012164 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class AddonTest extends TestCase { private $addonId = 'ao_IEf05Yeu52LlKL'; private $plan = 'plan_IEeswu4zFBRGwi'; public function setUp() { parent::setUp(); } /** * Create an Add-on */ public function testCreateAddon() { $subscription = $this->api->subscription->create(array('plan_id' => $this->plan, 'customer_notify' => 1,'quantity'=>1, 'total_count' => 6, 'addons' => array(array('item' => array('name' => 'Delivery charges', 'amount' => 3000, 'currency' => 'INR'))),'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $data = $this->api->subscription->fetch($subscription->id)->createAddon(array('item' => array('name' => 'Extra Chair', 'amount' => 3000, 'currency' => 'INR'), 'quantity' => 1)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_object($data['item'])); } /** * Fetch Subscription Link by ID */ public function testFetchSubscriptionLink() { $data = $this->api->addon->fetch($this->addonId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue($data['entity']=='addon'); } /** * Fetch all addons */ public function testFetchAllAddon() { $data = $this->api->addon->fetchAll(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } } razorpay/tests/registerEmandateTest.php 0000666 00000011125 15165415146 0014425 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class registerEmandateTest extends TestCase { private $customerId = 'cust_BMB3EwbqnqZ2EI'; private $invoiceId = 'inv_IF37M4q6SdOpjT'; private $orderId = 'order_IF1TQZozl6Leaw'; private $tokenId = 'token_IF1ThOcFC9J7pU'; public function setUp() { parent::setUp(); } /** * Create customer */ public function testCreateCustomer() { $data = $this->api->customer->create(array('name' => 'Razorpay User 21', 'email' => 'customer21@razorpay.com','fail_existing'=>'0')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer',$data->toArray())); } /** * Create Order */ public function testCreateOrder() { $data = $this->api->order->create(array('receipt' => '123', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Send/Resend notifications */ public function testSendNotification() { $data = $this->api->invoice->fetch($this->invoiceId)->notifyBy('email'); $this->assertTrue(in_array('success',$data)); } /** * Create registration link */ public function testCreateSubscriptionRegistration() { $data = $this->api->subscription->createSubscriptionRegistration(array('customer' => array('name' => 'Gaurav Kumar','email' => 'gaurav.kumar@example.com','contact' => '9123456780'),'amount' => 0,'currency' => 'INR','type' => 'link','description' => '12 p.m. Meals','subscription_registration' => array('method' => 'nach','auth_type' => 'physical','bank_account' => array('beneficiary_name' => 'Gaurav Kumar','account_number' => '11214311215411','account_type' => 'savings','ifsc_code' => 'HDFC0001233'),'nach' => array('form_reference1' => 'Recurring Payment for Gaurav Kumar','form_reference2' => 'Method Paper NACH'),'expire_at' => 1636772800,'max_amount' => 50000),'receipt' => 'Receipt No. '.time(),'sms_notify' => 1,'email_notify' => 1,'expire_by' => 1636772800,'notes' => array('note_key 1' => 'Beam me up Scotty','note_key 2' => 'Tea. Earl Gray. Hot.'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Fetch Payment ID using Order ID */ public function testFetchPaymentByorderId() { $data = $this->api->order->fetch($this->orderId)->payments(); $this->assertTrue(is_array($data->toArray())); } /** * Fetch tokens by customer id */ public function testFetchTokenByCustomerId() { $data = $this->api->customer->fetch($this->customerId)->tokens()->all(); $this->assertTrue(is_array($data->toArray())); } /** * Fetch token by payment ID */ public function testFetchTokenByPaymentId() { $payment = $this->api->payment->all(); if(!empty($payment)){ $data = $this->api->payment->fetch($payment['items'][0]['id']); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } } /** * Create an order to charge the customer */ public function testCreateOrderCharge() { $data = $this->api->order->create(array('receipt' => '122', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Create a Recurring Payment */ public function testCreateRecurring() { $order = $this->api->order->create(array("amount" => 100, "currency" => "INR","method" => "emandate", "payment_capture" => "1","customer_id" => $this->customerId ,"token" => array("auth_type" => "netbanking","max_amount" => 9999900,"expire_at" => 2147483647,"bank_account" => array("beneficiary_name" => "Gaurav Kumar","account_number" => "1121431121541121","account_type" => "savings","ifsc_code" => "HDFC0000001") ),"receipt" => "Receipt No. 1")); $data = $this->api->payment->createRecurring(array('email'=>'gaurav.kumar@example.com','contact'=>'9123456789','amount'=>100,'currency'=>'INR','order_id'=>$order->id,'customer_id'=>$this->customerId,'token'=>$this->tokenId,'recurring'=>'1','description'=>'Creating recurring payment for Gaurav Kumar')); $this->assertTrue(is_array($data->toArray())); } } razorpay/tests/InvoiceTest.php 0000666 00000006267 15165415146 0012551 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class InvoiceTest extends TestCase { private $invoiceId = 'inv_IEjVoNaeZj3jhw'; private $customerId = 'cust_IEfAt3ruD4OEzo'; public function setUp() { parent::setUp(); } /** * Create Invoice */ public function testCreateInvoice() { $data = $this->api->invoice->create(array ('type' => 'invoice', 'date' => time(), 'customer_id'=> $this->customerId, 'line_items'=>array(array("name"=> "Master Cloud Computing in 30 Days", "amount"=>10000, "currency" => "INR", "quantity"=> 1)))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Fetch all invoices */ public function testFetchAllInvoice() { $data = $this->api->invoice->fetch($this->invoiceId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Update invoice */ public function testUpdateInvoice() { $data = $this->api->invoice->fetch($this->invoiceId)->edit(array('notes' => array('updated-key' => 'An updated note.'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Send notification */ public function testSendNotification() { $data = $this->api->invoice->fetch($this->invoiceId)->notifyBy('email'); $this->assertTrue(is_array($data)); } /** * Issue an invoice */ public function testInvoiceIssue() { $invoice = $this->api->invoice->create(array ('type' => 'invoice', 'draft'=> true , 'date' => time(), 'customer_id'=> $this->customerId, 'line_items'=>array(array("name"=> "Master Cloud Computing in 30 Days", "amount"=>10000, "currency" => "INR", "quantity"=> 1)))); $data = $this->api->invoice->fetch($invoice->id)->issue(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Delete an invoice */ public function testDeleteInvoice() { $invoice = $this->api->invoice->create(array ('type' => 'invoice', 'draft'=> true , 'date' => time(), 'customer_id'=> $this->customerId, 'line_items'=>array(array("name"=> "Master Cloud Computing in 30 Days", "amount"=>10000, "currency" => "INR", "quantity"=> 1)))); $data = $this->api->invoice->fetch($invoice->id)->delete(); $this->assertTrue(is_array($data)); } /** * Cancel an invoice */ public function testCancelInvoice() { $invoice = $this->api->invoice->create(array ('type' => 'invoice', 'draft'=> true , 'date' => time(), 'customer_id'=> $this->customerId, 'line_items'=>array(array("name"=> "Master Cloud Computing in 30 Days", "amount"=>10000, "currency" => "INR", "quantity"=> 1)))); $data = $this->api->invoice->fetch($invoice->id)->cancel(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } } razorpay/tests/ItemTest.php 0000666 00000004603 15165415146 0012043 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class ItemTest extends TestCase { public function setUp() { parent::setUp(); } /** * Create item */ public function testcreate() { $data = $this->api->Item->create(array( "name" => "Book / English August", "description" => "An indian story, Booker prize winner.", "amount" => 20000, "currency" => "INR" )); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Fetch all orders */ public function testAllItems() { $data = $this->api->Item->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch particular item */ public function testfetchItem() { $item = $this->api->Item->create(array( "name" => "Book / English August", "description" => "An indian story, Booker prize winner.", "amount" => 20000, "currency" => "INR" )); $data = $this->api->Item->fetch($item->id); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array($item->id, $data->toArray())); } /** * Update item */ public function testUpdate() { $item = $this->api->Item->create(array( "name" => "Book / English August", "description" => "An indian story, Booker prize winner.", "amount" => 20000, "currency" => "INR" )); $data = $this->api->Item->fetch($item->id)->edit(array( "name" => "Book / English August", "description" => "An indian story, Booker prize winner.", "amount" => 20000, "currency" => "INR" )); $this->assertTrue(is_array($data->toArray())); } /** * Delete item */ public function testDelete() { $item = $this->api->Item->create(array( "name" => "Book / English August", "description" => "An indian story, Booker prize winner.", "amount" => 20000, "currency" => "INR" )); $data = $this->api->Item->fetch($item->id)->delete(); $this->assertTrue(is_array($data->toArray())); } } razorpay/tests/paymentLinkTest.php 0000666 00000021550 15165415146 0013440 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class paymentLinkTest extends TestCase { private $paymentLinkId = 'plink_IEjOvfQs5AyjMN'; public function setUp() { parent::setUp(); } /** * Create Payment Link */ public function testCreatePaymentLink() { $data = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) , 'reminder_enable'=>true ,'notes'=>array('policy_name'=> 'Jeevan Bima'),'callback_url' => 'https://example-callback-url.com/', 'callback_method'=>'get')); $this->cancelLinkId = $data->id; $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Fetch multiple refunds for a payment */ public function testFetchAllMutlipleRefund() { $data = $this->api->paymentLink->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['payment_links'])); } /** * Fetch a specific refund for a payment */ public function testFetchRefund() { $data = $this->api->paymentLink->fetch($this->paymentLinkId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('amount',$data->toArray())); } /** * Update Payment Link */ public function testUpdatePaymentLink() { $data = $this->api->paymentLink->fetch($this->paymentLinkId)->edit(array("reference_id"=>"TS".time(), "reminder_enable"=>0, "notes"=>["policy_name"=>"Jeevan Saral 2"])); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Send notification */ public function testSendNotification() { $data = $this->api->paymentLink->fetch($this->paymentLinkId)->notifyBy('email'); $this->assertTrue(is_array($data)); $this->assertTrue(in_array('success',$data)); } /** * Cancel Payment Link */ public function testCancelPaymentLink() { $paymentLink = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) , 'reminder_enable'=>true ,'notes'=>array('policy_name'=> 'Jeevan Bima'),'callback_url' => 'https://example-callback-url.com/', 'callback_method'=>'get')); $data = $this->api->paymentLink->fetch($paymentLink->id)->cancel(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Transfer payments received using payment links */ public function testCreateTransferPayments() { $data = $this->api->paymentLink->create(array('amount'=>20000, 'currency'=>'INR', 'accept_partial'=>false, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('order'=>array('transfers'=>array('account'=>'acc_CPRsN1LkFccllA', 'amount'=>500, 'currency'=>'INR', 'notes'=>array('branch'=>'Acme Corp Bangalore North', 'name'=>'Bhairav Kumar' ,'linked_account_notes'=>array('branch'))), array('account'=>'acc_CNo3jSI8OkFJJJ', 'amount'=>500, 'currency'=>'INR', 'notes'=>array('branch'=>'Acme Corp Bangalore North', 'name'=>'Saurav Kumar' ,'linked_account_notes'=>array('branch'))))))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Offers on payment links */ public function testOfferPaymentLinks() { $data = $this->api->paymentLink->create(array('amount'=>20000, 'currency'=>'INR', 'accept_partial'=>false, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('order'=>array('transfers'=>array('account'=>'acc_CPRsN1LkFccllA', 'amount'=>500, 'currency'=>'INR', 'notes'=>array('branch'=>'Acme Corp Bangalore North', 'name'=>'Bhairav Kumar' ,'linked_account_notes'=>array('branch'))), array('account'=>'acc_CNo3jSI8OkFJJJ', 'amount'=>500, 'currency'=>'INR', 'notes'=>array('branch'=>'Acme Corp Bangalore North', 'name'=>'Saurav Kumar' ,'linked_account_notes'=>array('branch'))))))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Managing reminders for payment links */ public function testManagingRemainder() { $data = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>false)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('amount',$data->toArray())); } /** * Rename labels in checkout section */ public function testRenameLabelsCheckout() { $data = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('checkout'=>array('partial_payment'=>array('min_amount_label'=>'Minimum Money to be paid', 'partial_amount_label'=>'Pay in parts', 'partial_amount_description'=>'Pay at least ₹100', 'full_amount_label'=>'Pay the entire amount'))))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('amount',$data->toArray())); } /** * Change Business name */ public function testBusinessName() { $data = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('checkout'=>array('name'=>'Lacme Corp')))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Change checkouts fields */ public function testCheckoutFields() { $data = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('checkout'=>array('method'=>array('netbanking'=>'1', 'card'=>'1', 'upi'=>'0', 'wallet'=>'0'))))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } /** * Rename labels in checkout section */ public function testRenameLabelsPayments() { $data = $this->api->paymentLink->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('hosted_page'=>array('label'=>array('receipt'=>'Ref No.'.time(), 'description'=>'Course Name', 'amount_payable'=>'Course Fee Payable', 'amount_paid'=>'Course Fee Paid', 'partial_amount_due'=>'Fee Installment Due', 'partial_amount_paid'=>'Fee Installment Paid', 'expire_by'=>'Pay Before', 'expired_on'=>'1632223497','amount_due'=>'Course Fee Due'), 'show_preferences'=>array('issued_to'=>false))))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('accept_partial',$data->toArray())); } } razorpay/tests/SubscriptionTest.php 0000666 00000007143 15165415146 0013633 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class SubscriptionTest extends TestCase { private $subscriptionId = 'sub_IEKtBfPIqTHLWd'; private $plan = 'plan_IEeswu4zFBRGwi'; public function setUp() { parent::setUp(); } /** * Create a Subscription Link */ public function testCreateSubscription() { $data = $this->api->subscription->create(array('plan_id' => $this->plan, 'customer_notify' => 1,'quantity'=>1, 'total_count' => 6, 'addons' => array(array('item' => array('name' => 'Delivery charges', 'amount' => 3000, 'currency' => 'INR'))),'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Fetch Subscription Link by ID */ public function testSubscriptionFetchId() { $data = $this->api->subscription->fetch($this->subscriptionId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('plan_id',$data->toArray())); } /** * Pause a Subscription */ public function testPauseSubscription() { $data = $this->api->subscription->fetch($this->subscriptionId)->pause(['pause_at'=>'now']); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); $this->assertTrue($data['status'] == 'paused'); } /** * Resume a Subscription */ public function testResumeSubscription() { $data = $this->api->subscription->fetch($this->subscriptionId)->resume(['resume_at'=>'now']); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); $this->assertTrue($data['status'] == 'active'); } /** * Update a Subscription */ public function testUpdateSubscription() { $data = $this->api->subscription->fetch($this->subscriptionId)->update(array('schedule_change_at'=>'cycle_end','quantity'=>2)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer_id',$data->toArray())); } /** * Fetch Details of a Pending Update */ public function testPendingUpdate() { $data = $this->api->subscription->fetch($this->subscriptionId)->pendingUpdate(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Cancel an Update */ public function testCancelUpdate() { $data = $this->api->subscription->fetch($this->subscriptionId)->cancelScheduledChanges(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Fetch All Invoices for a Subscription */ public function testSubscriptionInvoices() { $data = $this->api->invoice->all(['subscription_id'=>$this->subscriptionId]); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch all Add-ons */ public function testFetchAddons() { $data = $this->api->addon->fetchAll(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch all subscriptions */ public function testFetchAllSubscriptions() { $data = $this->api->subscription->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } } razorpay/tests/FundTest.php 0000666 00000001711 15165415146 0012036 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class fundTest extends TestCase { private $customerId = 'cust_IEfAt3ruD4OEzo'; public function setUp() { parent::setUp(); } /** * Create a fund account */ public function testCreateFundAccount() { $data = $this->api->fundAccount->create(array('customer_id'=>$this->customerId,'account_type'=>'bank_account','bank_account'=>array('name'=>'Gaurav Kumar', 'account_number'=>'11214311215411', 'ifsc'=>'HDFC0000053'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer_id',$data->toArray())); } /** * Fetch all fund accounts */ public function testCreateOrder() { $data = $this->api->fundAccount->all(array('customer_id'=>$this->customerId)); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } } razorpay/tests/UpiTest.php 0000666 00000011412 15165415146 0011676 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class UpiTest extends TestCase { private $customerId = 'cust_IEfAt3ruD4OEzo'; private $invoiceId = 'inv_IEfS5mBV49bIQY'; private $orderId = 'order_IEgBdwYACpMLxd'; public function setUp() { parent::setUp(); } /** * Create customer */ public function testCreateCustomer() { $data = $this->api->customer->create(array('name' => 'Razorpay User 21', 'email' => 'customer21@razorpay.com','fail_existing'=>'0')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer',$data->toArray())); } /** * Create Order */ public function testCreateOrder() { $data = $this->api->order->create(array('receipt' => '123', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Send/Resend notifications */ public function testSendNotification() { $data = $this->api->invoice->fetch($this->invoiceId)->notifyBy('email'); $this->assertTrue(in_array('success',$data)); } /** * Create registration link */ public function testCreateSubscriptionRegistration() { $data = $this->api->subscription->createSubscriptionRegistration(array('customer' => array('name' => 'Gaurav Kumar','email' => 'gaurav.kumar@example.com','contact' => '9123456780'),'amount' => 0,'currency' => 'INR','type' => 'link','description' => '12 p.m. Meals','subscription_registration' => array('method' => 'nach','auth_type' => 'physical','bank_account' => array('beneficiary_name' => 'Gaurav Kumar','account_number' => '11214311215411','account_type' => 'savings','ifsc_code' => 'HDFC0001233'),'nach' => array('form_reference1' => 'Recurring Payment for Gaurav Kumar','form_reference2' => 'Method Paper NACH'),'expire_at' => 1636772800,'max_amount' => 50000),'receipt' => 'Receipt No. '.time(),'sms_notify' => 1,'email_notify' => 1,'expire_by' => 1636772800,'notes' => array('note_key 1' => 'Beam me up Scotty','note_key 2' => 'Tea. Earl Gray. Hot.'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Cancel a registration link */ public function testCancelRegistrationLink() { $data = $this->api->subscription->createSubscriptionRegistration(array('customer' => array('name' => 'Gaurav Kumar','email' => 'gaurav.kumar@example.com','contact' => '9123456780'),'amount' => 0,'currency' => 'INR','type' => 'link','description' => '12 p.m. Meals','subscription_registration' => array('method' => 'nach','auth_type' => 'physical','bank_account' => array('beneficiary_name' => 'Gaurav Kumar','account_number' => '11214311215411','account_type' => 'savings','ifsc_code' => 'HDFC0001233'),'nach' => array('form_reference1' => 'Recurring Payment for Gaurav Kumar','form_reference2' => 'Method Paper NACH'),'expire_at' => 1636772800,'max_amount' => 50000),'receipt' => 'Receipt No. '.time(),'sms_notify' => 1,'email_notify' => 1,'expire_by' => 1636772800,'notes' => array('note_key 1' => 'Beam me up Scotty','note_key 2' => 'Tea. Earl Gray. Hot.'))); $data = $this->api->invoice->fetch($data->id)->cancel(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('invoice_number',$data->toArray())); } /** * Fetch Payment ID using Order ID */ public function testFetchPaymentByorderId() { $data = $this->api->order->fetch($this->orderId)->payments(); $this->assertTrue(is_array($data->toArray())); } /** * Fetch tokens by customer id */ public function testFetchTokenByCustomerId() { $data = $this->api->customer->fetch($this->customerId)->tokens()->all(); $this->assertTrue(is_array($data->toArray())); } /** * Fetch token by payment ID */ public function testFetchTokenByPaymentId() { $payment = $this->api->payment->all(); if(!empty($payment)){ $data = $this->api->payment->fetch($payment['items'][0]['id']); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } } /** * Create an order to charge the customer */ public function testCreateOrderCharge() { $data = $this->api->order->create(array('receipt' => '122', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } } razorpay/tests/paymentTest.php 0000666 00000004777 15165415146 0012636 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class paymentTest extends TestCase { private $orderId = 'order_IEcrUMyevZFuCS'; private $paymentId = 'pay_IEczPDny6uzSnx'; public function setUp() { parent::setUp(); } /** * Fetch all payment */ public function testFetchAllPayment() { $data = $this->api->payment->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch a payment */ public function testFetchPayment() { $payment = $this->api->payment->all(); if($payment['count'] !== 0){ $data = $this->api->payment->fetch($payment['items'][0]['id']); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('payment',$data->toArray())); } } /** * Fetch a payment */ public function testFetchOrderPayment() { $data = $this->api->order->fetch($this->orderId)->payments(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Update a payment */ public function testUpdatePayment() { $data = $this->api->payment->fetch($this->paymentId)->edit(array('notes'=> array('key_1'=> 'value1','key_2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('payment',$data->toArray())); } /** * Fetch card details with paymentId */ public function testFetchCardWithPaymentId() { $data = $this->api->payment->fetch($this->paymentId)->fetchCardDetails(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('card',$data->toArray())); } /** * Fetch Payment Downtime Details */ public function testfetchPaymentDowntime() { $data = $this->api->payment->fetchPaymentDowntime(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('count',$data->toArray())); } /** * Fetch Payment Downtime Details */ public function testfetchPaymentDowntimeById() { $downtime = $this->api->payment->fetchPaymentDowntime(); $data = $this->api->payment->fetchPaymentDowntimeById($downtime['items'][0]['id']); $this->assertTrue(is_array($data->toArray())); } } razorpay/tests/signatureVerificationTest.php 0000666 00000004001 15165415146 0015501 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class signatureVerificationTest extends TestCase { private static $subscriptionId; public function setUp() { parent::setUp(); } /** * Verify Payment verification */ public function testPaymentVerification() { $orderId = 'order_IEIaMR65cu6nz3'; $paymentId = 'pay_IH4NVgf4Dreq1l'; $signature = '0d4e745a1838664ad6c9c9902212a32d627d68e917290b0ad5f08ff4561bc50f'; $this->assertTrue(true,$this->api->utility->verifyPaymentSignature(array( 'razorpay_order_id' => $orderId, 'razorpay_payment_id' => $paymentId, 'razorpay_signature' => $signature ))); } /** * Verify PaymentLink verification */ public function testPaymentLinkVerification() { $paymentLinkId = 'plink_IH3cNucfVEgV68'; $paymentId = 'pay_IH3d0ara9bSsjQ'; $paymentLinkReferenceId = 'TSsd1989'; $paymentLinkStatus = 'paid'; $signature = '07ae18789e35093e51d0a491eb9922646f3f82773547e5b0f67ee3f2d3bf7d5b'; $this->assertTrue(true,$this->api->utility->verifyPaymentSignature(array( 'razorpay_payment_link_id' => $paymentLinkId, 'razorpay_payment_link_reference_id' => $paymentLinkReferenceId, 'razorpay_payment_link_status' => $paymentLinkStatus, 'razorpay_payment_id' => $paymentId, 'razorpay_signature' => $signature ))); } /** * Verify Subscription verification */ public function testSubscriptionVerification() { $subscriptionId = 'sub_ID6MOhgkcoHj9I'; $paymentId = 'pay_IDZNwZZFtnjyym'; $signature = '601f383334975c714c91a7d97dd723eb56520318355863dcf3821c0d07a17693'; $this->assertTrue(true,$this->api->utility->verifyPaymentSignature(array( 'razorpay_subscription_id' => $subscriptionId, 'razorpay_payment_id' => $paymentId, 'razorpay_signature' => $signature ))); } } razorpay/tests/planTest.php 0000666 00000002302 15165415146 0012071 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class planTest extends TestCase { private $planId = 'plan_IEeswu4zFBRGwi'; public function setUp() { parent::setUp(); } /** * Create Plan */ public function testCreatePlan() { $data = $this->api->plan->create(array('period' => 'weekly', 'interval' => 1, 'item' => array('name' => 'Test Weekly 1 plan', 'description' => 'Description for the weekly 1 plan', 'amount' => 600, 'currency' => 'INR'),'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('plan',$data->toArray())); } /** * Fetch all plans */ public function testFetchAllPlans() { $data = $this->api->plan->all(); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(is_array($data['items'])); } /** * Fetch particular plan */ public function testFetchPlan() { $data = $this->api->plan->fetch($this->planId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('plan',$data->toArray())); } } razorpay/tests/bootstrap.php 0000666 00000000106 15165415146 0012314 0 ustar 00 <?php $autoloader = require dirname(__DIR__) . '/vendor/autoload.php'; razorpay/tests/TokenTest.php 0000666 00000004000 15165415146 0012214 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class TokenTest extends TestCase { private $paymentId = 'pay_IEczPDny6uzSnx'; private $customerId = 'cust_IEcn7UdBOFmaNi'; private $tokenId = 'token_IEcux6sQtS8eLx'; public function setUp() { parent::setUp(); } /** * Create registration link */ public function testCreateRegistrationLink() { $data = $this->api->subscription->createSubscriptionRegistration(array('customer' => array('name' => 'Gaurav Kumar','email' => 'gaurav.kumar@example.com','contact' => '9123456780'),'amount' => 0,'currency' => 'INR','type' => 'link','description' => '12 p.m. Meals','subscription_registration' => array('method' => 'nach','auth_type' => 'physical','bank_account' => array('beneficiary_name' => 'Gaurav Kumar','account_number' => '11214311215411','account_type' => 'savings','ifsc_code' => 'HDFC0001233'),'nach' => array('form_reference1' => 'Recurring Payment for Gaurav Kumar','form_reference2' => 'Method Paper NACH'),'expire_at' => 1636772800,'max_amount' => 50000),'receipt' => 'Receipt No. '.time(),'sms_notify' => 1,'email_notify' => 1,'expire_by' => 1636772800,'notes' => array('note_key 1' => 'Beam me up Scotty','note_key 2' => 'Tea. Earl Gray. Hot.'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Fetch token by payment id */ public function testFetchTokenByPaymentId() { $data = $this->api->payment->fetch($this->paymentId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('payment',$data->toArray())); } /** * Fetch particular token */ public function testFetchTokenByCustomerId() { $data = $this->api->customer->fetch($this->customerId)->tokens()->fetch($this->tokenId); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('payment',$data->toArray())); } }razorpay/tests/paperNachTest.php 0000666 00000010516 15165415146 0013046 0 ustar 00 <?php namespace Razorpay\Tests; use Razorpay\Api\Request; class paperNachTest extends TestCase { private $customerId = 'cust_BMB3EwbqnqZ2EI'; private $invoiceId = 'inv_IF37M4q6SdOpjT'; private $orderId = 'order_IF1TQZozl6Leaw'; private $tokenId = 'token_IF1ThOcFC9J7pU'; public function setUp() { parent::setUp(); } /** * Create customer */ public function testCreateCustomerPaperNach() { $data = $this->api->customer->create(array('name' => 'Razorpay User 72', 'email' => 'customer72@razorpay.com', 'fail_existing'=>'0')); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('customer',$data->toArray())); } /** * Create Order */ public function testCreateOrderPaperNach() { $data = $this->api->order->create(array('receipt' => '123', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Send notification */ public function testSendNotification() { $data = $this->api->invoice->fetch($this->invoiceId)->notifyBy('email'); $this->assertTrue(in_array('success',$data)); } /** * Create registration link */ public function testRegistrationLink() { $data = $this->api->subscription->createSubscriptionRegistration(array('customer' => array('name' => 'Gaurav Kumar','email' => 'gaurav.kumar@example.com','contact' => '9123456780'),'amount' => 0,'currency' => 'INR','type' => 'link','description' => '12 p.m. Meals','subscription_registration' => array('method' => 'nach','auth_type' => 'physical','bank_account' => array('beneficiary_name' => 'Gaurav Kumar','account_number' => '11214311215411','account_type' => 'savings','ifsc_code' => 'HDFC0001233'),'nach' => array('form_reference1' => 'Recurring Payment for Gaurav Kumar','form_reference2' => 'Method Paper NACH'),'expire_at' => 1636772800,'max_amount' => 50000),'receipt' => 'Receipt No. '.time(),'sms_notify' => 1,'email_notify' => 1,'expire_by' => 1636772800,'notes' => array('note_key 1' => 'Beam me up Scotty','note_key 2' => 'Tea. Earl Gray. Hot.'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Fetch Payment ID using Order ID */ public function testFetchPaymentByorderId() { $data = $this->api->order->fetch($this->orderId)->payments(); $this->assertTrue(is_array($data->toArray())); } /** * Fetch token by payment ID */ public function testFetchTokenByPaymentId() { $payment = $this->api->payment->all(); if(!empty($payment)){ $data = $this->api->payment->fetch($payment['items'][0]['id']); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } } /** * Create an order to charge the customer */ public function testCreateOrderCharge() { $data = $this->api->order->create(array('receipt' => '122', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); $this->assertTrue(is_array($data->toArray())); $this->assertTrue(in_array('id',$data->toArray())); } /** * Create a Recurring Payment */ public function testCreateRecurring() { $order = $this->api->order->create(array("amount" => 100, "currency" => "INR","method" => "emandate", "payment_capture" => "1","customer_id" => $this->customerId ,"token" => array("auth_type" => "netbanking","max_amount" => 9999900,"expire_at" => 2147483647,"bank_account" => array("beneficiary_name" => "Gaurav Kumar","account_number" => "1121431121541121","account_type" => "savings","ifsc_code" => "HDFC0000001") ),"receipt" => "Receipt No. 1")); $data = $this->api->payment->createRecurring(array('email'=>'gaurav.kumar@example.com','contact'=>'9123456789','amount'=>100,'currency'=>'INR','order_id'=>$order->id,'customer_id'=>$this->customerId,'token'=>$this->tokenId,'recurring'=>'1','description'=>'Creating recurring payment for Gaurav Kumar')); $this->assertTrue(is_array($data->toArray())); } } razorpay/documents/paymentVerfication.md 0000666 00000005101 15165415146 0014616 0 ustar 00 ## payment verification ### Verify payment verification ```php $api->utility->verifyPaymentSignature(array('razorpay_order_id' => $razorpayOrderId, 'razorpay_payment_id' => $razorpayPaymentId, 'razorpay_signature' => $razorpaySignature)); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | orderId* | string | The id of the order to be fetched | | paymentId* | string | The id of the payment to be fetched | | signature* | string | Signature returned by the Checkout. This is used to verify the payment. | ------------------------------------------------------------------------------------------------------- ### Verify subscription verification ```php $api->utility->verifyPaymentSignature(array('razorpay_subscription_id' => $razorpaySubscriptionId, 'razorpay_payment_id' => $razorpayPaymentId, 'razorpay_signature' => $razorpaySignature)); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | subscriptionId* | string | The id of the subscription to be fetched | | paymentId* | string | The id of the payment to be fetched | | signature* | string | Signature returned by the Checkout. This is used to verify the payment. | ------------------------------------------------------------------------------------------------------- ### Verify paymentlink verification ```php $api->utility->verifyPaymentSignature(array('razorpay_payment_link_id' => $razorpayPaymentlinkId, 'razorpay_payment_id' => $razorpayPaymentId, 'razorpay_payment_link_reference_id' => $razorpayPaymentLinkReferenceId, 'razorpay_payment_link_status' => $razorpayPaymentLinkStatus, 'razorpay_signature' => $razorpayPaymentLinkSignature)); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | razorpayPaymentlinkId* | string | The id of the paymentlink to be fetched | | razorpayPaymentId* | string | The id of the payment to be fetched | | razorpayPaymentLinkReferenceId* | string | A reference number tagged to a Payment Link | | razorpayPaymentLinkStatus* | string | Current status of the link | | razorpayPaymentLinkSignature* | string | Signature returned by the Checkout. This is used to verify the payment. | ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> razorpay/documents/card.md 0000666 00000041714 15165415146 0011672 0 ustar 00 ## Cards ### Create customer ```php $api->customer->create(array('name' => 'Razorpay User', 'email' => 'customer@razorpay.com','contact'=>'9123456780', 'fail_existing'=> '0', 'notes'=> array('notes_key_1'=> 'Tea, Earl Grey, Hot','notes_key_2'=> 'Tea, Earl Grey… decaf')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | name* | string | Name of the customer | | email | string | Email of the customer | | contact | string | Contact number of the customer | | fail_existing | string | If a customer with the same details already exists, the request throws an exception by default. Possible value is `0` or `1`| | notes | array | A key-value pair | **Response:** ```json { "id": "cust_1Aa00000000003", "entity": "customer", "name": "Gaurav Kumar", "email": "Gaurav.Kumar@example.com", "contact": "9000000000", "gstin": null, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "created_at": 1582033731 } ``` ------------------------------------------------------------------------------------------------------- ### Create Order ```php $api->order->create(array('amount' => 100, 'currency' => 'INR', 'receipt' => '123', 'customer_id'=> $customerId, 'method'=>'card', 'token'=>array('max_amount'=>'5000', 'expire_at'=>'2709971120', 'frequency'=>'monthly'), 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | customerId* | string | The id of the customer to be fetched | | receipt | string | Your system order reference id. | | method* | string | Payment method used to make the registration transaction. Possible value is `card`. | | token | array | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#112-create-an-order) are supported | | notes | array | A key-value pair | **Response:** ```json { "id":"order_1Aa00000000002", "entity":"order", "amount":100, "amount_paid":0, "amount_due":100, "currency":"INR", "receipt":"Receipt No. 1", "method":"card", "description":null, "customer_id":"cust_4xbQrmEoA5WJ01", "token":{ "max_amount":5000, "expire_at":2709971120, "frequency":"monthly" }, "offer_id":null, "status":"created", "attempts":0, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "created_at":1565172642 } ``` ------------------------------------------------------------------------------------------------------- ### Create registration link ```php $api->subscription->createSubscriptionRegistration(array('customer'=>array('name'=>'Gaurav Kumar','email'=>'gaurav.kumar@example.com','contact'=>'9123456780'),'type'=>'link','amount'=>100,'currency'=>'INR','description'=>'Registration Link for Gaurav Kumar','subscription_registration'=>array('method'=>'card','max_amount'=>'500','expire_at'=>'1634215992'),'receipt'=>'Receipt No. 5','email_notify'=>1,'sms_notify'=>1,'expire_by'=>1634215992, 'notes'=> array('note_key 1'=> 'Beam me up Scotty','note_key 2'=> 'Tea. Earl Gray. Hot.'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | customer | array | Details of the customer to whom the registration link will be sent. | | type* | array | the value is `link`. | | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | description* | string | A brief description of the payment. | | subscription_registration | array | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#121-create-a-registration-link) are supported | | receipt | string | Your system order reference id. | | sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) | | email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) | | expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | | notes | array | A key-value pair | **Response:** ```json { "id": "inv_FHrXGIpd3N17DX", "entity": "invoice", "receipt": "Receipt No. 24", "invoice_number": "Receipt No. 24", "customer_id": "cust_BMB3EwbqnqZ2EI", "customer_details": { "id": "cust_BMB3EwbqnqZ2EI", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "9123456780", "gstin": null, "billing_address": null, "shipping_address": null, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", "customer_contact": "9123456780" }, "order_id": "order_FHrXGJNngJyEAe", "line_items": [], "payment_id": null, "status": "issued", "expire_by": 4102444799, "issued_at": 1595491014, "paid_at": null, "cancelled_at": null, "expired_at": null, "sms_status": "pending", "email_status": "pending", "date": 1595491014, "terms": null, "partial_payment": false, "gross_amount": 100, "tax_amount": 0, "taxable_amount": 0, "amount": 100, "amount_paid": 0, "amount_due": 100, "currency": "INR", "currency_symbol": "₹", "description": "Registration Link for Gaurav Kumar", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "comment": null, "short_url": "https://rzp.io/i/VSriCfn", "view_less": true, "billing_start": null, "billing_end": null, "type": "link", "group_taxes_discounts": false, "created_at": 1595491014, "idempotency_key": null } ``` ------------------------------------------------------------------------------------------------------- ## Create an order to charge the customer ```php $api->order->create(array('amount' => '100', 'currency' => 'INR', 'customer_id'=> $customerId, 'method'=>'card', 'receipt' => 'Receipt No. 1', 'token'=>array('max_amount'=>'5000', 'expire_at'=>'2709971120', 'frequency'=>'monthly'), 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | customerId* | string | The id of the customer to be fetched | | method* | string | Payment method used to make the registration transaction. Possible value is `card`. | | receipt | string | Your system order reference id. | | token | array | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/subsequent-payments/#31-create-an-order-to-charge-the-customer) are supported | | notes | array | A key-value pair | **Response:** ```json { "id":"order_1Aa00000000002", "entity":"order", "amount":100, "amount_paid":0, "amount_due":100, "currency":"INR", "receipt":"Receipt No. 1", "method":"card", "description":null, "customer_id":"cust_4xbQrmEoA5WJ01", "token":{ "max_amount":5000, "expire_at":2709971120, "frequency":"monthly" }, "offer_id":null, "status":"created", "attempts":0, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "created_at":1565172642 } ``` ------------------------------------------------------------------------------------------------------- ## Create a recurring payment ```php $api->payment->createRecurring(['email'=>'gaurav.kumar@example.com','contact'=>'9123456789','amount'=>100,'currency'=>'INR','order_id'=>$orderid,'customer_id'=>$customerId,'token'=>$tokenId,'recurring'=>'1','description'=>'Creating recurring payment for Gaurav Kumar', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | email* | string | The customer's email address | | contact* | string | The customer's phone number | | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | orderId* | string | The id of the order to be fetched | | customerId* | string | The id of the customer to be fetched | | tokenId* | string | The id of the token to be fetched | | recurring* | boolean | Possible values is `0` or `1` | | description | string | A brief description of the payment. | | notes | array | A key-value pair | **Response:** ```json { "razorpay_payment_id" : "pay_1Aa00000000001", "razorpay_order_id" : "order_1Aa00000000001", "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" } ``` ------------------------------------------------------------------------------------------------------- ### Create an Authorization Payment Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#113-create-an-authorization-payment) for authorization payment ------------------------------------------------------------------------------------------------------- ## Send/Resend notifications ```php $api->invoice->fetch($invoiceId)->notifyBy($medium); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be fetched | | medium* | string | Possible values are `sms` or `email` | **Response:** ```json { "success": true } ``` ------------------------------------------------------------------------------------------------------- ## Cancel registration link ```php $api->invoice->fetch($invoiceId)->cancel(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be fetched | **Response:** ```json { "id": "inv_FHrfRupD2ouKIt", "entity": "invoice", "receipt": "Receipt No. 1", "invoice_number": "Receipt No. 1", "customer_id": "cust_BMB3EwbqnqZ2EI", "customer_details": { "id": "cust_BMB3EwbqnqZ2EI", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "9123456780", "gstin": null, "billing_address": null, "shipping_address": null, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", "customer_contact": "9123456780" }, "order_id": "order_FHrfRw4TZU5Q2L", "line_items": [], "payment_id": null, "status": "cancelled", "expire_by": 4102444799, "issued_at": 1595491479, "paid_at": null, "cancelled_at": 1595491488, "expired_at": null, "sms_status": "sent", "email_status": "sent", "date": 1595491479, "terms": null, "partial_payment": false, "gross_amount": 100, "tax_amount": 0, "taxable_amount": 0, "amount": 100, "amount_paid": 0, "amount_due": 100, "currency": "INR", "currency_symbol": "₹", "description": "Registration Link for Gaurav Kumar", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "comment": null, "short_url": "https://rzp.io/i/QlfexTj", "view_less": true, "billing_start": null, "billing_end": null, "type": "link", "group_taxes_discounts": false, "created_at": 1595491480, "idempotency_key": null } ``` ------------------------------------------------------------------------------------------------------- ## Fetch token by payment id ```php $api->payment->fetch($paymentId); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | paymentId* | string | The id of the payment to be fetched | **Response:** ```json { "id": "pay_FHfqtkRzWvxky4", "entity": "payment", "amount": 100, "currency": "INR", "status": "captured", "order_id": "order_FHfnswDdfu96HQ", "invoice_id": null, "international": false, "method": "card", "amount_refunded": 0, "refund_status": null, "captured": true, "description": null, "card_id": "card_F0zoXUp4IPPGoI", "bank": null, "wallet": null, "vpa": null, "email": "gaurav.kumar@example.com", "contact": "+919876543210", "customer_id": "cust_DtHaBuooGHTuyZ", "token_id": "token_FHfn3rIiM1Z8nr", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "fee": 0, "tax": 0, "error_code": null, "error_description": null, "error_source": null, "error_step": null, "error_reason": null, "acquirer_data": { "auth_code": "541898" }, "created_at": 1595449871 } ``` ------------------------------------------------------------------------------------------------------- ## Fetch tokens by customer id ```php $api->customer->fetch($customerId)->tokens()->all(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | customerId* | string | The id of the customer to be fetched | **Response:** ```json { "entity":"collection", "count":1, "items":[ { "id":"token_HouA2OQR5Z2jTL", "entity":"token", "token":"2JPRk664pZHUWG", "bank":null, "wallet":null, "method":"card", "card":{ "entity":"card", "name":"Gaurav Kumar", "last4":"8950", "network":"Visa", "type":"credit", "issuer":"STCB", "international":false, "emi":false, "sub_type":"consumer", "expiry_month":12, "expiry_year":2021, "flows":{ "otp":true, "recurring":true } }, "recurring":true, "recurring_details":{ "status":"confirmed", "failure_reason":null }, "auth_type":null, "mrn":null, "used_at":1629779657, "created_at":1629779657, "expired_at":1640975399, "dcc_enabled":false, "billing_address":null } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch card ```php $api->card->fetch($cardId); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | cardId* | string | card id to be fetched | ------------------------------------------------------------------------------------------------------- ## Delete tokens ```php $api->customer->fetch($customerId)->tokens()->delete($tokenId); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | customerId* | string | The id of the customer to be fetched | | tokenId* | string | The id of the token to be fetched | **Response:** ```json { "deleted": true } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/)** razorpay/documents/upi.md 0000666 00000037125 15165415146 0011557 0 ustar 00 ## UPI ### Create customer ```php $api->customer->create(array('name' => 'Razorpay User', 'email' => 'customer@razorpay.com','contact'=>'9123456780','notes'=> array('notes_key_1'=> 'Tea, Earl Grey, Hot','notes_key_2'=> 'Tea, Earl Grey… decaf')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | name* | string | Name of the customer | | email | string | Email of the customer | | contact | string | Contact number of the customer | | notes | array | A key-value pair | **Response:** ```json { "id": "cust_1Aa00000000003", "entity": "customer", "name": "Gaurav Kumar", "email": "Gaurav.Kumar@example.com", "contact": "9000000000", "gstin": null, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "created_at": 1582033731 } ``` ------------------------------------------------------------------------------------------------------- ### Create order ```php $api->order->create(array('amount' => 0,'currency' => 'INR','method' => 'upi','customer_id' => 'cust_4xbQrmEoA5WJ01', 'token' => array('max_amount' => 200000, 'expire_at' => 2709971120, 'frequency' => 'monthly'),'receipt' => 'Receipt No. 1' ,'notes' => array('notes_key_1' => 'Beam me up Scotty','notes_key_2' => 'Engage'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | method* | string | The authorization method. In this case the value will be `upi` | | receipt | string | Your system order reference id. | | notes | array | A key-value pair | | token | array | A key-value pair | **Response:** ```json { "id": "order_1Aa00000000002", "entity": "order", "amount": 100, "amount_paid": 0, "amount_due": 100, "currency": "INR", "receipt": "Receipt No. 1", "offer_id": null, "status": "created", "attempts": 0, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "created_at": 1565172642 } ``` ------------------------------------------------------------------------------------------------------- ### Create an Authorization Payment Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/upi/authorization-transaction/#113-create-an-authorization-payment) for authorization payment ------------------------------------------------------------------------------------------------------- ### Create registration link ```php $api->subscription->createSubscriptionRegistration(array('customer'=>array('name'=>'Gaurav Kumar','email'=>'gaurav.kumar@example.com','contact'=>'9123456780'),'type'=>'link','amount'=>100,'currency'=>'INR','description'=>'Registration Link for Gaurav Kumar','subscription_registration'=>array('method'=>'upi','max_amount'=>'500','expire_at'=>'1634215992'),'receipt'=>'Receipt No. 5','email_notify'=>1,'sms_notify'=>1,'expire_by'=>1634215992,'notes' => array('note_key 1' => 'Beam me up Scotty','note_key 2' => 'Tea. Earl Gray. Hot.'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | customer | array | Details of the customer to whom the registration link will be sent. | | type* | string | In this case, the value is `link`. | | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | | amount* | integer | The payment amount in the smallest currency sub-unit. | | description* | string | A description that appears on the hosted page. For example, `12:30 p.m. Thali meals (Gaurav Kumar`). | | subscription_registration | array | Details of the authorization payment. | | notes | array | A key-value pair | **Response:** ```json { "id": "inv_FHr1ekX0r2VCVK", "entity": "invoice", "receipt": "Receipt No. 23", "invoice_number": "Receipt No. 23", "customer_id": "cust_BMB3EwbqnqZ2EI", "customer_details": { "id": "cust_BMB3EwbqnqZ2EI", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "9123456780", "gstin": null, "billing_address": null, "shipping_address": null, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", "customer_contact": "9123456780" }, "order_id": "order_FHr1ehR3nmNeXo", "line_items": [], "payment_id": null, "status": "issued", "expire_by": 4102444799, "issued_at": 1595489219, "paid_at": null, "cancelled_at": null, "expired_at": null, "sms_status": "pending", "email_status": "pending", "date": 1595489219, "terms": null, "partial_payment": false, "gross_amount": 100, "tax_amount": 0, "taxable_amount": 0, "amount": 100, "amount_paid": 0, "amount_due": 100, "currency": "INR", "currency_symbol": "₹", "description": "Registration Link for Gaurav Kumar", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "comment": null, "short_url": "https://rzp.io/i/ak1WxDB", "view_less": true, "billing_start": null, "billing_end": null, "type": "link", "group_taxes_discounts": false, "created_at": 1595489219, "idempotency_key": null } ``` ------------------------------------------------------------------------------------------------------- ### Send/Resend notifications ```php $api->invoice->fetch($invoiceId)->notify($medium); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be notified | | medium* | string | `sms`/`email`, Medium through which notification should be sent. | **Response:** ```json { "success": true } ``` ------------------------------------------------------------------------------------------------------- ### Cancel a registration link ```php $api->invoice->fetch($invoiceId)->cancel(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be cancelled | **Response:** ```json { "id": "inv_FHrfRupD2ouKIt", "entity": "invoice", "receipt": "Receipt No. 1", "invoice_number": "Receipt No. 1", "customer_id": "cust_BMB3EwbqnqZ2EI", "customer_details": { "id": "cust_BMB3EwbqnqZ2EI", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "9123456780", "gstin": null, "billing_address": null, "shipping_address": null, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", "customer_contact": "9123456780" }, "order_id": "order_FHrfRw4TZU5Q2L", "line_items": [], "payment_id": null, "status": "cancelled", "expire_by": 4102444799, "issued_at": 1595491479, "paid_at": null, "cancelled_at": 1595491488, "expired_at": null, "sms_status": "sent", "email_status": "sent", "date": 1595491479, "terms": null, "partial_payment": false, "gross_amount": 100, "tax_amount": 0, "taxable_amount": 0, "amount": 100, "amount_paid": 0, "amount_due": 100, "currency": "INR", "currency_symbol": "₹", "description": "Registration Link for Gaurav Kumar", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "comment": null, "short_url": "https://rzp.io/i/QlfexTj", "view_less": true, "billing_start": null, "billing_end": null, "type": "link", "group_taxes_discounts": false, "created_at": 1595491480, "idempotency_key": null } ``` ------------------------------------------------------------------------------------------------------- ### Fetch token by payment ID ```php $api->payment->fetch($paymentId); ``` **Parameters:** | Name | Type | Description | |------------|--------|-----------------------------------| | paymentId* | string | Id of the payment to be retrieved | **Response:** ```json { "id": "pay_FHfAzEJ51k8NLj", "entity": "payment", "amount": 100, "currency": "INR", "status": "captured", "order_id": "order_FHfANdTUYeP8lb", "invoice_id": null, "international": false, "method": "upi", "amount_refunded": 0, "refund_status": null, "captured": true, "description": null, "card_id": null, "bank": null, "wallet": null, "vpa": "gaurav.kumar@upi", "email": "gaurav.kumar@example.com", "contact": "+919876543210", "customer_id": "cust_DtHaBuooGHTuyZ", "token_id": "token_FHfAzGzREc1ug6", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "fee": 0, "tax": 0, "error_code": null, "error_description": null, "error_source": null, "error_step": null, "error_reason": null, "acquirer_data": { "rrn": "854977234911", "upi_transaction_id": "D0BED5A062ECDB3E9B3A1071C96BB273" }, "created_at": 1595447490 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch tokens by customer ID ```php $api->customer->fetch($customerId)->tokens()->all(); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | customerId* | string | The id of the customer to be fetched | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "token_FHfAzGzREc1ug6", "entity": "token", "token": "9KHsdPaCELeQ0t", "bank": null, "wallet": null, "method": "upi", "vpa": { "username": "gaurav.kumar", "handle": "upi", "name": null }, "recurring": true, "recurring_details": { "status": "confirmed", "failure_reason": null }, "auth_type": null, "mrn": null, "used_at": 1595447490, "created_at": 1595447490, "start_time": 1595447455, "dcc_enabled": false } ] } ``` ------------------------------------------------------------------------------------------------------- ### Delete token ```php $api->customer->fetch($customerId)->tokens()->delete($tokenId); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | customerId* | string | The id of the customer to be fetched | | tokenId* | string | The id of the token to be fetched | **Response:** ```json { "deleted": true } ``` ------------------------------------------------------------------------------------------------------- ### Create an order to charge the customer ```php $api->order->create(array('receipt' => '123', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | | notes | array | A key-value pair | **Response:** ```json { "id":"order_1Aa00000000002", "entity":"order", "amount":1000, "amount_paid":0, "amount_due":1000, "currency":"INR", "receipt":"Receipt No. 1", "offer_id":null, "status":"created", "attempts":0, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "created_at":1579782776 } ``` ------------------------------------------------------------------------------------------------------- ### Create a recurring payment ```php $api->payment->createRecurring(array('email'=>'gaurav.kumar@example.com','contact'=>'9123456789','amount'=>100,'currency'=>'INR','order_id'=>'order_1Aa00000000002','customer_id'=>'cust_1Aa00000000001','token'=>'token_1Aa00000000001','recurring'=>'1','description'=>'Creating recurring payment for Gaurav Kumar')); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | email* | string | The customer's email address. | | contact* | string | The customer's phone number. | | amount* | integer | The amount you want to charge your customer. This should be the same as the amount in the order. | | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | | order_id* | string | The unique identifier of the order created. | | customer_id* | string | The `customer_id` for the customer you want to charge. | | token* | string | The `token_id` generated when the customer successfully completes the authorization payment. Different payment instruments for the same customer have different `token_id`.| | recurring* | string | Determines if recurring payment is enabled or not. Possible values:<br>* `1` - Recurring is enabled.* `0` - Recurring is not enabled.| | description* | string | A user-entered description for the payment.| | notes* | array | Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. | **Response:** ```json { "razorpay_payment_id" : "pay_1Aa00000000001", "razorpay_order_id" : "order_1Aa00000000001", "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/recurring-payments/upi/authorization-transaction/)** razorpay/documents/addon.md 0000666 00000011000 15165415146 0012027 0 ustar 00 ## Addons ### Create an addon ```php $api->subscription->fetch($subscriptionId)->createAddon(array('item' => array('name' => 'Extra Chair', 'amount' => 30000, 'currency' => 'INR'), 'quantity' => 2)) ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | subscriptionId* | boolean | The subscription ID to which the add-on is being added. | | items* | array | Details of the add-on you want to create. | | quantity* | integer | This specifies the number of units of the add-on to be charged to the customer. | **Response:** ```json { "id":"ao_00000000000001", "entity":"addon", "item":{ "id":"item_00000000000001", "active":true, "name":"Extra appala (papadum)", "description":"1 extra oil fried appala with meals", "amount":30000, "unit_amount":30000, "currency":"INR", "type":"addon", "unit":null, "tax_inclusive":false, "hsn_code":null, "sac_code":null, "tax_rate":null, "tax_id":null, "tax_group_id":null, "created_at":1581597318, "updated_at":1581597318 }, "quantity":2, "created_at":1581597318, "subscription_id":"sub_00000000000001", "invoice_id":null } ``` ------------------------------------------------------------------------------------------------------- ### Fetch all addons ```php $api->addon->all($options); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | from | timestamp | timestamp after which the payments were created | | to | timestamp | timestamp before which the payments were created | | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "ao_00000000000002", "entity": "addon", "item": { "id": "item_00000000000002", "active": true, "name": "Extra sweet", "description": "1 extra sweet of the day with meals", "amount": 90000, "unit_amount": 90000, "currency": "INR", "type": "addon", "unit": null, "tax_inclusive": false, "hsn_code": null, "sac_code": null, "tax_rate": null, "tax_id": null, "tax_group_id": null, "created_at": 1581597318, "updated_at": 1581597318 }, "quantity": 1, "created_at": 1581597318, "subscription_id": "sub_00000000000001", "invoice_id": "inv_00000000000001" } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch an addon ```php $api->addon->fetch($addonId); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | addonId* | string | addon id to be fetched | **Response:** ```json { "id":"ao_00000000000001", "entity":"addon", "item":{ "id":"item_00000000000001", "active":true, "name":"Extra appala (papadum)", "description":"1 extra oil fried appala with meals", "amount":30000, "unit_amount":30000, "currency":"INR", "type":"addon", "unit":null, "tax_inclusive":false, "hsn_code":null, "sac_code":null, "tax_rate":null, "tax_id":null, "tax_group_id":null, "created_at":1581597318, "updated_at":1581597318 }, "quantity":2, "created_at":1581597318, "subscription_id":"sub_00000000000001", "invoice_id":null } ``` ------------------------------------------------------------------------------------------------------- ### Delete an addon ```php $api->addon->fetch($addonId)->delete(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | addonId* | string | addon id to be deleted | **Response:** ```json [] ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/subscriptions/#add-ons)** razorpay/documents/emandate.md 0000666 00000034523 15165415146 0012537 0 ustar 00 ## Emandates ### Create customer ```php $api->customer->create(array('name' => 'Razorpay User', 'email' => 'customer@razorpay.com','contact'=>'9123456780','notes'=> array('notes_key_1'=> 'Tea, Earl Grey, Hot','notes_key_2'=> 'Tea, Earl Grey… decaf')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | name* | string | Name of the customer | | email | string | Email of the customer | | contact | string | Contact number of the customer | | notes | array | A key-value pair | **Response:** ```json { "id": "cust_1Aa00000000003", "entity": "customer", "name": "Gaurav Kumar", "email": "Gaurav.Kumar@example.com", "contact": "9000000000", "gstin": null, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "created_at": 1582033731 } ``` ------------------------------------------------------------------------------------------------------- ### Create order ```php $api->order->create(array('amount' => 0,'currency' => 'INR','method' => 'emandate','customer_id' => 'cust_1Aa00000000001','receipt' => 'Receipt No. 1','notes' => array('notes_key_1' => 'Beam me up Scotty','notes_key_2' => 'Engage'),'token' => array('auth_type' => 'netbanking','max_amount' => 9999900,'expire_at' => 4102444799,'notes' => array('notes_key_1' => 'Tea, Earl Grey, Hot','notes_key_2' => 'Tea, Earl Grey… decaf.'),'bank_account' => array('beneficiary_name' => 'Gaurav Kumar','account_number' => '1121431121541121','account_type' => 'savings','ifsc_code' => 'HDFC0000001')))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | method* | string | The authorization method. In this case the value will be `emandate` | | receipt | string | Your system order reference id. | | notes | array | A key-value pair | | token | array | A key-value pair | **Response:** Create order response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#112-create-an-order) ------------------------------------------------------------------------------------------------------- ### Create an Authorization Payment Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#113-create-an-authorization-payment) for authorization payment ------------------------------------------------------------------------------------------------------- ### Create registration link ```php $api->subscription->createSubscriptionRegistration(array('customer'=>array('name'=>'Gaurav Kumar','email'=>'gaurav.kumar@example.com','contact'=>'9123456780'),'type'=>'link','amount'=>100,'currency'=>'INR','description'=>'Registration Link for Gaurav Kumar','subscription_registration'=>array('method'=>'emandate','max_amount'=>'500','expire_at'=>'1634215992'),'receipt'=>'Receipt No. 5','email_notify'=>1,'sms_notify'=>1,'expire_by'=>1634215992,'notes' => array('note_key 1' => 'Beam me up Scotty','note_key 2' => 'Tea. Earl Gray. Hot.'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | customer | array | Details of the customer to whom the registration link will be sent. | | type* | string | In this case, the value is `link`. | | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | | amount* | integer | The payment amount in the smallest currency sub-unit. | | description* | string | A description that appears on the hosted page. For example, `12:30 p.m. Thali meals (Gaurav Kumar`). | | subscription_registration | array | Details of the authorization payment. | | notes | array | A key-value pair | **Response:** Create registration link response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#121-create-a-registration-link) ------------------------------------------------------------------------------------------------------- ### Send/Resend notifications ```php $api->invoice->fetch($invoiceId)->notify($medium); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be notified | | medium* | string | `sms`/`email`, Medium through which notification should be sent. | **Response:** ```json { "success": true } ``` ------------------------------------------------------------------------------------------------------- ### Cancel a registration link ```php $api->invoice->fetch($invoiceId)->cancel(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be cancelled | **Response:** ```json { "id": "inv_FHrfRupD2ouKIt", "entity": "invoice", "receipt": "Receipt No. 1", "invoice_number": "Receipt No. 1", "customer_id": "cust_BMB3EwbqnqZ2EI", "customer_details": { "id": "cust_BMB3EwbqnqZ2EI", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "9123456780", "gstin": null, "billing_address": null, "shipping_address": null, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", "customer_contact": "9123456780" }, "order_id": "order_FHrfRw4TZU5Q2L", "line_items": [], "payment_id": null, "status": "cancelled", "expire_by": 4102444799, "issued_at": 1595491479, "paid_at": null, "cancelled_at": 1595491488, "expired_at": null, "sms_status": "sent", "email_status": "sent", "date": 1595491479, "terms": null, "partial_payment": false, "gross_amount": 100, "tax_amount": 0, "taxable_amount": 0, "amount": 100, "amount_paid": 0, "amount_due": 100, "currency": "INR", "currency_symbol": "₹", "description": "Registration Link for Gaurav Kumar", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "comment": null, "short_url": "https://rzp.io/i/QlfexTj", "view_less": true, "billing_start": null, "billing_end": null, "type": "link", "group_taxes_discounts": false, "created_at": 1595491480, "idempotency_key": null } ``` ------------------------------------------------------------------------------------------------------- ### Fetch token by payment ID ```php $api->payment->fetch($paymentId); ``` **Parameters:** | Name | Type | Description | |------------|--------|-----------------------------------| | paymentId* | string | Id of the payment to be retrieved | **Response:** ```json { "id": "pay_FHf9a7AO0iXM9I", "entity": "payment", "amount": 0, "currency": "INR", "status": "captured", "order_id": "order_FHf9OwSeyetnKC", "invoice_id": "inv_FHf9P2hhXEti7i", "international": false, "method": "emandate", "amount_refunded": 0, "refund_status": null, "captured": true, "description": null, "card_id": null, "bank": "HDFC", "wallet": null, "vpa": null, "email": "gaurav.kumar@example.com", "contact": "+919876543210", "customer_id": "cust_DtHaBuooGHTuyZ", "token_id": "token_FHf9aAZR9hWJkq", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "fee": 0, "tax": 0, "error_code": null, "error_description": null, "error_source": null, "error_step": null, "error_reason": null, "acquirer_data": {}, "created_at": 1595447410 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch tokens by customer ID ```php $api->customer->fetch($customerId)->tokens()->all(); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | customerId* | string | The id of the customer to be fetched | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "token_FHf94Uym9tdYFJ", "entity": "token", "token": "2wDPM7VAlXtjAR", "bank": "HDFC", "wallet": null, "method": "emandate", "vpa": null, "recurring": true, "recurring_details": { "status": "confirmed", "failure_reason": null }, "auth_type": "netbanking", "mrn": null, "used_at": 1595447381, "created_at": 1595447381, "bank_details": { "beneficiary_name": "Gaurav Kumar", "account_number": "1121431121541121", "ifsc": "HDFC0000001", "account_type": "savings" }, "max_amount": 9999900, "expired_at": 1689971140, "dcc_enabled": false } ] } ``` ------------------------------------------------------------------------------------------------------- ### Delete token ```php $api->customer->fetch($customerId)->tokens()->delete($tokenId); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | customerId* | string | The id of the customer to be fetched | | tokenId* | string | The id of the token to be fetched | **Response:** ```json { "deleted": true } ``` ------------------------------------------------------------------------------------------------------- ### Create an order to charge the customer ```php $api->order->create(array('receipt' => '123', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | | notes | array | A key-value pair | **Response:** ```json { "id":"order_1Aa00000000002", "entity":"order", "amount":1000, "amount_paid":0, "amount_due":1000, "currency":"INR", "receipt":"Receipt No. 1", "offer_id":null, "status":"created", "attempts":0, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "created_at":1579782776 } ``` ------------------------------------------------------------------------------------------------------- ### Create a Recurring Payment ```php $api->payment->createRecurring(array('email'=>'gaurav.kumar@example.com','contact'=>'9123456789','amount'=>100,'currency'=>'INR','order_id'=>'order_1Aa00000000002','customer_id'=>'cust_1Aa00000000001','token'=>'token_1Aa00000000001','recurring'=>'1','description'=>'Creating recurring payment for Gaurav Kumar')); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | email* | string | The customer's email address. | | contact* | string | The customer's phone number. | | amount* | integer | The amount you want to charge your customer. This should be the same as the amount in the order. | | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | | order_id* | string | The unique identifier of the order created. | | customer_id* | string | The `customer_id` for the customer you want to charge. | | token* | string | The `token_id` generated when the customer successfully completes the authorization payment. Different payment instruments for the same customer have different `token_id`.| | recurring* | string | Determines if recurring payment is enabled or not. Possible values:<br>* `1` - Recurring is enabled.* `0` - Recurring is not enabled.| | description* | string | A user-entered description for the payment.| | notes* | array | Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. | **Response:** ```json { "razorpay_payment_id" : "pay_1Aa00000000001", "razorpay_order_id" : "order_1Aa00000000001", "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/)** razorpay/documents/plan.md 0000666 00000011024 15165415146 0011702 0 ustar 00 ## Plans ### Create plan ```php $api->plan->create(array('period' => 'weekly', 'interval' => 1, 'item' => array('name' => 'Test Weekly 1 plan', 'description' => 'Description for the weekly 1 plan', 'amount' => 600, 'currency' => 'INR'),'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | period* | string | Used together with `interval` to define how often the customer should be charged.Possible values:<br>1.`daily` <br>2.`weekly`<br>3.`monthly` <br>4.`yearly` | | interval* | string | Used together with `period` to define how often the customer should be charged | | items* | array | Details of the plan. For more details please refer [here](https://razorpay.com/docs/api/subscriptions/#create-a-plan) | | notes | array | Notes you can enter for the contact for future reference. | **Response:** ```json { "id":"plan_00000000000001", "entity":"plan", "interval":1, "period":"weekly", "item":{ "id":"item_00000000000001", "active":true, "name":"Test plan - Weekly", "description":"Description for the test plan - Weekly", "amount":69900, "unit_amount":69900, "currency":"INR", "type":"plan", "unit":null, "tax_inclusive":false, "hsn_code":null, "sac_code":null, "tax_rate":null, "tax_id":null, "tax_group_id":null, "created_at":1580219935, "updated_at":1580219935 }, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "created_at":1580219935 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch all plans ```php $api->plan->all($options); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | from | timestamp | timestamp after which the payments were created | | to | timestamp | timestamp before which the payments were created | | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "plan_00000000000001", "entity": "plan", "interval": 1, "period": "weekly", "item": { "id": "item_00000000000001", "active": true, "name": "Test plan - Weekly", "description": "Description for the test plan - Weekly", "amount": 69900, "unit_amount": 69900, "currency": "INR", "type": "plan", "unit": null, "tax_inclusive": false, "hsn_code": null, "sac_code": null, "tax_rate": null, "tax_id": null, "tax_group_id": null, "created_at": 1580220492, "updated_at": 1580220492 }, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "created_at": 1580220492 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch particular plan ```php $api->plan->fetch($planId); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | planId | string | The id of the plan to be fetched | **Response:** ```json { "id":"plan_00000000000001", "entity":"plan", "interval":1, "period":"weekly", "item":{ "id":"item_00000000000001", "active":true, "name":"Test plan - Weekly", "description":"Description for the test plan - Weekly", "amount":69900, "unit_amount":69900, "currency":"INR", "type":"plan", "unit":null, "tax_inclusive":false, "hsn_code":null, "sac_code":null, "tax_rate":null, "tax_id":null, "tax_group_id":null, "created_at":1580220492, "updated_at":1580220492 }, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "created_at":1580220492 } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/subscriptions/#plans)** razorpay/documents/virtualaccount.md 0000666 00000035462 15165415146 0014027 0 ustar 00 ## Virtual account ### Create a virtual account ```php $api->virtualAccount->create(array('receivers' => array('types' => array('bank_account')),'description' => 'Virtual Account created for Raftar Soft','customer_id' => 'cust_CaVDm8eDRSXYME','close_by' => 1681615838,'notes' => array('project_name' => 'Banking Software'))); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | receivers* | array | Array that defines what receivers are available for this Virtual Account | | description | string | A brief description of the virtual account. | | customer_id | string | Unique identifier of the customer to whom the virtual account must be tagged. | | close_by | integer | UNIX timestamp at which the virtual account is scheduled to be automatically closed. | | notes | integer | Any custom notes you might want to add to the virtual account can be entered here. | **Response:** ```json { "id":"va_DlGmm7jInLudH9", "name":"Acme Corp", "entity":"virtual_account", "status":"active", "description":"Virtual Account created for Raftar Soft", "amount_expected":null, "notes":{ "project_name":"Banking Software" }, "amount_paid":0, "customer_id":"cust_CaVDm8eDRSXYME", "receivers":[ { "id":"ba_DlGmm9mSj8fjRM", "entity":"bank_account", "ifsc":"RATN0VAAPIS", "bank_name": "RBL Bank", "name":"Acme Corp", "notes":[], "account_number":"2223330099089860" } ], "close_by":1681615838, "closed_at":null, "created_at":1574837626 } ``` ------------------------------------------------------------------------------------------------------- ### Create a virtual account with TPV ```php $api->virtualAccount->create(array('receivers' => array('types'=> array('bank_account')),'allowed_payers' => array(array('type'=>'bank_account','bank_account'=>array('ifsc'=>'RATN0VAAPIS','account_number'=>'2223330027558515'))),'description' => 'Virtual Account created for Raftar Soft','customer_id' => 'cust_HssUOFiOd2b1TJ', 'notes' => array('project_name' => 'Banking Software'))); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | receivers* | array | Array that defines what receivers are available for this Virtual Account | | allowed_payers* | array | All parameters listed [here](https://razorpay.com/docs/api/smart-collect-tpv/#create-virtual-account) are supported **Response:** ```json { "id":"va_DlGmm7jInLudH9", "name":"Acme Corp", "entity":"virtual_account", "status":"active", "description":"Virtual Account created for Raftar Soft", "amount_expected":null, "notes":{ "project_name":"Banking Software" }, "amount_paid":0, "customer_id":"cust_CaVDm8eDRSXYME", "receivers":[ { "id":"ba_DlGmm9mSj8fjRM", "entity":"bank_account", "ifsc":"RATN0VAAPIS", "bank_name": "RBL Bank", "name":"Acme Corp", "notes":[], "account_number":"2223330099089860" } ], "allowed_payers": [ { "type": "bank_account", "id":"ba_DlGmm9mSj8fjRM", "bank_account": { "ifsc": "UTIB0000013", "account_number": "914010012345679" } }, { "type": "bank_account", "id":"ba_Cmtnm5tSj6agUW", "bank_account": { "ifsc": "UTIB0000014", "account_number": "914010012345680" } } ], "close_by":1681615838, "closed_at":null, "created_at":1574837626 } ``` ------------------------------------------------------------------------------------------------------- ### Create static/dynamic qr ```php $api->virtualAccount->create(array('receivers' => array('types' => array('qr_code')), 'description' => 'First QR code', 'amount_expected' => 100, 'notes' => array('receiver_key' => 'receiver_value'))); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | receivers* | array | Array that defines what receivers are available for this Virtual Account | | description | string | A brief description of the payment. | | amount_expected | integer | The maximum amount you expect to receive in this virtual account. Pass `69999` for ₹699.99. | | notes | array | All keys listed [here](https://razorpay.com/docs/payments/payments/payment-methods/bharatqr/api/#create) are supported | **Response:** ```json { "id": "va_4xbQrmEoA5WJ0G", "name": "Acme Corp", "entity": "virtual_account", "status": "active", "description": "First Payment by BharatQR", "amount_expected": null, "notes": { "reference_key": "reference_value" }, "amount_paid": 0, "customer_id": "cust_805c8oBQdBGPwS", "receivers": [ { "id": "qr_4lsdkfldlteskf", "entity": "qr_code", "reference": "AgdeP8aBgZGckl", "short_url": "https://rzp.io/i/PLs03pOc" } ], "close_by": null, "closed_at": null, "created_at": 1607938184 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch virtual account by id ```php $api->virtualAccount->fetch($virtualId); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | virtualId* | string | The id of the virtual to be updated | **Response:** For fetch virtual account by id response please click [here](https://razorpay.com/docs/api/smart-collect/#fetch-a-virtual-account-by-id) ------------------------------------------------------------------------------------------------------- ### Fetch all virtual account ```php $api->virtualAccount->all($options); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | from | timestamp | timestamp after which the payments were created | | to | timestamp | timestamp before which the payments were created | | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "va_Di5gbNptcWV8fQ", "name": "Acme Corp", "entity": "virtual_account", "status": "closed", "description": "Virtual Account created for M/S ABC Exports", "amount_expected": 2300, "notes": { "material": "teakwood" }, "amount_paid": 239000, "customer_id": "cust_DOMUFFiGdCaCUJ", "receivers": [ { "id": "ba_Di5gbQsGn0QSz3", "entity": "bank_account", "ifsc": "RATN0VAAPIS", "bank_name": "RBL Bank", "name": "Acme Corp", "notes": [], "account_number": "1112220061746877" } ], "close_by": 1574427237, "closed_at": 1574164078, "created_at": 1574143517 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch payments for a virtual account ```php $api->virtualAccount->fetch($virtualId)->payments($options); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | virtualId* | string | The id of the virtual to be updated | | from | timestamp | timestamp after which the payments were created | | to | timestamp | timestamp before which the payments were created | | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "pay_Di5iqCqA1WEHq6", "entity": "payment", "amount": 239000, "currency": "INR", "status": "captured", "order_id": null, "invoice_id": null, "international": false, "method": "bank_transfer", "amount_refunded": 0, "refund_status": null, "captured": true, "description": "", "card_id": null, "bank": null, "wallet": null, "vpa": null, "email": "saurav.kumar@example.com", "contact": "+919972139994", "customer_id": "cust_DOMUFFiGdCaCUJ", "notes": [], "fee": 2820, "tax": 430, "error_code": null, "error_description": null, "created_at": 1574143644 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch payment details using id and transfer method ```php $api->payment->fetch($paymentId)->bankTransfer(); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | virtualId* | string | The id of the virtual to be updated | **Response:** ```json { "id": "bt_Di5iqCElVyRlCb", "entity": "bank_transfer", "payment_id": "pay_Di5iqCqA1WEHq6", "mode": "NEFT", "bank_reference": "157414364471", "amount": 239000, "payer_bank_account": { "id": "ba_Di5iqSxtYrTzPU", "entity": "bank_account", "ifsc": "UTIB0003198", "bank_name": "Axis Bank", "name": "Acme Corp", "notes": [], "account_number": "765432123456789" }, "virtual_account_id": "va_Di5gbNptcWV8fQ", "virtual_account": { "id": "va_Di5gbNptcWV8fQ", "name": "Acme Corp", "entity": "virtual_account", "status": "closed", "description": "Virtual Account created for M/S ABC Exports", "amount_expected": 2300, "notes": { "material": "teakwood" }, "amount_paid": 239000, "customer_id": "cust_DOMUFFiGdCaCUJ", "receivers": [ { "id": "ba_Di5gbQsGn0QSz3", "entity": "bank_account", "ifsc": "RATN0VAAPIS", "bank_name": "RBL Bank", "name": "Acme Corp", "notes": [], "account_number": "1112220061746877" } ], "close_by": 1574427237, "closed_at": 1574164078, "created_at": 1574143517 } } ``` ------------------------------------------------------------------------------------------------------- ### Refund payments made to a virtual account ```php $api->payment->fetch($paymentId)->refunds(); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | paymentId* | string | The id of the payment to be updated | **Response:** ```json { "id": "rfnd_E6j36ZEKvsWsEn", "entity": "refund", "amount": 100, "currency": "INR", "payment_id": "pay_E54n391WnEAV9H", "notes": { "key_1": "value1", "key_2": "value2" }, "receipt": null, "acquirer_data": { "rrn": null }, "created_at": 1579522301 } ``` ------------------------------------------------------------------------------------------------------- ### Add receiver to an existing virtual account ```php $api->virtualAccount->fetch($virtualId)->addReceiver(array('types' => array('vpa'),'vpa' => array('descriptor'=>'gauravkumar'))); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | virtualId* | string | The id of the virtual to be updated | | types* | array | The receiver type to be added to the virtual account. Possible values are `vpa` or `bank_account` | | vpa | array | This is to be passed only when `vpa` is passed as the receiver types. | **Response:** For add receiver to an existing virtual account response please click [here](https://razorpay.com/docs/api/smart-collect/#add-receiver-to-an-existing-virtual-account) ------------------------------------------------------------------------------------------------------- ### Add an Allowed Payer Account ```php $api->virtualAccount->fetch($virtualId)->addAllowedPayer(array('types' => 'bank_account','bank_account' => array('ifsc'=>'UTIB0000013','account_number'=>'914010012345679'))); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | virtualId* | string | The id of the virtual to be updated | | bank_account* | array | Indicates the bank account details such as `ifsc` and `account_number` | **Response:** ```json { "id":"va_DlGmm7jInLudH9", "name":"Acme Corp", "entity":"virtual_account", "status":"active", "description":"Virtual Account created for Raftar Soft", "amount_expected":null, "notes":{ "project_name":"Banking Software" }, "amount_paid":0, "customer_id":"cust_CaVDm8eDRSXYME", "receivers":[ { "id":"ba_DlGmm9mSj8fjRM", "entity":"bank_account", "ifsc":"RATN0VAAPIS", "bank_name": "RBL Bank", "name":"Acme Corp", "notes":[], "account_number":"2223330099089860" } ], "allowed_payers": [ { "type": "bank_account", "id":"ba_DlGmm9mSj8fjRM", "bank_account": { "ifsc": "UTIB0000013", "account_number": "914010012345679" } } ], "close_by":1681615838, "closed_at":null, "created_at":1574837626 } ``` ------------------------------------------------------------------------------------------------------- ### Delete an Allowed Payer Account ```php $api->virtualAccount->fetch($virtualId)->deleteAllowedPayer($allowedPayersId); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | virtualId* | string | The id of the virtual to be updated | | allowedPayersId* | string | The id of the allowed payers to be updated | **Response:** ```json {} ``` ------------------------------------------------------------------------------------------------------- ### Close virtual account ```php $api->virtualAccount->fetch($virtualId)->close(); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | virtualId* | string | The id of the virtual to be updated | **Response:** For close virtual account response please click [here](https://razorpay.com/docs/api/smart-collect/#close-a-virtual-account) ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/smart-collect/api/)** razorpay/documents/papernach.md 0000666 00000046002 15165415146 0012715 0 ustar 00 ## Paper NACH ### Create customer ```php $api->customer->create(array('name' => 'Razorpay User', 'email' => 'customer@razorpay.com','contact'=>'9123456780','notes'=> array('notes_key_1'=> 'Tea, Earl Grey, Hot','notes_key_2'=> 'Tea, Earl Grey… decaf')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | name* | string | Name of the customer | | email | string | Email of the customer | | contact | string | Contact number of the customer | | notes | array | A key-value pair | **Response:** ```json { "id": "cust_1Aa00000000003", "entity": "customer", "name": "Gaurav Kumar", "email": "Gaurav.Kumar@example.com", "contact": "9000000000", "gstin": null, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "created_at": 1582033731 } ``` ------------------------------------------------------------------------------------------------------- ### Create order ```php $api->order->create(array('amount' => 0,'currency' => 'INR','method' => 'nach','customer_id' => 'cust_1Aa00000000001','receipt' => 'Receipt No. 1', 'notes' => array('notes_key_1' => 'Beam me up Scotty','notes_key_2' => 'Engage'),'token' => array('auth_type' => 'physical','max_amount' => 10000000,'expire_at' => 2709971120,'notes' => array('notes_key_1' => 'Tea, Earl Grey, Hot','notes_key_2' => 'Tea, Earl Grey… decaf.'),'bank_account' => array('account_number' => '11214311215411','ifsc_code' => 'HDFC0000001','beneficiary_name' => 'Gaurav Kumar','account_type' => 'savings'),'nach' => array('form_reference1' => 'Recurring Payment for Gaurav Kumar','form_reference2' => 'Method Paper NACH','description' => 'Paper NACH Gaurav Kumar')))); ``` **Parameters:** All parameters listed [here](https://razorpay.com/docs/api/route/#create-transfers-from-payments) are supported **Response:** ```json { "id":"order_1Aa00000000001", "entity":"order", "amount":0, "amount_paid":0, "amount_due":0, "currency":"INR", "receipt":"rcptid #10", "offer_id":null, "offers":{ "entity":"collection", "count":0, "items":[ ] }, "status":"created", "attempts":0, "notes":{ "notes_key_1":"Beam me up Scotty", "notes_key_2":"Engage" }, "created_at":1579775420, "token":{ "method":"nach", "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "recurring_status":null, "failure_reason":null, "currency":"INR", "max_amount":10000000, "auth_type":"physical", "expire_at":1580480689, "nach":{ "create_form":true, "form_reference1":"Recurring Payment for Gaurav Kumar", "form_reference2":"Method Paper NACH", "prefilled_form":"https://rzp.io/i/bitw", "upload_form_url":"https://rzp.io/i/gts", "description":"Paper NACH Gaurav Kumar" }, "bank_account":{ "ifsc":"HDFC0000001", "bank_name":"HDFC Bank", "name":"Gaurav Kumar", "account_number":"11214311215411", "account_type":"savings", "beneficiary_email":"gaurav.kumar@example.com", "beneficiary_mobile":"9876543210" }, "first_payment_amount":0 } } ``` ------------------------------------------------------------------------------------------------------- ### Create an Authorization Payment Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/paper-nach/authorization-transaction/#113-create-an-authorization-payment) for authorization payment ------------------------------------------------------------------------------------------------------- ### Create registration link ```php $api->subscription->createSubscriptionRegistration(array('customer' => array('name' => 'Gaurav Kumar','email' => 'gaurav.kumar@example.com','contact' => '9123456780'),'amount' => 0,'currency' => 'INR','type' => 'link','description' => '12 p.m. Meals','subscription_registration' => array('method' => 'nach','auth_type' => 'physical','bank_account' => array('beneficiary_name' => 'Gaurav Kumar','account_number' => '11214311215411','account_type' => 'savings','ifsc_code' => 'HDFC0001233'),'nach' => array('form_reference1' => 'Recurring Payment for Gaurav Kumar','form_reference2' => 'Method Paper NACH'),'expire_at' => 1947483647,'max_amount' => 50000),'receipt' => 'Receipt No. 1','sms_notify' => 1,'email_notify' => 1,'expire_by' => 1647483647,'notes' => array('note_key 1' => 'Beam me up Scotty','note_key 2' => 'Tea. Earl Gray. Hot.'))); ``` **Parameters:** All parameters listed [here](https://razorpay.com/docs/api/recurring-payments/paper-nach/authorization-transaction/#121-create-a-registration-link) are supported **Response:** ```json { "id": "inv_FHrZiAubEzDdaq", "entity": "invoice", "receipt": "Receipt No. 27", "invoice_number": "Receipt No. 27", "customer_id": "cust_BMB3EwbqnqZ2EI", "customer_details": { "id": "cust_BMB3EwbqnqZ2EI", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "9123456780", "gstin": null, "billing_address": null, "shipping_address": null, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", "customer_contact": "9123456780" }, "order_id": "order_FHrZiBOkWHZPOp", "line_items": [], "payment_id": null, "status": "issued", "expire_by": 1647483647, "issued_at": 1595491154, "paid_at": null, "cancelled_at": null, "expired_at": null, "sms_status": "sent", "email_status": "sent", "date": 1595491154, "terms": null, "partial_payment": false, "gross_amount": 0, "tax_amount": 0, "taxable_amount": 0, "amount": 0, "amount_paid": 0, "amount_due": 0, "currency": "INR", "currency_symbol": "₹", "description": "12 p.m. Meals", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "comment": null, "short_url": "https://rzp.io/i/bzDYbNg", "view_less": true, "billing_start": null, "billing_end": null, "type": "link", "group_taxes_discounts": false, "created_at": 1595491154, "idempotency_key": null, "token": { "method": "nach", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "recurring_status": null, "failure_reason": null, "currency": "INR", "max_amount": 50000, "auth_type": "physical", "expire_at": 1947483647, "nach": { "create_form": true, "form_reference1": "Recurring Payment for Gaurav Kumar", "form_reference2": "Method Paper NACH", "prefilled_form": "https://rzp.io/i/exdIzYN", "upload_form_url": "https://rzp.io/i/bzDYbNg", "description": "12 p.m. Meals" }, "bank_account": { "ifsc": "HDFC0001233", "bank_name": "HDFC Bank", "name": "Gaurav Kumar", "account_number": "11214311215411", "account_type": "savings", "beneficiary_email": "gaurav.kumar@example.com", "beneficiary_mobile": "9123456780" }, "first_payment_amount": 0 }, "nach_form_url": "https://rzp.io/i/exdIzYN" } ``` ------------------------------------------------------------------------------------------------------- ### Send/Resend notifications ```php $api->invoice->fetch($invoiceId)->notify($medium); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be notified | | medium* | string | `sms`/`email`, Medium through which notification should be sent. | **Response:** ```json { "success": true } ``` ------------------------------------------------------------------------------------------------------- ### Cancel a registration link ```php $api->invoice->fetch($invoiceId)->cancel(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be cancelled | **Response:** ```json { "id": "inv_FHrZiAubEzDdaq", "entity": "invoice", "receipt": "Receipt No. 27", "invoice_number": "Receipt No. 27", "customer_id": "cust_BMB3EwbqnqZ2EI", "customer_details": { "id": "cust_BMB3EwbqnqZ2EI", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "9123456780", "gstin": null, "billing_address": null, "shipping_address": null, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", "customer_contact": "9123456780" }, "order_id": "order_FHrZiBOkWHZPOp", "line_items": [], "payment_id": null, "status": "cancelled", "expire_by": 1647483647, "issued_at": 1595491154, "paid_at": null, "cancelled_at": 1595491339, "expired_at": null, "sms_status": "sent", "email_status": "sent", "date": 1595491154, "terms": null, "partial_payment": false, "gross_amount": 0, "tax_amount": 0, "taxable_amount": 0, "amount": 0, "amount_paid": 0, "amount_due": 0, "currency": "INR", "currency_symbol": "₹", "description": "12 p.m. Meals", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "comment": null, "short_url": "https://rzp.io/i/bzDYbNg", "view_less": true, "billing_start": null, "billing_end": null, "type": "link", "group_taxes_discounts": false, "created_at": 1595491154, "idempotency_key": null, "token": { "method": "nach", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "recurring_status": null, "failure_reason": null, "currency": "INR", "max_amount": 50000, "auth_type": "physical", "expire_at": 1947483647, "nach": { "create_form": true, "form_reference1": "Recurring Payment for Gaurav Kumar", "form_reference2": "Method Paper NACH", "prefilled_form": "https://rzp.io/i/tSYd5aV", "upload_form_url": "https://rzp.io/i/bzDYbNg", "description": "12 p.m. Meals" }, "bank_account": { "ifsc": "HDFC0001233", "bank_name": "HDFC Bank", "name": "Gaurav Kumar", "account_number": "11214311215411", "account_type": "savings", "beneficiary_email": "gaurav.kumar@example.com", "beneficiary_mobile": "9123456780" }, "first_payment_amount": 0 }, "nach_form_url": "https://rzp.io/i/tSYd5aV" } ``` ------------------------------------------------------------------------------------------------------- ### Fetch Payment ID using Order ID ```php $api->order->fetch($orderId)->payments() ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | orderId* | string | Order id for which payment id need to be fetched | **Response:** ```json { "entity":"collection", "count":1, "items":[ { "id":"pay_1Aa00000000003", "entity":"payment", "amount":0, "currency":"INR", "status":"captured", "order_id":"order_1Aa00000000003", "invoice_id":"inv_1Aa00000000003", "international":false, "method":"nach", "amount_refunded":0, "refund_status":null, "captured":true, "description":"12 p.m. Meals", "card_id":null, "bank":"HDFC", "wallet":null, "vpa":null, "email":"gaurav.kumar@example.com", "contact":"99876543210", "customer_id":"cust_1Aa00000000002", "token_id":"token_1Aa00000000003", "notes":{ "note_key 1":"Beam me up Scotty", "note_key 2":"Tea. Earl Gray. Hot." }, "fee":0, "tax":0, "error_code":null, "error_description":null, "created_at":1580109147 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch token by payment ID ```php $api->payment->fetch($paymentId); ``` **Parameters:** | Name | Type | Description | |------------|--------|-----------------------------------| | paymentId* | string | Id of the payment to be retrieved | **Response:** ```json { "id": "pay_EnLNTjINiPkMEZ", "entity": "payment", "amount": 0, "currency": "INR", "status": "captured", "order_id": "order_EnLLfglmKksr4K", "invoice_id": "inv_EnLLfgCzRfcMuh", "international": false, "method": "nach", "amount_refunded": 0, "refund_status": null, "captured": true, "description": "Invoice #inv_EnLLfgCzRfcMuh", "card_id": null, "bank": "UTIB", "wallet": null, "vpa": null, "email": "gaurav.kumar@example.com", "contact": "+919876543210", "customer_id": "cust_DtHaBuooGHTuyZ", "token_id": "token_EnLNTnn7uyRg5V", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "fee": 0, "tax": 0, "error_code": null, "error_description": null, "error_source": null, "error_step": null, "error_reason": null, "acquirer_data": {}, "created_at": 1588827564 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch tokens by customer ID ```php $api->customer->fetch($customerId)->tokens()->all(); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | customerId* | string | The id of the customer to be fetched | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "token_EhYgIE3pOyMQpD", "entity": "token", "token": "3mQ5Czc6APNppI", "bank": "HDFC", "wallet": null, "method": "nach", "vpa": null, "recurring": true, "recurring_details": { "status": "confirmed", "failure_reason": null }, "auth_type": "physical", "mrn": null, "used_at": 1587564373, "created_at": 1587564373, "dcc_enabled": false } ] } ``` ------------------------------------------------------------------------------------------------------- ### Delete token ```php $api->customer->fetch($customerId)->tokens()->delete($tokenId); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | customerId* | string | The id of the customer to be fetched | | tokenId* | string | The id of the token to be fetched | **Response:** ```json { "deleted": true } ``` ------------------------------------------------------------------------------------------------------- ### Create an order to charge the customer ```php $api->order->create(array('receipt' => '123', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | | notes | array | A key-value pair | **Response:** ```json { "id":"order_1Aa00000000002", "entity":"order", "amount":1000, "amount_paid":0, "amount_due":1000, "currency":"INR", "receipt":"Receipt No. 1", "offer_id":null, "status":"created", "attempts":0, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "created_at":1579782776 } ``` ------------------------------------------------------------------------------------------------------- ### Create a Recurring Payment ```php $api->payment->createRecurring(array('email'=>'gaurav.kumar@example.com','contact'=>'9123456789','amount'=>100,'currency'=>'INR','order_id'=>'order_1Aa00000000002','customer_id'=>'cust_1Aa00000000001','token'=>'token_1Aa00000000001','recurring'=>'1','description'=>'Creating recurring payment for Gaurav Kumar')); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | email* | string | The customer's email address. | | contact* | string | The customer's phone number. | | amount* | integer | The amount you want to charge your customer. This should be the same as the amount in the order. | | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | | order_id* | string | The unique identifier of the order created. | | customer_id* | string | The `customer_id` for the customer you want to charge. | | token* | string | The `token_id` generated when the customer successfully completes the authorization payment. Different payment instruments for the same customer have different `token_id`.| | recurring* | string | Determines if recurring payment is enabled or not. Possible values:<br>* `1` - Recurring is enabled.* `0` - Recurring is not enabled.| | description* | string | A user-entered description for the payment.| | notes* | array | Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. | **Response:** ```json { "razorpay_payment_id" : "pay_1Aa00000000001", "razorpay_order_id" : "order_1Aa00000000001", "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/recurring-payments/paper-nach/authorization-transaction/)** razorpay/documents/subscription.md 0000666 00000050651 15165415146 0013505 0 ustar 00 ## Subscriptions ### Create subscription ```php $api->subscription->create(array('plan_id' => 'plan_7wAosPWtrkhqZw', 'customer_notify' => 1,'quantity'=>5, 'total_count' => 6, 'start_at' => 1495995837, 'addons' => array(array('item' => array('name' => 'Delivery charges', 'amount' => 30000, 'currency' => 'INR'))),'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | plan_id* | string | The unique identifier for a plan that should be linked to the subscription.| | total_count* | string | The number of billing cycles for which the customer should be charged | | customer_notify | boolean | Indicates whether the communication to the customer would be handled by you or us | | quantity | integer | The number of times the customer should be charged the plan amount per invoice | | start_at | integer | The timestamp, in Unix format, for when the subscription should start. If not passed, the subscription starts immediately after the authorization payment. | | expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | | addons | array | Array that contains details of any upfront amount you want to collect as part of the authorization transaction. | | notes | array | Notes you can enter for the contact for future reference. | **Response:** ```json { "id": "sub_00000000000001", "entity": "subscription", "plan_id": "plan_00000000000001", "status": "created", "current_start": null, "current_end": null, "ended_at": null, "quantity": 1, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "charge_at": 1580453311, "start_at": 1580626111, "end_at": 1583433000, "auth_attempts": 0, "total_count": 6, "paid_count": 0, "customer_notify": true, "created_at": 1580280581, "expire_by": 1580626111, "short_url": "https://rzp.io/i/z3b1R61A9", "has_scheduled_changes": false, "change_scheduled_at": null, "source": "api", "offer_id":"offer_JHD834hjbxzhd38d", "remaining_count": 5 } ``` ------------------------------------------------------------------------------------------------------- ### Create subscription link ```php $api->subscription->create(array('plan_id' => 'plan_HoYg68p5kmuvzD','total_count' => 12,'quantity' => 1,'expire_by' => 1633237807,'customer_notify' => 1, 'addons' => array(array('item'=>array('name' => 'Delivery charges','amount' => 30000,'currency' => 'INR'))),'notes'=>array('notes_key_1'=>'Tea, Earl Grey, Hot','notes_key_2'=>'Tea, Earl Grey… decaf.'),'notify_info'=>array('notify_phone' => '9123456789','notify_email'=> 'gaurav.kumar@example.com'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | plan_id* | string | The unique identifier for a plan that should be linked to the subscription.| | total_count* | string | The number of billing cycles for which the customer should be charged | | customer_notify | boolean | Indicates whether the communication to the customer would be handled by you or us | | quantity | integer | The number of times the customer should be charged the plan amount per invoice | | start_at | integer | The timestamp, in Unix format, for when the subscription should start. If not passed, the subscription starts immediately after the authorization payment. | | expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | | addons | array | Array that contains details of any upfront amount you want to collect as part of the authorization transaction. | | notes | array | Notes you can enter for the contact for future reference. | | notify_info | array | The customer's email and phone number to which notifications are to be sent. (PN: Use this array only if you have set the `customer_notify` parameter to 1. That is, Razorpay sends notifications to the customer.) | **Response:** ```json { "id":"sub_00000000000002", "entity":"subscription", "plan_id":"plan_00000000000001", "status":"created", "current_start":null, "current_end":null, "ended_at":null, "quantity":1, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "charge_at":1580453311, "start_at":1580453311, "end_at":1587061800, "auth_attempts":0, "total_count":12, "paid_count":0, "customer_notify":true, "created_at":1580283117, "expire_by":1581013800, "short_url":"https://rzp.io/i/m0y0f", "has_scheduled_changes":false, "change_scheduled_at":null, "source": "api", "offer_id":"offer_JHD834hjbxzhd38d", "remaining_count":12 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch all subscriptions ```php $api->subscription->all($options); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | from | timestamp | timestamp after which the payments were created | | to | timestamp | timestamp before which the payments were created | | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | | plan_id | string | The unique identifier of the plan for which you want to retrieve all the subscriptions | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "sub_00000000000001", "entity": "subscription", "plan_id": "plan_00000000000001", "customer_id": "cust_D00000000000001", "status": "active", "current_start": 1577355871, "current_end": 1582655400, "ended_at": null, "quantity": 1, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "charge_at": 1577385991, "offer_id": "offer_JHD834hjbxzhd38d", "start_at": 1577385991, "end_at": 1603737000, "auth_attempts": 0, "total_count": 6, "paid_count": 1, "customer_notify": true, "created_at": 1577356081, "expire_by": 1577485991, "short_url": "https://rzp.io/i/z3b1R61A9", "has_scheduled_changes": false, "change_scheduled_at": null, "remaining_count": 5 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch particular subscription ```php $api->subscription->fetch($subscriptionId); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | subscriptionId* | string | The id of the subscription to be fetched | **Response:** ```json { "id": "sub_00000000000001", "entity": "subscription", "plan_id": "plan_00000000000001", "customer_id": "cust_D00000000000001", "status": "active", "current_start": 1577355871, "current_end": 1582655400, "ended_at": null, "quantity": 1, "notes":{ "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "charge_at": 1577385991, "start_at": 1577385991, "end_at": 1603737000, "auth_attempts": 0, "total_count": 6, "paid_count": 1, "customer_notify": true, "created_at": 1577356081, "expire_by": 1577485991, "short_url": "https://rzp.io/i/z3b1R61A9", "has_scheduled_changes": false, "change_scheduled_at": null, "source": "api", "offer_id":"offer_JHD834hjbxzhd38d", "remaining_count": 5 } ``` ------------------------------------------------------------------------------------------------------- ### Cancel particular subscription ```php $api->subscription->fetch($subscriptionId)->cancel($options); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | subscriptionId* | string | The id of the subscription to be cancelled | | cancel_at_cycle_end | boolean | Possible values:<br>0 (default): Cancel the subscription immediately. <br> 1: Cancel the subscription at the end of the current billing cycle. | **Response:** ```json { "id": "sub_00000000000001", "entity": "subscription", "plan_id": "plan_00000000000001", "customer_id": "cust_D00000000000001", "status": "cancelled", "current_start": 1580453311, "current_end": 1581013800, "ended_at": 1580288092, "quantity": 1, "notes":{ "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "charge_at": 1580453311, "start_at": 1577385991, "end_at": 1603737000, "auth_attempts": 0, "total_count": 6, "paid_count": 1, "customer_notify": true, "created_at": 1580283117, "expire_by": 1581013800, "short_url": "https://rzp.io/i/z3b1R61A9", "has_scheduled_changes": false, "change_scheduled_at": null, "source": "api", "offer_id":"offer_JHD834hjbxzhd38d", "remaining_count": 5 } ``` ------------------------------------------------------------------------------------------------------- ### Update particular subscription ```php $api->subscription->fetch($subscriptionId)->update($options); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | subscriptionId* | string | The id of the subscription to be updated | | options | array | All parameters listed [here](https://razorpay.com/docs/api/subscriptions/#update-a-subscription) for update | **Response:** ```json { "id":"sub_00000000000002", "entity":"subscription", "plan_id":"plan_00000000000002", "customer_id":"cust_00000000000002", "status":"authenticated", "current_start":null, "current_end":null, "ended_at":null, "quantity":3, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "charge_at":1580453311, "start_at":1580453311, "end_at":1606588200, "auth_attempts":0, "total_count":6, "paid_count":0, "customer_notify":true, "created_at":1580283807, "expire_by":1580626111, "short_url":"https://rzp.io/i/yeDkUKy", "has_scheduled_changes":false, "change_scheduled_at":null, "source": "api", "offer_id":"offer_JHD834hjbxzhd38d", "remaining_count":6 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch details of pending update ```php $api->subscription->fetch($subscriptionId)->pendingUpdate() ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | subscriptionId* | string | The id of the subscription to fetch pending update | **Response:** ```json { "id":"sub_00000000000001", "entity":"subscription", "plan_id":"plan_00000000000003", "customer_id":"cust_00000000000001", "status":"active", "current_start":1580284732, "current_end":1580841000, "ended_at":null, "quantity":25, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "charge_at":1580841000, "start_at":1580284732, "end_at":1611081000, "auth_attempts":0, "total_count":6, "paid_count":1, "customer_notify":true, "created_at":1580284702, "expire_by":1580626111, "short_url":"https://rzp.io/i/fFWTkbf", "has_scheduled_changes":true, "change_scheduled_at":1557253800, "source": "api", "offer_id":"offer_JHD834hjbxzhd38d", "remaining_count":5 } ``` ------------------------------------------------------------------------------------------------------- ### Cancel a update ```php $api->subscription->fetch($subscriptionId)->cancelScheduledChanges(); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | subscriptionId* | string | The id of the subscription to be cancel an update | **Response:** ```json { "id": "sub_00000000000001", "entity": "subscription", "plan_id": "plan_00000000000003", "customer_id": "cust_00000000000001", "status": "active", "current_start": 1580284732, "current_end": 1580841000, "ended_at": null, "quantity": 1, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "charge_at": 1580841000, "start_at": 1580284732, "end_at": 1611081000, "auth_attempts": 0, "total_count": 6, "paid_count": 1, "customer_notify": true, "created_at": 1580284702, "expire_by": 1580626111, "short_url": "https://rzp.io/i/fFWTkbf", "has_scheduled_changes": false, "change_scheduled_at": 1527858600, "source": "api", "offer_id":"offer_JHD834hjbxzhd38d", "remaining_count": 5 } ``` ------------------------------------------------------------------------------------------------------- ### Pause a subscription ```php $api->subscription->fetch($subscriptionId)->pause(array('pause_at'=>'now')) ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | subscriptionId* | string | The id of the subscription to be paused | | pause_at | string | To pause the subscription, possible values: `now` | **Response:** ```json { "id": "sub_00000000000001", "entity": "subscription", "plan_id": "plan_00000000000001", "status": "paused", "current_start": null, "current_end": null, "ended_at": null, "quantity": 1, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "charge_at": null, "start_at": 1580626111, "end_at": 1583433000, "auth_attempts": 0, "total_count": 6, "paid_count": 0, "customer_notify": true, "created_at": 1580280581, "paused_at": 1590280581, "expire_by": 1580626111, "pause_initiated_by": "self", "short_url": "https://rzp.io/i/z3b1R61A9", "has_scheduled_changes": false, "change_scheduled_at": null, "source": "api", "offer_id":"offer_JHD834hjbxzhd38d", "remaining_count": 6 } ``` ------------------------------------------------------------------------------------------------------- ### Resume a subscription ```php $api->subscription->fetch($subscriptionId)->resume(array('resume_at'=>'now')) ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | subscriptionId* | string | The id of the subscription to be resumed | | resume_at | string | To resume the subscription, possible values: `now` | **Response:** ```json { "id": "sub_00000000000001", "entity": "subscription", "plan_id": "plan_00000000000001", "status": "active", "current_start": null, "current_end": null, "ended_at": null, "quantity": 1, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "charge_at": 1580453311, "start_at": 1580626111, "end_at": 1583433000, "auth_attempts": 0, "total_count": 6, "paid_count": 0, "customer_notify": true, "created_at": 1580280581, "paused_at": 1590280581, "expire_by": 1580626111, "pause_initiated_by": null, "short_url": "https://rzp.io/i/z3b1R61A9", "has_scheduled_changes": false, "change_scheduled_at": null, "source": "api", "offer_id":"offer_JHD834hjbxzhd38d", "remaining_count": 6 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch all invoices for a subscription ```php $api->invoice->all(['subscription_id'=>$subscriptionId]); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | subscriptionId* | string | The id of the subscription to fetch invoices | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "inv_00000000000003", "entity": "invoice", "receipt": null, "invoice_number": null, "customer_id": "cust_00000000000001", "customer_details": { "id": "cust_00000000000001", "name": null, "email": "gaurav.kumar@example.com", "contact": "+919876543210", "gstin": null, "billing_address": null, "shipping_address": null, "customer_name": null, "customer_email": "gaurav.kumar@example.com", "customer_contact": "+919876543210" }, "order_id": "order_00000000000002", "subscription_id": "sub_00000000000001", "line_items": [ { "id": "li_00000000000003", "item_id": null, "ref_id": null, "ref_type": null, "name": "Monthly Plan", "description": null, "amount": 99900, "unit_amount": 99900, "gross_amount": 99900, "tax_amount": 0, "taxable_amount": 99900, "net_amount": 99900, "currency": "INR", "type": "plan", "tax_inclusive": false, "hsn_code": null, "sac_code": null, "tax_rate": null, "unit": null, "quantity": 1, "taxes": [] } ], "payment_id": "pay_00000000000002", "status": "paid", "expire_by": null, "issued_at": 1593344888, "paid_at": 1593344889, "cancelled_at": null, "expired_at": null, "sms_status": null, "email_status": null, "date": 1593344888, "terms": null, "partial_payment": false, "gross_amount": 99900, "tax_amount": 0, "taxable_amount": 99900, "amount": 99900, "amount_paid": 99900, "amount_due": 0, "currency": "INR", "currency_symbol": "₹", "description": null, "notes": [], "comment": null, "short_url": "https://rzp.io/i/Ys4feGqEp", "view_less": true, "billing_start": 1594405800, "billing_end": 1597084200, "type": "invoice", "group_taxes_discounts": false, "created_at": 1593344888, "idempotency_key": null } ] } ``` ------------------------------------------------------------------------------------------------------- ### Delete offer linked to a subscription ```php $api->subscription->fetch($subscriptionId)->deleteOffer($offerId) ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | subscriptionId* | string | The id of the subscription to offer need to be deleted | | offerId* | string | The id of the offer linked to subscription | **Response:** ```json { "id": "sub_I3GGEs7Xgmnozy", "entity": "subscription", "plan_id": "plan_HuXrfsI0ZZ3peu", "customer_id": "cust_I3FToKbnExwDLu", "status": "active", "current_start": 1632914901, "current_end": 1635445800, "ended_at": null, "quantity": 1, "notes": [], "charge_at": 1635445800, "start_at": 1632914901, "end_at": 1645986600, "auth_attempts": 0, "total_count": 6, "paid_count": 1, "customer_notify": true, "created_at": 1632914246, "expire_by": 1635532200, "short_url": "https://rzp.io/i/SOvRWaYP81", "has_scheduled_changes": false, "change_scheduled_at": null, "source": "dashboard", "payment_method": "card", "offer_id": null, "remaining_count": 5 } ``` ------------------------------------------------------------------------------------------------------- ### Authentication Transaction Please refer this [doc](https://razorpay.com/docs/api/subscriptions/#authentication-transaction) for authentication of transaction ------------------------------------------------------------------------------------------------------- ### Payment verification ```php $api->utility->verifyPaymentSignature($options) ``` Please refer this [doc](https://razorpay.com/docs/api/subscriptions/#payment-verification) for payment verification ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/subscriptions/#subscriptions)** razorpay/documents/customer.md 0000666 00000007731 15165415146 0012623 0 ustar 00 ## Customer ### Create customer ```php $api->customer->create(array('name' => 'Razorpay User', 'email' => 'customer@razorpay.com','contact'=>'9123456780','notes'=> array('notes_key_1'=> 'Tea, Earl Grey, Hot','notes_key_2'=> 'Tea, Earl Grey… decaf')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | name* | string | Name of the customer | | email | string | Email of the customer | | contact | string | Contact number of the customer | | notes | array | A key-value pair | **Response:** ```json { "id" : "cust_1Aa00000000004", "entity": "customer", "name" : "Gaurav Kumar", "email" : "gaurav.kumar@example.com", "contact" : "9123456780", "gstin": "29XAbbA4369J1PA", "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "created_at ": 1234567890 } ``` ------------------------------------------------------------------------------------------------------- ### Edit customer ```php $api->customer->fetch($customerId)->edit(array('name' => 'Razorpay User', 'email' => 'customer@razorpay.com','notes'=> array('notes_key_1'=> 'Tea, Earl Grey, Hot','notes_key_2'=> 'Tea, Earl Grey… decaf'))); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | customerId* | string | The id of the customer to be updated | | email | string | Email of the customer | | contact | string | Contact number of the customer | | notes | array | A key-value pair | **Response:** ```json { "id": "cust_1Aa00000000003", "entity": "customer", "name": "Gaurav Kumar", "email": "Gaurav.Kumar@example.com", "contact": "9000000000", "gstin": null, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "created_at": 1582033731 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch all customer ```php $api->customer->all($options) ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | **Response:** ```json { "entity":"collection", "count":1, "items":[ { "id":"cust_1Aa00000000001", "entity":"customer", "name":"Gaurav Kumar", "email":"gaurav.kumar@example.com", "contact":"9876543210", "gstin":"29XAbbA4369J1PA", "notes":{ "note_key_1":"September", "note_key_2":"Make it so." }, "created_at ":1234567890 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch a customer ```php $api->customer->fetch($customerId) ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | customerId* | string | The id of the customer to be fetched | **Response:** ```json { "id" : "cust_1Aa00000000001", "entity": "customer", "name" : "Saurav Kumar", "email" : "Saurav.kumar@example.com", "contact" : "+919000000000", "gstin":"29XAbbA4369J1PA", "notes" : [], "created_at ": 1234567890 } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/customers/)** razorpay/documents/registernach.md 0000666 00000045327 15165415146 0013443 0 ustar 00 ## Register nach and charge first payment together ### Create customer ```php $api->customer->create(array('name' => 'Razorpay User', 'email' => 'customer@razorpay.com','contact'=>'9123456780', 'fail_existing'=> '0', 'notes'=> array('notes_key_1'=> 'Tea, Earl Grey, Hot','notes_key_2'=> 'Tea, Earl Grey… decaf')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | name* | string | Name of the customer | | email | string | Email of the customer | | contact | string | Contact number of the customer | | fail_existing | string | If a customer with the same details already exists, the request throws an exception by default. Possible value is `0` or `1`| | notes | array | A key-value pair | **Response:** ```json { "id": "cust_1Aa00000000003", "entity": "customer", "name": "Gaurav Kumar", "email": "Gaurav.Kumar@example.com", "contact": "9000000000", "gstin": null, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "created_at": 1582033731 } ``` ------------------------------------------------------------------------------------------------------- ### Create Order ```php $api->order->create(array('amount' => 100, 'currency' => 'INR', 'method'=>'nach', 'customer_id'=>$customerId, 'receipt'=>'Receipt No. 5', 'notes'=> array('note_key 1'=> 'Beam me up Scotty','note_key 2'=> 'Tea. Earl Gray. Hot.'), 'token'=>array('first_payment_amount'=>10000, 'auth_type'=>'physical' ,'max_amount'=>'50000','expire_at'=>'1634215992', 'notes'=>array('note_key 1'=> 'Tea, Earl Grey… decaf.','note_key 2'=> 'Tea. Earl Gray. Hot.'), 'bank_account'=>array('beneficiary_name'=>'Gaurav Kumar', 'account_number'=>'11214311215411', 'account_type'=>'savings', 'ifsc_code'=>'HDFC0001233'), 'nach'=> array('form_reference1'=> 'Recurring Payment for Gaurav Kumar','form_reference2'=> 'Method Paper NACH', 'description'=>'Paper NACH Gaurav Kumar')))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | customerId* | string | The id of the customer to be fetched | | method* | string | Payment method used to make the registration transaction. Possible value is `nach`. | | receipt | string | Your system order reference id. | | token | array | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/paper-nach/auto-debit/#112-create-an-order) are supported | | notes | array | A key-value pair | **Response:** ```json { "id":"order_1Aa00000000001", "entity":"order", "amount":0, "amount_paid":0, "amount_due":0, "currency":"INR", "receipt":"rcptid #10", "offer_id":null, "offers":{ "entity":"collection", "count":0, "items":[] }, "status":"created", "attempts":0, "notes": { "notes_key_1": "Beam me up Scotty", "notes_key_2": "Engage" }, "created_at":1579775420, "token":{ "method":"nach", "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "recurring_status":null, "failure_reason":null, "currency":"INR", "max_amount":10000000, "auth_type":"physical", "expire_at":1580480689, "nach":{ "create_form":true, "form_reference1":"Recurring Payment for Gaurav Kumar", "form_reference2":"Method Paper NACH", "prefilled_form":"https://rzp.io/i/bitw", "upload_form_url":"https://rzp.io/i/gts", "description":"Paper NACH Gaurav Kumar" }, "bank_account":{ "ifsc":"HDFC0000001", "bank_name":"HDFC Bank", "name":"Gaurav Kumar", "account_number":"11214311215411", "account_type":"savings", "beneficiary_email":"gaurav.kumar@example.com", "beneficiary_mobile":"9876543210" }, "first_payment_amount":10000 } } ``` ------------------------------------------------------------------------------------------------------- ### Create an Authorization Payment Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/paper-nach/auto-debit/#113-create-an-authorization-payment) for authorization payment ----------------------------------------------------------------------------------------------------- ### Create registration link ```php $api->subscription->createSubscriptionRegistration(array('customer'=>array('name'=>'Gaurav Kumar','email'=>'gaurav.kumar@example.com','contact'=>'9123456780'),'amount'=>100, 'type'=>'link','currency'=>'INR','description'=>'Registration Link for Gaurav Kumar','subscription_registration'=>array('first_payment_amount'=>100, 'method'=>'nach', 'auth_type'=>'physical' ,'max_amount'=>'50000','expire_at'=>'1634215992','bank_account'=>array('beneficiary_name'=>'Gaurav Kumar', 'account_number'=>'11214311215411', 'account_type'=>'savings', 'ifsc_code'=>'HDFC0001233'), 'nach'=> array('form_reference1'=> 'Recurring Payment for Gaurav Kumar','form_reference2'=> 'Method Paper NACH')),'receipt'=>'Receipt No. 5','email_notify'=>1,'sms_notify'=>1,'expire_by'=>1634215992, 'notes'=> array('note_key 1'=> 'Beam me up Scotty','note_key 2'=> 'Tea. Earl Gray. Hot.')); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|---------------------------------------------------------------| | customer | array | Details of the customer to whom the registration link will be sent. | | type* | array | the value is `link`. | | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | description* | string | A brief description of the payment. | | subscription_registration | array | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/paper-nach/auto-debit/#121-create-a-registration-link) are supported | | receipt | string | Your system order reference id. | | sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) | | email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) | | expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | | notes | array | A key-value pair | **Response:** ```json { "id": "inv_FHrZiAubEzDdaq", "entity": "invoice", "receipt": "Receipt No. 27", "invoice_number": "Receipt No. 27", "customer_id": "cust_BMB3EwbqnqZ2EI", "customer_details": { "id": "cust_BMB3EwbqnqZ2EI", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "9123456780", "gstin": null, "billing_address": null, "shipping_address": null, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", "customer_contact": "9123456780" }, "order_id": "order_FHrZiBOkWHZPOp", "line_items": [], "payment_id": null, "status": "issued", "expire_by": 1647483647, "issued_at": 1595491154, "paid_at": null, "cancelled_at": null, "expired_at": null, "sms_status": "sent", "email_status": "sent", "date": 1595491154, "terms": null, "partial_payment": false, "gross_amount": 0, "tax_amount": 0, "taxable_amount": 0, "amount": 0, "amount_paid": 0, "amount_due": 0, "currency": "INR", "currency_symbol": "₹", "description": "12 p.m. Meals", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "comment": null, "short_url": "https://rzp.io/i/bzDYbNg", "view_less": true, "billing_start": null, "billing_end": null, "type": "link", "group_taxes_discounts": false, "created_at": 1595491154, "idempotency_key": null, "token": { "method": "nach", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "recurring_status": null, "failure_reason": null, "currency": "INR", "max_amount": 50000, "auth_type": "physical", "expire_at": 1947483647, "nach": { "create_form": true, "form_reference1": "Recurring Payment for Gaurav Kumar", "form_reference2": "Method Paper NACH", "prefilled_form": "https://rzp.io/i/exdIzYN", "upload_form_url": "https://rzp.io/i/bzDYbNg", "description": "12 p.m. Meals" }, "bank_account": { "ifsc": "HDFC0001233", "bank_name": "HDFC Bank", "name": "Gaurav Kumar", "account_number": "11214311215411", "account_type": "savings", "beneficiary_email": "gaurav.kumar@example.com", "beneficiary_mobile": "9123456780" }, "first_payment_amount": 0 }, "nach_form_url": "https://rzp.io/i/exdIzYN" } ``` ------------------------------------------------------------------------------------------------------- ## Create an order to charge the customer ```php $api->order->create(array('amount' => '100', 'currency' => 'INR', 'receipt' => 'Receipt No. 1', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | receipt | string | Your system order reference id. | | notes | array | A key-value pair | **Response:** ```json { "id":"order_1Aa00000000002", "entity":"order", "amount":1000, "amount_paid":0, "amount_due":1000, "currency":"INR", "receipt":"Receipt No. 1", "offer_id":null, "status":"created", "attempts":0, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "created_at":1579782776 } ``` ------------------------------------------------------------------------------------------------------- ## Create a recurring payment ```php $api->payment->createRecurring(['email'=>'gaurav.kumar@example.com','contact'=>'9123456789','amount'=>1000,'currency'=>'INR','order_id'=>$orderid,'customer_id'=>$customerId,'token'=>$tokenId,'recurring'=>'1','description'=>'Creating recurring payment for Gaurav Kumar', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | email* | string | The customer's email address | | contact* | string | The customer's phone number | | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | orderId* | string | The id of the order to be fetched | | customerId* | string | The id of the customer to be fetched | | tokenId* | string | The id of the token to be fetched | | recurring* | boolean | Possible values is `0` or `1` | | description | string | A brief description of the payment. | | notes | array | A key-value pair | **Response:** ```json { "razorpay_payment_id" : "pay_1Aa00000000001", "razorpay_order_id" : "order_1Aa00000000001", "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" } ``` ------------------------------------------------------------------------------------------------------- ## Send/Resend notifications ```php $api->invoice->fetch($invoiceId)->notifyBy($medium); ``` **Parameters:** | Name | Type |Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be fetched | | medium* | string | Possible values are `sms` or `email` | **Response:** ```json { "success": true } ``` ------------------------------------------------------------------------------------------------------- ## Cancel registration link ```php $api->invoice->fetch($invoiceId)->cancel(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be fetched | **Response:** ```json { "id": "inv_FHrZiAubEzDdaq", "entity": "invoice", "receipt": "Receipt No. 27", "invoice_number": "Receipt No. 27", "customer_id": "cust_BMB3EwbqnqZ2EI", "customer_details": { "id": "cust_BMB3EwbqnqZ2EI", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "9123456780", "gstin": null, "billing_address": null, "shipping_address": null, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", "customer_contact": "9123456780" }, "order_id": "order_FHrZiBOkWHZPOp", "line_items": [], "payment_id": null, "status": "cancelled", "expire_by": 1647483647, "issued_at": 1595491154, "paid_at": null, "cancelled_at": 1595491339, "expired_at": null, "sms_status": "sent", "email_status": "sent", "date": 1595491154, "terms": null, "partial_payment": false, "gross_amount": 0, "tax_amount": 0, "taxable_amount": 0, "amount": 0, "amount_paid": 0, "amount_due": 0, "currency": "INR", "currency_symbol": "₹", "description": "12 p.m. Meals", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "comment": null, "short_url": "https://rzp.io/i/bzDYbNg", "view_less": true, "billing_start": null, "billing_end": null, "type": "link", "group_taxes_discounts": false, "created_at": 1595491154, "idempotency_key": null, "token": { "method": "nach", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "recurring_status": null, "failure_reason": null, "currency": "INR", "max_amount": 50000, "auth_type": "physical", "expire_at": 1947483647, "nach": { "create_form": true, "form_reference1": "Recurring Payment for Gaurav Kumar", "form_reference2": "Method Paper NACH", "prefilled_form": "https://rzp.io/i/tSYd5aV", "upload_form_url": "https://rzp.io/i/bzDYbNg", "description": "12 p.m. Meals" }, "bank_account": { "ifsc": "HDFC0001233", "bank_name": "HDFC Bank", "name": "Gaurav Kumar", "account_number": "11214311215411", "account_type": "savings", "beneficiary_email": "gaurav.kumar@example.com", "beneficiary_mobile": "9123456780" }, "first_payment_amount": 0 }, "nach_form_url": "https://rzp.io/i/tSYd5aV" } ``` ------------------------------------------------------------------------------------------------------- ## Fetch token by payment id ```php $api->payment->fetch($paymentId); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | paymentId* | string | The id of the payment to be fetched | **Response:** ```json { "id": "pay_EnLNTjINiPkMEZ", "entity": "payment", "amount": 0, "currency": "INR", "status": "captured", "order_id": "order_EnLLfglmKksr4K", "invoice_id": "inv_EnLLfgCzRfcMuh", "international": false, "method": "nach", "amount_refunded": 0, "refund_status": null, "captured": true, "description": "Invoice #inv_EnLLfgCzRfcMuh", "card_id": null, "bank": "UTIB", "wallet": null, "vpa": null, "email": "gaurav.kumar@example.com", "contact": "+919876543210", "customer_id": "cust_DtHaBuooGHTuyZ", "token_id": "token_EnLNTnn7uyRg5V", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "fee": 0, "tax": 0, "error_code": null, "error_description": null, "error_source": null, "error_step": null, "error_reason": null, "acquirer_data": {}, "created_at": 1588827564 } ``` ------------------------------------------------------------------------------------------------------- ## Fetch tokens by customer id ```php $api->customer->fetch($customerId)->tokens()->all(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | customerId* | string | The id of the customer to be fetched | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "token_EhYgIE3pOyMQpD", "entity": "token", "token": "3mQ5Czc6APNppI", "bank": "HDFC", "wallet": null, "method": "nach", "vpa": null, "recurring": true, "recurring_details": { "status": "confirmed", "failure_reason": null }, "auth_type": "physical", "mrn": null, "used_at": 1587564373, "created_at": 1587564373, "dcc_enabled": false } ] } ``` ------------------------------------------------------------------------------------------------------- ## Delete tokens ```php $api->customer->fetch($customerId)->tokens()->delete($tokenId); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | customerId* | string | The id of the customer to be fetched | | tokenId* | string | The id of the token to be fetched | **Response:** ```json { "deleted": true } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/recurring-payments/paper-nach/auto-debit/)** razorpay/documents/order.md 0000666 00000012440 15165415146 0012066 0 ustar 00 ## Orders ### Create order ```php $api->order->create(array('receipt' => '123', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | | notes | array | A key-value pair | **Response:** ```json { "id": "order_EKwxwAgItmmXdp", "entity": "order", "amount": 50000, "amount_paid": 0, "amount_due": 50000, "currency": "INR", "receipt": "receipt#1", "offer_id": null, "status": "created", "attempts": 0, "notes": [], "created_at": 1582628071 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch all orders ```php $api->order->all($options); ``` **Parameters** | Name | Type | Description | |------------|-----------|--------------------------------------------------------------| | from | timestamp | timestamp after which the orders were created | | to | timestamp | timestamp before which the orders were created | | count | integer | number of orders to fetch (default: 10) | | skip | integer | number of orders to be skipped (default: 0) | | authorized | boolean | Orders for which orders are currently in authorized state. | | receipt | string | Orders with the provided value for receipt. | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "order_EKzX2WiEWbMxmx", "entity": "order", "amount": 1234, "amount_paid": 0, "amount_due": 1234, "currency": "INR", "receipt": "Receipt No. 1", "offer_id": null, "status": "created", "attempts": 0, "notes": [], "created_at": 1582637108 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch particular order ```php $api->order->fetch($orderId); ``` **Parameters** | Name | Type | Description | |----------|--------|-------------------------------------| | orderId* | string | The id of the order to be fetched | **Response:** ```json { "id":"order_DaaS6LOUAASb7Y", "entity":"order", "amount":2200, "amount_paid":0, "amount_due":2200, "currency":"INR", "receipt":"Receipt #211", "status":"attempted", "attempts":1, "notes":[], "created_at":1572505143 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch payments for an order ```php $api->order->fetch($orderId)->payments(); ``` **Parameters** | Name | Type | Description | |----------|--------|-------------------------------------| | orderId* | string | The id of the order to be retrieve payment info | **Response:** ```json { "entity":"collection", "count":1, "items":[ { "id":"pay_DaaSOvhgcOfzgR", "entity":"payment", "amount":2200, "currency":"INR", "status":"captured", "order_id":"order_DaaS6LOUAASb7Y", "invoice_id":null, "international":false, "method":"card", "amount_refunded":0, "refund_status":null, "captured":true, "description":"Beans in every imaginable flavour", "card_id":"card_DZon6fd8J3IcA2", "bank":null, "wallet":null, "vpa":null, "email":"gaurav.kumar@example.com", "contact":"+919999999988", "notes":[], "fee":44, "tax":0, "error_code":null, "error_description":null, "created_at":1572505160 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Update order ```php $api->order->fetch($orderId)->edit(array('notes'=> array('notes_key_1'=>'Beam me up Scotty. 1', 'notes_key_2'=>'Engage'))); ``` **Parameters** | Name | Type | Description | |----------|--------|-------------------------------------| | orderId* | string | The id of the order to be retrieve payment info | | notes* | array | A key-value pair | **Response:** ```json { "id":"order_DaaS6LOUAASb7Y", "entity":"order", "amount":2200, "amount_paid":0, "amount_due":2200, "currency":"INR", "receipt":"Receipt #211", "offer_id":null, "status":"attempted", "attempts":1, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "created_at":1572505143 } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/orders/)** razorpay/documents/qrcode.md 0000666 00000031305 15165415146 0012231 0 ustar 00 ## Qr Codes ### Create Qr code ```php $api->qrCode->create(array("type" => "upi_qr","name" => "Store_1", "usage" => "single_use","fixed_amount" => 1,"payment_amount" => 300,"customer_id" => "cust_HKsR5se84c5LTO","description" => "For Store 1","close_by" => 1681615838,"notes" => array("purpose" => "Test UPI QR code notes"))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | type* | string | The type of QR code i.e, `upi_qr`/`bharat_qr` | | name | string | Label entered to identify the QR code. | | usage* | string | Indicates if the QR code should be allowed to accept single payment or multiple payments i.e, `single_use`/`multiple_use` | | fixed_amount | boolean | Indicates if the QR should accept payments of specific amounts or any amount. | | payment_amount(* mandatory if fixed_amount is true) | integer | Indicates if the QR should accept payments of specific amounts or any amount. | | customer_id | string | Unique identifier of the customer the QR code is linked with | | description | string | A brief description about the QR code. | | close_by | integer | UNIX timestamp at which the QR code is scheduled to be automatically closed. The time must be at least 15 minutes after the current time. | | notes | array | Key-value pair that can be used to store additional information about the QR code. Maximum 15 key-value pairs, 256 characters (maximum) each. | **Response:** ```json { "id": "qr_HMsVL8HOpbMcjU", "entity": "qr_code", "created_at": 1623660301, "name": "Store_1", "usage": "single_use", "type": "upi_qr", "image_url": "https://rzp.io/i/BWcUVrLp", "payment_amount": 300, "status": "active", "description": "For Store 1", "fixed_amount": true, "payments_amount_received": 0, "payments_count_received": 0, "notes": { "purpose": "Test UPI QR code notes" }, "customer_id": "cust_HKsR5se84c5LTO", "close_by": 1681615838 } ``` ------------------------------------------------------------------------------------------------------- ### Create Qr code with GST ```php $api->qrCode->create(array("type" => "upi_qr","name" => "Store_1", "usage" => "single_use","fixed_amount" => 1,"payment_amount" => 300,"customer_id" => "cust_HKsR5se84c5LTO","description" => "For Store 1","close_by" => 1681615838,"notes" => array("purpose" => "Test UPI QR code notes"),"tax_invoice" => array("number" => "INV001", "date" => 1589994898,"customer_name" => "Gaurav Kumar", "business_gstin"=> "06AABCU9605R1ZR","gst_amount" => 4000, "cess_amount" => 0, "supply_type" => "interstate"))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | type* | string | The type of QR code i.e, `upi_qr`/`bharat_qr` | | name | string | Label entered to identify the QR code. | | usage* | string | Indicates if the QR code should be allowed to accept single payment or multiple payments i.e, `single_use`/`multiple_use` | | fixed_amount | boolean | Indicates if the QR should accept payments of specific amounts or any amount. | | payment_amount(* mandatory if fixed_amount is true) | integer | Indicates if the QR should accept payments of specific amounts or any amount. | | customer_id | string | Unique identifier of the customer the QR code is linked with | | description | string | A brief description about the QR code. | | close_by | integer | UNIX timestamp at which the QR code is scheduled to be automatically closed. The time must be at least 15 minutes after the current time. | | notes | array | Key-value pair that can be used to store additional information about the QR code. Maximum 15 key-value pairs, 256 characters (maximum) each. | | tax_invoice | array | This block contains information about the invoices. If not provided, the transaction will default to non-GST compliant UPI flow. | **Response:** ```json { "id": "qr_HMsVL8HOpbMcjU", "entity": "qr_code", "created_at": 1623660301, "name": "Store_1", "usage": "single_use", "type": "upi_qr", "image_url": "https://rzp.io/i/BWcUVrLp", "payment_amount": 300, "status": "active", "description": "For Store 1", "fixed_amount": true, "payments_amount_received": 0, "payments_count_received": 0, "notes": { "purpose": "Test UPI QR code notes" }, "customer_id": "cust_HKsR5se84c5LTO", "close_by": 1681615838, "tax_invoice": { "number": "INV001", "date": 1589994898, "customer_name": "Gaurav Kumar", "business_gstin": "06AABCU9605R1ZR", "gst_amount": 4000, "cess_amount": 0, "supply_type": "interstate" } } ``` ------------------------------------------------------------------------------------------------------- ### Fetch all Qr code ```php $api->qrCode->all($options) ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | from | timestamp | timestamp after which the payments were created | | to | timestamp | timestamp before which the payments were created | | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "qr_HO2jGkWReVBMNu", "entity": "qr_code", "created_at": 1623914648, "name": "Store_1", "usage": "single_use", "type": "upi_qr", "image_url": "https://rzp.io/i/w2CEwYmkAu", "payment_amount": 300, "status": "active", "description": "For Store 1", "fixed_amount": true, "payments_amount_received": 0, "payments_count_received": 0, "notes": { "purpose": "Test UPI QR code notes" }, "customer_id": "cust_HKsR5se84c5LTO", "close_by": 1681615838, "closed_at": null, "close_reason": null } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch a Qr code ```php $api->qrCode->fetch($qrCodeId) ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | qrCodeId | string | The id of the qr code to be fetched | **Response:** ```json { "id": "qr_HO2r1MDprYtWRT", "entity": "qr_code", "created_at": 1623915088, "name": "Store_1", "usage": "single_use", "type": "upi_qr", "image_url": "https://rzp.io/i/oCswTOcCo", "payment_amount": 300, "status": "active", "description": "For Store 1", "fixed_amount": true, "payments_amount_received": 0, "payments_count_received": 0, "notes": { "purpose": "Test UPI QR code notes" }, "customer_id": "cust_HKsR5se84c5LTO", "close_by": 1681615838, "closed_at": null, "close_reason": null } ``` ------------------------------------------------------------------------------------------------------- ### Fetch a Qr code for customer id ```php $api->qrCode->all(["customer_id" => $customerId]) ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | customerId* | string | The id of the customer to which qr code need to be fetched | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "qr_HMsgvioW64f0vh", "entity": "qr_code", "created_at": 1623660959, "name": "Store_1", "usage": "single_use", "type": "upi_qr", "image_url": "https://rzp.io/i/DTa2eQR", "payment_amount": 300, "status": "active", "description": "For Store 1", "fixed_amount": true, "payments_amount_received": 0, "payments_count_received": 0, "notes": { "purpose": "Test UPI QR code notes" }, "customer_id": "cust_HKsR5se84c5LTO", "close_by": 1681615838 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch a Qr code for payment id ```php $api->qrCode->all(["payment_id" => $paymentId]) ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | paymentID* | string | The id of the payment to which qr code need to be fetched | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "qr_HMsqRoeVwKbwAF", "entity": "qr_code", "created_at": 1623661499, "name": "Fresh Groceries", "usage": "multiple_use", "type": "upi_qr", "image_url": "https://rzp.io/i/eI9XD54Q", "payment_amount": null, "status": "active", "description": "Buy fresh groceries", "fixed_amount": false, "payments_amount_received": 1000, "payments_count_received": 1, "notes": [], "customer_id": "cust_HKsR5se84c5LTO", "close_by": 1624472999, "close_reason": null } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch Payments for a QR Code ```php $api->qrCode->fetch($qrCodeId)->fetchAllPayments($options) ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | qrCodeID* | string | The id of the qr code to which payment where made | | from | timestamp | timestamp after which the payments were created | | to | timestamp | timestamp before which the payments were created | | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "pay_HMtDKn3TnF4D8x", "entity": "payment", "amount": 500, "currency": "INR", "status": "captured", "order_id": null, "invoice_id": null, "international": false, "method": "upi", "amount_refunded": 0, "refund_status": null, "captured": true, "description": "QRv2 Payment", "card_id": null, "bank": null, "wallet": null, "vpa": "gauri.kumari@okhdfcbank", "email": "gauri.kumari@example.com", "contact": "+919999999999", "customer_id": "cust_HKsR5se84c5LTO", "notes": [], "fee": 0, "tax": 0, "error_code": null, "error_description": null, "error_source": null, "error_step": null, "error_reason": null, "acquirer_data": { "rrn": "116514257019" }, "created_at": 1623662800 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Close a QR Code ```php $api->qrCode->fetch($qrCodeId)->close() ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | qrCodeID* | string | The id of the qr code to be closed | **Response:** ```json { "id": "qr_HMsVL8HOpbMcjU", "entity": "qr_code", "created_at": 1623660301, "name": "Store_1", "usage": "single_use", "type": "upi_qr", "image_url": "https://rzp.io/i/BWcUVrLp", "payment_amount": 300, "status": "closed", "description": "For Store 1", "fixed_amount": true, "payments_amount_received": 0, "payments_count_received": 0, "notes": { "purpose": "Test UPI QR code notes" }, "customer_id": "cust_HKsR5se84c5LTO", "close_by": 1681615838, "closed_at": 1623660445, "close_reason": "on_demand" } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/qr-codes/)** razorpay/documents/invoice.md 0000666 00000034524 15165415146 0012416 0 ustar 00 ## Invoices ### Create Invoice Request #1 In this example, an invoice is created using the customer and item details. Here, the customer and item are created while creating the invoice. ```php $api->order->create(array ('type' => 'invoice','description' => 'Invoice for the month of January 2020','partial_payment' => true,'customer' =>array ('name' => 'Gaurav Kumar','contact' => 9999999999,'email' => 'gaurav.kumar@example.com','billing_address' => array ('line1' => 'Ground & 1st Floor, SJR Cyber Laskar','line2' => 'Hosur Road','zipcode' => '560068','city' => 'Bengaluru','state' => 'Karnataka','country' => 'in'),'shipping_address' => array ('line1' => 'Ground & 1st Floor, SJR Cyber Laskar','line2' => 'Hosur Road','zipcode' => '560068','city' => 'Bengaluru','state' => 'Karnataka','country' => 'in')),'line_items' => array (array ('name' => 'Master Cloud Computing in 30 Days','description' => 'Book by Ravena Ravenclaw','amount' => 399,'currency' => 'USD','quantity' => 1)),'sms_notify' => 1,'email_notify' => 1,'currency' => 'USD','expire_by' => 1589765167)); ``` Request #2 In this example, an invoice is created using existing `customer_id` and `item_id` ```php $api->invoice->create(array ('type' => 'invoice','date' => 1589994898, 'customer_id'=> 'cust_E7q0trFqXgExmT', 'line_items'=>array(array('item_id'=>'item_DRt61i2NnL8oy6')))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |type* | string | entity type (here its invoice) | |description | string | A brief description of the invoice. | |customer_id | string | customer id for which invoice need be raised | |customer | array | customer details in a array format | **Response:** For create invoice response please click [here](https://razorpay.com/docs/api/invoices/#create-an-invoice) ------------------------------------------------------------------------------------------------------- ### Fetch all invoices ```php $api->invoice->all(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |type | string | entity type (here its invoice) | |payment_id | string | The unique identifier of the payment made by the customer against the invoice. | |customer_id | string | The unique identifier of the customer. | |receipt | string | The unique receipt number that you entered for internal purposes. | **Response:** For fetch all invoice response please click [here](https://razorpay.com/docs/api/invoices/#fetch-multiple-invoices) ------------------------------------------------------------------------------------------------------- ### Fetch invoice ```php $api->invoice->fetch($invoiceId); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be fetched | **Response:** ```json { "id": "inv_E7q0tqkxBRzdau", "entity": "invoice", "receipt": null, "invoice_number": null, "customer_id": "cust_E7q0trFqXgExmT", "customer_details": { "id": "cust_E7q0trFqXgExmT", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "9999999999", "gstin": null, "billing_address": { "id": "addr_E7q0ttqh4SGhAC", "type": "billing_address", "primary": true, "line1": "Ground & 1st Floor, SJR Cyber Laskar", "line2": "Hosur Road", "zipcode": "560068", "city": "Bengaluru", "state": "Karnataka", "country": "in" }, "shipping_address": { "id": "addr_E7q0ttKwVA1h2V", "type": "shipping_address", "primary": true, "line1": "Ground & 1st Floor, SJR Cyber Laskar", "line2": "Hosur Road", "zipcode": "560068", "city": "Bengaluru", "state": "Karnataka", "country": "in" }, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", "customer_contact": "9999999999" }, "order_id": "order_E7q0tvRpC0WJwg", "line_items": [ { "id": "li_E7q0tuPNg84VbZ", "item_id": null, "ref_id": null, "ref_type": null, "name": "Master Cloud Computing in 30 Days", "description": "Book by Ravena Ravenclaw", "amount": 399, "unit_amount": 399, "gross_amount": 399, "tax_amount": 0, "taxable_amount": 399, "net_amount": 399, "currency": "INR", "type": "invoice", "tax_inclusive": false, "hsn_code": null, "sac_code": null, "tax_rate": null, "unit": null, "quantity": 1, "taxes": [] } ], "payment_id": null, "status": "issued", "expire_by": 1589765167, "issued_at": 1579765167, "paid_at": null, "cancelled_at": null, "expired_at": null, "sms_status": "pending", "email_status": "pending", "date": 1579765167, "terms": null, "partial_payment": true, "gross_amount": 399, "tax_amount": 0, "taxable_amount": 399, "amount": 399, "amount_paid": 0, "amount_due": 399, "currency": "INR", "currency_symbol": "₹", "description": "Invoice for the month of January 2020", "notes": [], "comment": null, "short_url": "https://rzp.io/i/2wxV8Xs", "view_less": true, "billing_start": null, "billing_end": null, "type": "invoice", "group_taxes_discounts": false, "created_at": 1579765167 } ``` ------------------------------------------------------------------------------------------------------- ### Update invoice ```php $api->invoice->fetch($invoiceId)->edit(array('line_items' => array(array('id' => 'li_DAweOizsysoJU6','name' => 'Book / English August - Updated name and quantity','quantity' => 1),array('name' => 'Book / A Wild Sheep Chase','amount' => 200,'currency' => 'INR','quantity' => 1)),'notes' => array('updated-key' => 'An updated note.'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be fetched | **Response:** For update invoice response please click [here](https://razorpay.com/docs/api/invoices/#update-an-invoice) ------------------------------------------------------------------------------------------------------- ### Issue an invoice ```php $api->invoice->fetch($invoiceId)->issue(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be issued | **Response:** ```json { "id": "inv_DAweOiQ7amIUVd", "entity": "invoice", "receipt": "#0961", "invoice_number": "#0961", "customer_id": "cust_DAtUWmvpktokrT", "customer_details": { "id": "cust_DAtUWmvpktokrT", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "9977886633", "gstin": null, "billing_address": { "id": "addr_DAtUWoxgu91obl", "type": "billing_address", "primary": true, "line1": "318 C-Wing, Suyog Co. Housing Society Ltd.", "line2": "T.P.S Road, Vazira, Borivali", "zipcode": "400092", "city": "Mumbai", "state": "Maharashtra", "country": "in" }, "shipping_address": null, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", "customer_contact": "9977886633" }, "order_id": "order_DBG3P8ZgDd1dsG", "line_items": [ { "id": "li_DAweOizsysoJU6", "item_id": null, "name": "Book / English August - Updated name and quantity", "description": "150 points in Quidditch", "amount": 400, "unit_amount": 400, "gross_amount": 400, "tax_amount": 0, "taxable_amount": 400, "net_amount": 400, "currency": "INR", "type": "invoice", "tax_inclusive": false, "hsn_code": null, "sac_code": null, "tax_rate": null, "unit": null, "quantity": 1, "taxes": [] }, { "id": "li_DAwjWQUo07lnjF", "item_id": null, "name": "Book / A Wild Sheep Chase", "description": null, "amount": 200, "unit_amount": 200, "gross_amount": 200, "tax_amount": 0, "taxable_amount": 200, "net_amount": 200, "currency": "INR", "type": "invoice", "tax_inclusive": false, "hsn_code": null, "sac_code": null, "tax_rate": null, "unit": null, "quantity": 1, "taxes": [] } ], "payment_id": null, "status": "issued", "expire_by": 1567103399, "issued_at": 1566974805, "paid_at": null, "cancelled_at": null, "expired_at": null, "sms_status": null, "email_status": null, "date": 1566891149, "terms": null, "partial_payment": false, "gross_amount": 600, "tax_amount": 0, "taxable_amount": 600, "amount": 600, "amount_paid": 0, "amount_due": 600, "currency": "INR", "currency_symbol": "₹", "description": "This is a test invoice.", "notes": { "updated-key": "An updated note." }, "comment": null, "short_url": "https://rzp.io/i/K8Zg72C", "view_less": true, "billing_start": null, "billing_end": null, "type": "invoice", "group_taxes_discounts": false, "created_at": 1566906474, "idempotency_key": null } ``` ------------------------------------------------------------------------------------------------------- ### Delete an invoice ```php $api->invoice->fetch($invoiceId)->delete(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be deleted | **Response:** ``` [] ``` ------------------------------------------------------------------------------------------------------- ### Cancel an invoice ```php $api->invoice->fetch($invoiceId)->cancel(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be cancelled | **Response:** ```json { "id": "inv_E7q0tqkxBRzdau", "entity": "invoice", "receipt": null, "invoice_number": null, "customer_id": "cust_E7q0trFqXgExmT", "customer_details": { "id": "cust_E7q0trFqXgExmT", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "9972132594", "gstin": null, "billing_address": { "id": "addr_E7q0ttqh4SGhAC", "type": "billing_address", "primary": true, "line1": "Ground & 1st Floor, SJR Cyber Laskar", "line2": "Hosur Road", "zipcode": "560068", "city": "Bengaluru", "state": "Karnataka", "country": "in" }, "shipping_address": { "id": "addr_E7q0ttKwVA1h2V", "type": "shipping_address", "primary": true, "line1": "Ground & 1st Floor, SJR Cyber Laskar", "line2": "Hosur Road", "zipcode": "560068", "city": "Bengaluru", "state": "Karnataka", "country": "in" }, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", "customer_contact": "9972132594" }, "order_id": "order_E7q0tvRpC0WJwg", "line_items": [ { "id": "li_E7q0tuPNg84VbZ", "item_id": null, "ref_id": null, "ref_type": null, "name": "Master Cloud Computing in 30 Days", "description": "Book by Ravena Ravenclaw", "amount": 399, "unit_amount": 399, "gross_amount": 399, "tax_amount": 0, "taxable_amount": 399, "net_amount": 399, "currency": "INR", "type": "invoice", "tax_inclusive": false, "hsn_code": null, "sac_code": null, "tax_rate": null, "unit": null, "quantity": 1, "taxes": [] } ], "payment_id": null, "status": "cancelled", "expire_by": null, "issued_at": 1579765167, "paid_at": null, "cancelled_at": 1579768206, "expired_at": null, "sms_status": "sent", "email_status": "sent", "date": 1579765167, "terms": null, "partial_payment": false, "gross_amount": 399, "tax_amount": 0, "taxable_amount": 399, "amount": 399, "amount_paid": 0, "amount_due": 399, "currency": "INR", "currency_symbol": "₹", "description": null, "notes": [], "comment": null, "short_url": "https://rzp.io/i/2wxV8Xs", "view_less": true, "billing_start": null, "billing_end": null, "type": "invoice", "group_taxes_discounts": false, "created_at": 1579765167, "idempotency_key": null } ``` ------------------------------------------------------------------------------------------------------- ### Send notification ```php $api->invoice->fetch($invoiceId)->notify($medium); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be notified | | medium* | string | `sms`/`email`, Medium through which notification should be sent. | **Response:** ```json { "success": true } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/invoices)** razorpay/documents/registeremandate.md 0000666 00000033112 15165415146 0014275 0 ustar 00 ## Register emandate and charge first payment together ### Create customer ```php $api->customer->create(array('name' => 'Razorpay User', 'email' => 'customer@razorpay.com','contact'=>'9123456780', 'fail_existing'=> '0', 'notes'=> array('notes_key_1'=> 'Tea, Earl Grey, Hot','notes_key_2'=> 'Tea, Earl Grey… decaf')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | name* | string | Name of the customer | | email | string | Email of the customer | | contact | string | Contact number of the customer | | fail_existing | string | If a customer with the same details already exists, the request throws an exception by default. Possible value is `0` or `1`| | notes | array | A key-value pair | **Response:** ```json { "id": "cust_1Aa00000000003", "entity": "customer", "name": "Gaurav Kumar", "email": "Gaurav.Kumar@example.com", "contact": "9000000000", "gstin": null, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "created_at": 1582033731 } ``` ------------------------------------------------------------------------------------------------------- ### Create order ```php $api->order->create(array('amount' => 100, 'currency' => 'INR', 'method'=>'emandate', 'customer_id'=>$customerId, 'receipt'=>'Receipt No. 5', 'notes'=> array('note_key 1'=> 'Beam me up Scotty','note_key 2'=> 'Engage'), 'token'=>array('first_payment_amount'=>10000, 'auth_type'=>'netbanking' ,'max_amount'=>'9999900','expire_at'=>'4102444799', 'notes'=>array('note_key 1'=> 'Tea, Earl Grey… decaf.','note_key 2'=> 'Tea. Earl Gray. Hot.'), 'bank_account'=>array('beneficiary_name'=>'Gaurav Kumar', 'account_number'=>'11214311215411', 'account_type'=>'savings', 'ifsc_code'=>'HDFC0001233')))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | customerId* | string | The id of the customer to be fetched | | method* | string | Payment method used to make the registration transaction. Possible value is `emandate`. | | receipt | string | Your system order reference id. | | token | array | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#112-create-an-order) are supported | | notes | array | A key-value pair | **Response:** For create order response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#112-create-an-order) ------------------------------------------------------------------------------------------------------- ### Create an Authorization Payment Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#113-create-an-authorization-payment) for authorization payment ----------------------------------------------------------------------------------------------------- ### Create registration link ```php $api->subscription->createSubscriptionRegistration(array('customer'=>array('name'=>'Gaurav Kumar','email'=>'gaurav.kumar@example.com','contact'=>'9123456780'),'type'=>'link','amount'=>100,'currency'=>'INR','description'=>'Registration Link for Gaurav Kumar','subscription_registration'=>array('first_payment_amount'=>100, 'method'=>'emandate', 'auth_type'=>'netbanking' ,'max_amount'=>'50000','expire_at'=>'1634215992','bank_account'=>array('beneficiary_name'=>'Gaurav Kumar', 'account_number'=>'11214311215411', 'account_type'=>'savings', 'ifsc_code'=>'HDFC0001233')),'receipt'=>'Receipt No. 5','email_notify'=>1,'sms_notify'=>1,'expire_by'=>1634215992, 'notes'=> array('note_key 1'=> 'Beam me up Scotty','note_key 2'=> 'Tea. Earl Gray. Hot.')) ); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|---------------------------------------------------------------| | customer | array | Details of the customer to whom the registration link will be sent. | | type* | array | the value is `link`. | | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | description* | string | A brief description of the payment. | | subscription_registration | array | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#121-create-a-registration-link) are supported | | receipt | string | Your system order reference id. | | sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) | | email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) | | expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | | notes | array | A key-value pair | **Response:** For create registration link response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#12-using-a-registration-link) ------------------------------------------------------------------------------------------------------- ## Create an order to charge the customer ```php $api->order->create(array('amount' => '100', 'currency' => 'INR', 'receipt' => 'Receipt No. 1', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | receipt | string | Your system order reference id. | | notes | array | A key-value pair | **Response:** ```json { "id":"order_1Aa00000000002", "entity":"order", "amount":1000, "amount_paid":0, "amount_due":1000, "currency":"INR", "receipt":"Receipt No. 1", "offer_id":null, "status":"created", "attempts":0, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "created_at":1579782776 } ``` ------------------------------------------------------------------------------------------------------- ## Create a recurring payment ```php $api->payment->createRecurring(['email'=>'gaurav.kumar@example.com','contact'=>'9123456789','amount'=>1000,'currency'=>'INR','order_id'=>$orderid,'customer_id'=>$customerId,'token'=>$tokenId,'recurring'=>'1','description'=>'Creating recurring payment for Gaurav Kumar', 'notes'=> array('key1'=> 'value3','key2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | email* | string | The customer's email address | | contact* | string | The customer's phone number | | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | | orderId* | string | The id of the order to be fetched | | customerId* | string | The id of the customer to be fetched | | tokenId* | string | The id of the token to be fetched | | recurring* | boolean | Possible values is `0` or `1` | | description | string | A brief description of the payment. | | notes | array | A key-value pair | **Response:** ```json { "razorpay_payment_id" : "pay_1Aa00000000001", "razorpay_order_id" : "order_1Aa00000000001", "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" } ``` ------------------------------------------------------------------------------------------------------- ## Send/Resend notifications ```php $api->invoice->fetch($invoiceId)->notifyBy($medium); ``` **Parameters:** | Name | Type |Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be fetched | | medium* | string | Possible values are `sms` or `email` | **Response:** ```json { "success": true } ``` ------------------------------------------------------------------------------------------------------- ## Cancel registration link ```php $api->invoice->fetch($invoiceId)->cancel(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be fetched | **Response:** ```json { "id": "inv_FHrfRupD2ouKIt", "entity": "invoice", "receipt": "Receipt No. 1", "invoice_number": "Receipt No. 1", "customer_id": "cust_BMB3EwbqnqZ2EI", "customer_details": { "id": "cust_BMB3EwbqnqZ2EI", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "9123456780", "gstin": null, "billing_address": null, "shipping_address": null, "customer_name": "Gaurav Kumar", "customer_email": "gaurav.kumar@example.com", "customer_contact": "9123456780" }, "order_id": "order_FHrfRw4TZU5Q2L", "line_items": [], "payment_id": null, "status": "cancelled", "expire_by": 4102444799, "issued_at": 1595491479, "paid_at": null, "cancelled_at": 1595491488, "expired_at": null, "sms_status": "sent", "email_status": "sent", "date": 1595491479, "terms": null, "partial_payment": false, "gross_amount": 100, "tax_amount": 0, "taxable_amount": 0, "amount": 100, "amount_paid": 0, "amount_due": 100, "currency": "INR", "currency_symbol": "₹", "description": "Registration Link for Gaurav Kumar", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "comment": null, "short_url": "https://rzp.io/i/QlfexTj", "view_less": true, "billing_start": null, "billing_end": null, "type": "link", "group_taxes_discounts": false, "created_at": 1595491480, "idempotency_key": null } ``` ------------------------------------------------------------------------------------------------------- ## Fetch token by payment id ```php $api->payment->fetch($paymentId); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | paymentId* | string | The id of the payment to be fetched | **Response:** For fetch token by payment id response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#21-fetch-token-by-payment-id) ------------------------------------------------------------------------------------------------------- ## Fetch tokens by customer id ```php $api->customer->fetch($customerId)->tokens()->all(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | customerId* | string | The id of the customer to be fetched | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "token_FHf94Uym9tdYFJ", "entity": "token", "token": "2wDPM7VAlXtjAR", "bank": "HDFC", "wallet": null, "method": "emandate", "vpa": null, "recurring": true, "recurring_details": { "status": "confirmed", "failure_reason": null }, "auth_type": "netbanking", "mrn": null, "used_at": 1595447381, "created_at": 1595447381, "bank_details": { "beneficiary_name": "Gaurav Kumar", "account_number": "1121431121541121", "ifsc": "HDFC0000001", "account_type": "savings" }, "max_amount": 9999900, "expired_at": 1689971140, "dcc_enabled": false } ] } ``` ------------------------------------------------------------------------------------------------------- ## Delete tokens ```php $api->customer->fetch($customerId)->tokens()->delete($tokenId); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | customerId* | string | The id of the customer to be fetched | | tokenId* | string | The id of the token to be fetched | **Response:** ```json { "deleted": true } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/)** razorpay/documents/token.md 0000666 00000011370 15165415146 0012074 0 ustar 00 ## Tokens ### Fetch token by payment id ```php $api->payment->fetch($paymentId); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | paymentId* | string | The id of the payment to be fetched | **Response:** ```json { "id": "pay_FHfqtkRzWvxky4", "entity": "payment", "amount": 100, "currency": "INR", "status": "captured", "order_id": "order_FHfnswDdfu96HQ", "invoice_id": null, "international": false, "method": "card", "amount_refunded": 0, "refund_status": null, "captured": true, "description": null, "card_id": "card_F0zoXUp4IPPGoI", "bank": null, "wallet": null, "vpa": null, "email": "gaurav.kumar@example.com", "contact": "+919876543210", "customer_id": "cust_DtHaBuooGHTuyZ", "token_id": "token_FHfn3rIiM1Z8nr", "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." }, "fee": 0, "tax": 0, "error_code": null, "error_description": null, "error_source": null, "error_step": null, "error_reason": null, "acquirer_data": { "auth_code": "541898" }, "created_at": 1595449871 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch tokens by customer id ```php $api->customer->fetch($customerId)->tokens()->all(); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | customerId* | string | The id of the customer to be fetched | **Response:** ```json { "entity":"collection", "count":1, "items":[ { "id":"token_HouA2OQR5Z2jTL", "entity":"token", "token":"2JPRk664pZHUWG", "bank":null, "wallet":null, "method":"card", "card":{ "entity":"card", "name":"Gaurav Kumar", "last4":"8950", "network":"Visa", "type":"credit", "issuer":"STCB", "international":false, "emi":false, "sub_type":"consumer", "expiry_month":12, "expiry_year":2021, "flows":{ "otp":true, "recurring":true } }, "recurring":true, "recurring_details":{ "status":"confirmed", "failure_reason":null }, "auth_type":null, "mrn":null, "used_at":1629779657, "created_at":1629779657, "expired_at":1640975399, "dcc_enabled":false, "billing_address":null } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch particular token ```php $api->customer->fetch($customerId)->tokens()->fetch($tokenId); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | customerId* | string | The id of the customer to be fetched | | tokenId* | string | The id of the token to be fetched | **Response:** ```json { "id": "token_Hxe0skTXLeg9pF", "entity": "token", "token": "F85BgXnGVwcuqV", "bank": null, "wallet": null, "method": "card", "card": { "entity": "card", "name": "ankit", "last4": "5449", "network": "MasterCard", "type": "credit", "issuer": "UTIB", "international": false, "emi": false, "sub_type": "consumer", "expiry_month": 12, "expiry_year": 2024, "flows": { "recurring": true } }, "recurring": true, "auth_type": null, "mrn": null, "used_at": 1632976165, "created_at": 1631687852, "expired_at": 1634215992, "dcc_enabled": false } ``` ------------------------------------------------------------------------------------------------------- ### Delete token ```php $api->customer->fetch($customerId)->tokens()->delete($tokenId); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | customerId* | string | The id of the customer to be fetched | | tokenId* | string | The id of the token to be fetched | **Response:** ```json { "deleted": true } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/recurring-payments/upi/tokens/)** razorpay/documents/item.md 0000666 00000011335 15165415146 0011713 0 ustar 00 ## items ### Create item ```php $api->Item->create(array("name" => "Book / English August","description" => "An indian story, Booker prize winner.","amount" => 20000,"currency" => "INR")); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | name* | string | Name of the item. | | description | string | A brief description of the item. | | amount | integer | Amount of the order to be paid | | currency | string | Currency of the order. Currently only `INR` is supported. | **Response:** ```json { "id": "item_7Oxp4hmm6T4SCn", "active": true, "name": "Book / English August", "description": "An indian story, Booker prize winner.", "amount": 20000, "currency": "INR" } ``` ------------------------------------------------------------------------------------------------------- ### Fetch all items ```php $api->Item->all($options); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | from | timestamp | timestamp after which the item were created | | to | timestamp | timestamp before which the item were created | | count | integer | number of item to fetch (default: 10) | | skip | integer | number of item to be skipped (default: 0) | | name | string | Name of the item. | | description | string | A brief description of the item. | | amount | integer | Amount of the order to be paid | | currency | string | Currency of the order. Currently only `INR` is supported. | | active | boolean | Possible values is `0` or `1` | **Response:** ```json { "entity": "collection", "count": 3, "items": [ { "id": "item_7Oy8OMV6BdEAac", "active": true, "name": "Book / Ignited Minds", "description": null, "amount": 15000, "currency": "INR" }, { "id": "item_7Oxp4hmm6T4SCn", "active": true, "name": "Book / English August", "description": "An indian story, Booker prize winner.", "amount": 20000, "currency": "INR" }, { "id": "item_7OxoGnoxCuUKbo", "active": true, "name": "Book / English August", "description": null, "amount": 20000, "currency": "INR" } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch particular item ```php $api->Item->fetch($itemId); ``` **Parameters** | Name | Type | Description | |----------|--------|-------------------------------------| | itemId* | string | The id of the item to be fetched | **Response:** ```json { "id": "item_7Oxp4hmm6T4SCn", "active": true, "name": "Book / English August", "description": "An indian story, Booker prize winner.", "amount": 20000, "currency": "INR" } ``` ------------------------------------------------------------------------------------------------------- ### Update item ```php $api->Item->fetch($itemId)->edit(array("name" => "Book / Ignited Minds - Updated name!","description" => "New descirption too. :).","amount" => 20000,"currency" => "INR","active" => true )); ``` **Parameters** | Name | Type | Description | |----------|--------|-------------------------------------| | itemId* | string | The id of the item to be fetched | | name | string | Name of the item. | | description | string | A brief description of the item. | | amount | integer | Amount of the order to be paid | | currency | string | Currency of the order. Currently only `INR` is supported. | | active | boolean | Possible values is `0` or `1` | **Response:** ```json { "id": "item_7Oy8OMV6BdEAac", "active": true, "name": "Book / Ignited Minds - Updated name!", "description": "New descirption too. :)", "amount": 15000, "currency": "INR" } ``` ------------------------------------------------------------------------------------------------------- ### Delete item ```php $api->Item->fetch($itemId)->delete(); ``` **Parameters** | Name | Type | Description | |----------|--------|-------------------------------------| | itemId* | string | The id of the item to be fetched | **Response:** ```json [] ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/items)** razorpay/documents/paymentLink.md 0000666 00000101635 15165415146 0013253 0 ustar 00 ## Payment Links ### Create payment link Request #1 Standard Payment Link ```php $api->payment_link->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) , 'reminder_enable'=>true ,'notes'=>array('policy_name'=> 'Jeevan Bima'),'callback_url' => 'https://example-callback-url.com/', 'callback_method'=>'get')); ``` Request #2 UPI Payment Link ```php $api->payment_link->create(array('upi_link'=>true,'amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) , 'reminder_enable'=>true ,'notes'=>array('policy_name'=> 'Jeevan Bima'))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |upi_link* | boolean | boolean Must be set to true // to creating UPI Payment Link only | |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |description | string | A brief description of the Payment Link | |reference_id | string | AReference number tagged to a Payment Link. | |customer | array | name, email, contact | |expire_by | integer | Timestamp, in Unix, at which the Payment Link will expire. By default, a Payment Link will be valid for six months from the date of creation. | |notify | object | sms or email (boolean) | |notes | json object | Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty” | **Response:** For create payment link response please click [here](https://razorpay.com/docs/api/payment-links/#create-payment-link) ------------------------------------------------------------------------------------------------------- ### Fetch all payment link ```php $api->paymentLink->all(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |payment_id | string | Unique identifier of the payment associated with the Payment Link. | |reference_id | string | The unique reference number entered by you while creating the Payment Link. | **Response:** For fetch all payment link response please click [here](https://razorpay.com/docs/api/payment-links/#all-payment-links) ------------------------------------------------------------------------------------------------------- ### Fetch specific payment link ```php $api->paymentLink->fetch($paymentLinkId); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | paymentLinkId* | string | Unique identifier of the Payment Link. | **Response:** For fetch specific payment link response please click [here](https://razorpay.com/docs/api/payment-links/#specific-payment-links-by-id) ------------------------------------------------------------------------------------------------------- ### Update payment link ```php $api->paymentLink->fetch($paymentLinkId)->edit(array("reference_id"=>"TS42", "expire_by"=>"1640270451" , "reminder_enable"=>0, "notes"=>["policy_name"=>"Jeevan Saral 2"])); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | paymentLinkId* | string | The unique identifier of the Payment Link that needs to be updated. | | accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values: true - Customer can make partial payments. false (default) - Customer cannot make partial payments. | | reference_id | string | Adds a unique reference number to an existing link. | | expire_by | integer | Timestamp, in Unix format, when the payment links should expire. | | notes | string | object Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”. | **Response:** For updating payment link response please click [here](https://razorpay.com/docs/api/payment-links/#update-payment-link) ------------------------------------------------------------------------------------------------------- ### Cancel a payment link ```php $api->paymentLink->fetch($paymentLinkId)->cancel(); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | paymentLinkId* | string | Unique identifier of the Payment Link. | **Response:** For canceling payment link response please click [here](https://razorpay.com/docs/api/payment-links/#cancel-payment-link) ------------------------------------------------------------------------------------------------------- ### Send notification ```php $api->paymentLink->fetch($paymentLinkId)->notifyBy($medium)); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | paymentLinkId* | string | Unique identifier of the Payment Link that should be resent. | | medium* | string | `sms`/`email`,Medium through which the Payment Link must be resent. Allowed values are: | **Response:** ```json { "success": true } ``` ------------------------------------------------------------------------------------------------------- ### Transfer payments received using payment links ```php $api->payment_link->create(array('amount'=>20000, 'currency'=>'INR', 'accept_partial'=>false, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('order'=>array('transfers'=>array('account'=>'acc_CPRsN1LkFccllA', 'amount'=>500, 'currency'=>'INR', 'notes'=>array('branch'=>'Acme Corp Bangalore North', 'name'=>'Bhairav Kumar' ,'linked_account_notes'=>array('branch'))), array('account'=>'acc_CNo3jSI8OkFJJJ', 'amount'=>500, 'currency'=>'INR', 'notes'=>array('branch'=>'Acme Corp Bangalore North', 'name'=>'Saurav Kumar' ,'linked_account_notes'=>array('branch'))))))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |amount* | integer | Amount to be paid using the Payment Link. | |options* | array | Options to configure the transfer in the Payment Link. Parent parameter under which the order child parameter must be passed. | **Response:** ```json { "accept_partial": false, "amount": 1500, "amount_paid": 0, "callback_method": "", "callback_url": "", "cancelled_at": 0, "created_at": 1596526969, "currency": "INR", "customer": { "contact": "+919999999999", "email": "gaurav.kumar@example.com", "name": "Gaurav Kumar" }, "deleted_at": 0, "description": "Payment for policy no #23456", "expire_by": 0, "expired_at": 0, "first_min_partial_amount": 0, "id": "plink_FMbhpT6nqDjDei", "notes": null, "notify": { "email": true, "sms": true }, "payments": null, "reference_id": "#aasasw8", "reminder_enable": true, "reminders": [], "short_url": "https://rzp.io/i/ORor1MT", "source": "", "source_id": "", "status": "created", "updated_at": 1596526969, "user_id": "" } ``` ------------------------------------------------------------------------------------------------------- ### Offers on payment links ```php $api->payment_link->create(array('amount'=>20000, 'currency'=>'INR', 'accept_partial'=>false, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>false , 'options'=>array('order'=>array('offers'=>array('offer_I0PqexIiTmMRnA')))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |description | string | A brief description of the Payment Link | |reference_id | string | AReference number tagged to a Payment Link. | |customer | array | name, email, contact | |expire_by | integer | Timestamp, in Unix, at which the Payment Link will expire. By default, a Payment Link will be valid for six months from the date of creation. | |notify | object | sms or email (boolean) | |options* | array | Options to associate the offer_id with the Payment Link. Parent parameter under which the order child parameter must be passed. | **Response:** ```json { "accept_partial": false, "amount": 3400, "amount_paid": 0, "cancelled_at": 0, "created_at": 1600183040, "currency": "INR", "customer": { "contact": "+919999999999", "email": "gaurav.kumar@example.com", "name": "Gaurav Kumar" }, "description": "Payment for policy no #23456", "expire_by": 0, "expired_at": 0, "first_min_partial_amount": 0, "id": "plink_FdLt0WBldRyE5t", "notes": null, "notify": { "email": true, "sms": true }, "payments": null, "reference_id": "#425", "reminder_enable": false, "reminders": [], "short_url": "https://rzp.io/i/CM5ohDC", "status": "created", "user_id": "" } ``` ------------------------------------------------------------------------------------------------------- ### Managing reminders for payment links ```php $api->payment_link->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>false)); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |amount* | integer | Amount to be paid using the Payment Link. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |description | string | A brief description of the Payment Link | |customer | array | name, email, contact | |expire_by | integer | Timestamp, in Unix, at which the Payment Link will expire. By default, a Payment Link will be valid for six months from the date of creation. | |notify | object | sms or email (boolean) | |reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | **Response:** ```json { "amount": 340000, "amount_due": 340000, "amount_paid": 0, "billing_end": null, "billing_start": null, "cancelled_at": null, "comment": null, "created_at": 1592579126, "currency": "INR", "currency_symbol": "₹", "customer_details": { "billing_address": null, "contact": "9900990099", "customer_contact": "9900990099", "customer_email": "gaurav.kumar@example.com", "customer_name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "gstin": null, "id": "cust_F4WNtqj1xb0Duv", "name": "Gaurav Kumar", "shipping_address": null }, "customer_id": "cust_F4WNtqj1xb0Duv", "date": 1592579126, "description": "Salon at Home Service", "email_status": null, "entity": "invoice", "expire_by": 1608390326, "expired_at": null, "first_payment_min_amount": 0, "gross_amount": 340000, "group_taxes_discounts": false, "id": "inv_F4WfpZLk1ct35b", "invoice_number": null, "issued_at": 1592579126, "line_items": [], "notes": [], "order_id": "order_F4WfpxUzWmYOTl", "paid_at": null, "partial_payment": false, "payment_id": null, "receipt": "5757", "reminder_enable": false, "short_url": "https://rzp.io/i/vitLptM", "sms_status": null, "status": "issued", "tax_amount": 0, "taxable_amount": 0, "terms": null, "type": "link", "user_id": "", "view_less": true } ``` ------------------------------------------------------------------------------------------------------- ### Rename labels in checkout section ```php $api->payment_link->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('checkout'=>array('partial_payment'=>array('min_amount_label'=>'Minimum Money to be paid', 'partial_amount_label'=>'Pay in parts', 'partial_amount_description'=>'Pay at least ₹100', 'full_amount_label'=>'Pay the entire amount'))))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |amount* | integer | Amount to be paid using the Payment Link. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |description | string | A brief description of the Payment Link | |customer | array | name, email, contact | |expire_by | integer | Timestamp, in Unix, at which the Payment Link will expire. By default, a Payment Link will be valid for six months from the date of creation. | |notify | object | sms or email (boolean) | |reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | |options* | array | Options to rename the labels for partial payment fields in the checkout form. Parent parameter under which the checkout and partial_payment child parameters must be passed. | **Response:** ```json { "accept_partial": true, "amount": 1000, "amount_paid": 0, "callback_method": "", "callback_url": "", "cancelled_at": 0, "created_at": 1596193199, "currency": "INR", "customer": { "contact": "+919999999999", "email": "gaurav.kumar@example.com", "name": "Gaurav Kumar" }, "deleted_at": 0, "description": "Payment for policy no #23456", "expire_by": 0, "expired_at": 0, "first_min_partial_amount": 100, "id": "plink_FL4vbXVKfW7PAz", "notes": null, "notify": { "email": true, "sms": true }, "payments": null, "reference_id": "#42321", "reminder_enable": true, "reminders": [], "short_url": "https://rzp.io/i/F4GC9z1", "source": "", "source_id": "", "status": "created", "updated_at": 1596193199, "user_id": "" } ``` ------------------------------------------------------------------------------------------------------- ### Change Business name ```php $api->payment_link->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('checkout'=>array('name'=>'Lacme Corp')))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | |first_min_partial_amount | integer | | |description | string | A brief description of the Payment Link | |customer | array | name, email, contact | |notify | object | sms or email (boolean) | |reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | |options* | array | Option to customize the business name. Parent parameter under which the checkout child parameter must be passed.| **Response:** ```json { "accept_partial": true, "amount": 1000, "amount_paid": 0, "callback_method": "", "callback_url": "", "cancelled_at": 0, "created_at": 1596187657, "currency": "INR", "customer": { "contact": "+919999999999", "email": "gaurav.kumar@example.com", "name": "Gaurav Kumar" }, "description": "Payment for policy no #23456", "expire_by": 0, "expired_at": 0, "first_min_partial_amount": 100, "id": "plink_FL3M2gJFs1Jkma", "notes": null, "notify": { "email": true, "sms": true }, "payments": null, "reference_id": "#2234542", "reminder_enable": true, "reminders": [], "short_url": "https://rzp.io/i/at2OOsR", "source": "", "source_id": "", "status": "created", "updated_at": 1596187657, "user_id": "" } ``` ------------------------------------------------------------------------------------------------------- ### Prefill checkout fields ```php $api->payment_link->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('checkout'=>array('prefill'=>array('method'=>'card', 'card[name]'=>'Gaurav Kumar', 'card[number]'=>'4111111111111111', 'card[expiry]'=>'12/21', 'card[cvv]'=>'123'))))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | |first_min_partial_amount | integer | | |description | string | A brief description of the Payment Link | |customer | array | name, email, contact | |notify | object | sms or email (boolean) | |reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | |options* | array | Options to customize Checkout. Parent parameter under which the checkout and prefill child parameters must be passed.| **Response:** For prefill checkout fields response please click [here](https://razorpay.com/docs/payment-links/api/new/advanced-options/customize/prefill/) ------------------------------------------------------------------------------------------------------- ### Customize payment methods ```php $api->payment_link->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('checkout'=>array('method'=>array('netbanking'=>'1', 'card'=>'1', 'upi'=>'0', 'wallet'=>'0'))))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | |first_min_partial_amount | integer | | |description | string | A brief description of the Payment Link | |customer | array | name, email, contact | |notify | object | sms or email (boolean) | |reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | |options* | array | Options to display or hide payment methods on the Checkout section. Parent parameter under which the checkout and method child parameters must be passed.| **Response:** ```json { "accept_partial": true, "amount": 1000, "amount_paid": 0, "callback_method": "", "callback_url": "", "cancelled_at": 0, "created_at": 1596188371, "currency": "INR", "customer": { "contact": "+919999999999", "email": "gaurav.kumar@example.com", "name": "Gaurav Kumar" }, "deleted_at": 0, "description": "Payment for policy no #23456", "expire_by": 0, "expired_at": 0, "first_min_partial_amount": 100, "id": "plink_FL3YbdvN2Cj6gh", "notes": null, "notify": { "email": true, "sms": true }, "payments": null, "reference_id": "#543422", "reminder_enable": true, "reminders": [], "short_url": "https://rzp.io/i/wKiXKud", "source": "", "source_id": "", "status": "created", "updated_at": 1596188371, "user_id": "" } ``` ------------------------------------------------------------------------------------------------------- ### Set checkout fields as read-only ```php $api->payment_link->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('checkout'=>array('readonly'=>array('email'=>'1','contact'=>'1'))))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | |first_min_partial_amount | integer | | |description | string | A brief description of the Payment Link | |customer | array | name, email, contact | |notify | object | sms or email (boolean) | |reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | |options* | array | Options to set contact and email as read-only fields on Checkout. Parent parameter under which the checkout and readonly child parameters must be passed.| **Response:** ```json { "accept_partial": true, "amount": 1000, "amount_paid": 0, "callback_method": "", "callback_url": "", "cancelled_at": 0, "created_at": 1596190845, "currency": "INR", "customer": { "contact": "+919999999999", "email": "gaurav.kumar@example.com", "name": "Gaurav Kumar" }, "deleted_at": 0, "description": "Payment for policy no #23456", "expire_by": 0, "expired_at": 0, "first_min_partial_amount": 100, "id": "plink_FL4GA1t6FBcaVR", "notes": null, "notify": { "email": true, "sms": true }, "payments": null, "reference_id": "#19129", "reminder_enable": true, "reminders": [], "short_url": "https://rzp.io/i/QVwUglR", "source": "", "source_id": "", "status": "created", "updated_at": 1596190845, "user_id": "" } ``` ------------------------------------------------------------------------------------------------------- ### Implement thematic changes in payment links checkout section ```php $api->payment_link->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('checkout'=>array('theme'=>array('hide_topbar'=>'true'))))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | |first_min_partial_amount | integer | | |description | string | A brief description of the Payment Link | |customer | array | name, email, contact | |notify | object | sms or email (boolean) | |reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | |options* | array | Options to show or hide the top bar. Parent parameter under which the checkout and theme child parameters must be passed.| **Response:** ```json { "accept_partial": true, "amount": 1000, "amount_paid": 0, "callback_method": "", "callback_url": "", "cancelled_at": 0, "created_at": 1596187814, "currency": "INR", "customer": { "contact": "+919999999999", "email": "gaurav.kumar@example.com", "name": "Gaurav Kumar" }, "description": "Payment for policy no #23456", "expire_by": 0, "expired_at": 0, "first_min_partial_amount": 100, "id": "plink_FL3Oncr7XxXFf6", "notes": null, "notify": { "email": true, "sms": true }, "payments": null, "reference_id": "#423212", "reminder_enable": true, "reminders": [], "short_url": "https://rzp.io/i/j45EmLE", "source": "", "source_id": "", "status": "created", "updated_at": 1596187814, "user_id": "" } ``` ------------------------------------------------------------------------------------------------------- ### Rename labels in payment details section ```php $api->payment_link->create(array('amount'=>500, 'currency'=>'INR', 'accept_partial'=>true, 'first_min_partial_amount'=>100, 'description' => 'For XYZ purpose', 'customer' => array('name'=>'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com', 'contact'=>'+919999999999'), 'notify'=>array('sms'=>true, 'email'=>true) ,'reminder_enable'=>true , 'options'=>array('hosted_page'=>array('label'=>array('receipt'=>'Ref No.', 'description'=>'Course Name', 'amount_payable'=>'Course Fee Payable', 'amount_paid'=>'Course Fee Paid', 'partial_amount_due'=>'Fee Installment Due', 'partial_amount_paid'=>'Fee Installment Paid', 'expire_by'=>'Pay Before', 'expired_on'=>'1632223497','amount_due'=>'Course Fee Due'), 'show_preferences'=>array('issued_to'=>false))))); ``` **Parameters:** | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | |first_min_partial_amount | integer | | |description | string | A brief description of the Payment Link | |customer | array | name, email, contact | |notify | object | sms or email (boolean) | |reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | |options* | array | Parent parameter under which the hosted_page and label child parameters must be passed.| **Response:** For rename labels in payment details section response please click [here](https://razorpay.com/docs/payment-links/api/new/advanced-options/customize/rename-payment-details-labels/) ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/payment-links/)** razorpay/documents/transfer.md 0000666 00000037426 15165415146 0012612 0 ustar 00 ## Transfers ### Create transfers from payment ```php $api->payment->fetch($paymentId)->transfer(array('transfers' => array('account'=> $accountId, 'amount'=> '1000', 'currency'=>'INR', 'notes'=> array('name'=>'Gaurav Kumar', 'roll_no'=>'IEC2011025'), 'linked_account_notes'=>array('branch'), 'on_hold'=>'1', 'on_hold_until'=>'1671222870'))); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | paymentId* | string | The id of the payment to be fetched | | transfers | array | All parameters listed [here](https://razorpay.com/docs/api/route/#create-transfers-from-payments) are supported | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "trf_E9uhYLFLLZ2pks", "entity": "transfer", "source": "pay_E8JR8E0XyjUSZd", "recipient": "acc_CPRsN1LkFccllA", "amount": 100, "currency": "INR", "amount_reversed": 0, "notes": { "name": "Gaurav Kumar", "roll_no": "IEC2011025" }, "on_hold": true, "on_hold_until": 1671222870, "recipient_settlement_id": null, "created_at": 1580218356, "linked_account_notes": [ "roll_no" ], "processed_at": 1580218357 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Create transfers from order ```php $api->order->create(array('amount' => 2000,'currency' => 'INR','transfers' => array(array('account' => 'acc_CPRsN1LkFccllA','amount' => 1000,'currency' => 'INR','notes' => array('branch' => 'Acme Corp Bangalore North','name' => 'Gaurav Kumar'),'linked_account_notes' => array('branch'),'on_hold' => 1,'on_hold_until' => 1671222870),array('account' => 'acc_CNo3jSI8OkFJJJ','amount' => 1000,'currency' => 'INR','notes' => array('branch' => 'Acme Corp Bangalore South','name' => 'Saurav Kumar'),'linked_account_notes' => array('branch'),'on_hold' => 0)))); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | amount* | integer | The transaction amount, in paise | | currency* | string | The currency of the payment (defaults to INR) | | receipt | string | A unique identifier provided by you for your internal reference. | | transfers | array | All parameters listed [here](https://razorpay.com/docs/api/route/#create-transfers-from-orders) are supported | **Response:** ```json { "id": "order_E9uTczH8uWPCyQ", "entity": "order", "amount": 2000, "amount_paid": 0, "amount_due": 2000, "currency": "INR", "receipt": null, "offer_id": null, "status": "created", "attempts": 0, "notes": [], "created_at": 1580217565, "transfers": [ { "recipient": "acc_CPRsN1LkFccllA", "amount": 1000, "currency": "INR", "notes": { "branch": "Acme Corp Bangalore North", "name": "Gaurav Kumar" }, "linked_account_notes": [ "branch" ], "on_hold": true, "on_hold_until": 1671222870 }, { "recipient": "acc_CNo3jSI8OkFJJJ", "amount": 1000, "currency": "INR", "notes": { "branch": "Acme Corp Bangalore South", "name": "Saurav Kumar" }, "linked_account_notes": [ "branch" ], "on_hold": false, "on_hold_until": null } ] } ``` ------------------------------------------------------------------------------------------------------- ### Direct transfers ```php $api->transfer->create(array('account' => $accountId, 'amount' => 500, 'currency' => 'INR')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | accountId* | string | The id of the account to be fetched | | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency* | string | The currency of the payment (defaults to INR) | **Response:** ```json { "id": "trf_E9utgtfGTcpcmm", "entity": "transfer", "source": "acc_CJoeHMNpi0nC7k", "recipient": "acc_CPRsN1LkFccllA", "amount": 100, "currency": "INR", "amount_reversed": 0, "notes": [], "fees": 1, "tax": 0, "on_hold": false, "on_hold_until": null, "recipient_settlement_id": null, "created_at": 1580219046, "linked_account_notes": [], "processed_at": 1580219046 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch transfer for a payment ```php $api->payment->fetch($paymentId)->transfer(); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | paymentId* | string | The id of the payment to be fetched | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "trf_EAznuJ9cDLnF7Y", "entity": "transfer", "source": "pay_E9up5WhIfMYnKW", "recipient": "acc_CMaomTz4o0FOFz", "amount": 1000, "currency": "INR", "amount_reversed": 100, "notes": [], "fees": 3, "tax": 0, "on_hold": false, "on_hold_until": null, "recipient_settlement_id": null, "created_at": 1580454666, "linked_account_notes": [], "processed_at": 1580454666 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch transfer for an order ```php $api->order->fetch($orderId)->transfers(array('expand[]'=>'transfers')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | orderId* | string | The id of the order to be fetched | | expand* | string | Supported value is `transfer` | **Response:** ```json { "id": "order_DSkl2lBNvueOly", "entity": "order", "amount": 1000, "amount_paid": 1000, "amount_due": 0, "currency": "INR", "receipt": null, "offer_id": null, "status": "paid", "attempts": 1, "notes": [], "created_at": 1570794714, "transfers": { "entity": "collection", "count": 1, "items": [ { "id": "trf_DSkl2lXWbiADZG", "entity": "transfer", "source": "order_DSkl2lBNvueOly", "recipient": "acc_CNo3jSI8OkFJJJ", "amount": 500, "currency": "INR", "amount_reversed": 0, "notes": { "branch": "Acme Corp Bangalore North", "name": "Gaurav Kumar" }, "fees": 2, "tax": 0, "on_hold": true, "on_hold_until": 1670776632, "recipient_settlement_id": null, "created_at": 1570794714, "linked_account_notes": [ "Acme Corp Bangalore North" ], "processed_at": 1570794772 } ] } } ``` ------------------------------------------------------------------------------------------------------- ### Fetch transfer ```php $api->transfer->fetch($transferId); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | transferId* | string | The id of the transfer to be fetched | **Response:** ```json { "id": "trf_E7V62rAxJ3zYMo", "entity": "transfer", "source": "pay_E6j30Iu1R7XbIG", "recipient": "acc_CMaomTz4o0FOFz", "amount": 100, "currency": "INR", "amount_reversed": 0, "notes": [], "fees": 1, "tax": 0, "on_hold": false, "on_hold_until": null, "recipient_settlement_id": null, "created_at": 1579691505, "linked_account_notes": [], "processed_at": 1579691505 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch transfers for a settlement ```php $api->transfer->all(array('recipient_settlement_id'=> $recipientSettlementId)); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | recipientSettlementId* | string | The recipient settlement id obtained from the settlement.processed webhook payload. | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "trf_DGSTeXzBkEVh48", "entity": "transfer", "source": "pay_DGSRhvMbOqeCe7", "recipient": "acc_CMaomTz4o0FOFz", "amount": 500, "currency": "INR", "amount_reversed": 0, "notes": [], "fees": 2, "tax": 0, "on_hold": false, "on_hold_until": null, "recipient_settlement_id": "setl_DHYJ3dRPqQkAgV", "created_at": 1568110256, "linked_account_notes": [], "processed_at": null } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch settlement details ```php $api->transfer->all(array('expand[]'=> 'recipient_settlement')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | expand* | string | Supported value is `recipient_settlement` | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "trf_DGSTeXzBkEVh48", "entity": "transfer", "source": "pay_DGSRhvMbOqeCe7", "recipient": "acc_CMaomTz4o0FOFz", "amount": 500, "currency": "INR", "amount_reversed": 0, "notes": [], "fees": 2, "tax": 0, "on_hold": false, "on_hold_until": null, "recipient_settlement_id": "setl_DHYJ3dRPqQkAgV", "recipient_settlement": { "id": "setl_DHYJ3dRPqQkAgV", "entity": "settlement", "amount": 500, "status": "failed", "fees": 0, "tax": 0, "utr": "CN0038699836", "created_at": 1568349124 }, "created_at": 1568110256, "linked_account_notes": [], "processed_at": null } ] } ``` ------------------------------------------------------------------------------------------------------- ### Refund payments and reverse transfer from a linked account ```php $api->payment->fetch($paymentId)->refund(array('amount'=> '100','reverse_all'=>'1')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | paymentId* | string | The id of the payment to be fetched | | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | reverse_all | boolean | Reverses transfer made to a linked account. Possible values:<br> * `1` - Reverses transfer made to a linked account.<br>* `0` - Does not reverse transfer made to a linked account.| **Response:** ```json { "id": "rfnd_EAzovSwG8jBnGf", "entity": "refund", "amount": 100, "currency": "INR", "payment_id": "pay_EAdwQDe4JrhOFX", "notes": [], "receipt": null, "acquirer_data": { "rrn": null }, "created_at": 1580454723 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch payments of a linked account ```php $api->payment->all(array('X-Razorpay-Account'=> $linkedAccountId)); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | X-Razorpay-Account | string | The linked account id to fetch the payments received by linked account | **Response:** ```json { "entity": "collection", "count": 2, "items": [ { "id": "pay_E9uth3WhYbh9QV", "entity": "payment", "amount": 100, "currency": "INR", "status": "captured", "order_id": null, "invoice_id": null, "international": null, "method": "transfer", "amount_refunded": 0, "refund_status": null, "captured": true, "description": null, "card_id": null, "bank": null, "wallet": null, "vpa": null, "email": "", "contact": null, "notes": [], "fee": 0, "tax": 0, "error_code": null, "error_description": null, "created_at": 1580219046 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Reverse transfers from all linked accounts ```php $api->transfer->fetch($transferId)->reverse(array('amount'=>'100')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | transferId* | string | The id of the transfer to be fetched | | amount | integer | The amount to be captured (should be equal to the authorized amount, in paise) | **Response:** ```json { "id": "rvrsl_EB0BWgGDAu7tOz", "entity": "reversal", "transfer_id": "trf_EAznuJ9cDLnF7Y", "amount": 100, "fee": 0, "tax": 0, "currency": "INR", "notes": [], "initiator_id": "CJoeHMNpi0nC7k", "customer_refund_id": null, "created_at": 1580456007 } ``` ------------------------------------------------------------------------------------------------------- ### Hold settlements for transfers ```php $api->payment->fetch($paymentId)->transfer(array('account' => $accountId, 'amount' => 500, 'currency' => 'INR','on_hold'=>'1')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | paymentId* | string | The id of the payment to be fetched | | transfers | array | All parameters listed here https://razorpay.com/docs/api/route/#hold-settlements-for-transfers are supported | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "trf_EB1VJ4Ux4GMmxQ", "entity": "transfer", "source": "pay_EB1R2s8D4vOAKG", "recipient": "acc_CMaomTz4o0FOFz", "amount": 100, "currency": "INR", "amount_reversed": 0, "notes": [], "fees": 1, "tax": 0, "on_hold": true, "on_hold_until": null, "recipient_settlement_id": null, "created_at": 1580460652, "linked_account_notes": [], "processed_at": 1580460652 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Modify settlement hold for transfers ```php $api->transfer->fetch($paymentId)->edit(array('on_hold' => '1', 'on_hold_until' => '1679691505')); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | paymentId* | string | The id of the payment to be fetched | | transfers | array | All parameters listed here https://razorpay.com/docs/api/route/#hold-settlements-for-transfers are supported | **Response:** ```json { "id": "trf_EB17rqOUbzSCEE", "entity": "transfer", "source": "pay_EAeSM2Xul8xYRo", "recipient": "acc_CMaomTz4o0FOFz", "amount": 100, "currency": "INR", "amount_reversed": 0, "notes": [], "fees": 1, "tax": 0, "on_hold": true, "on_hold_until": 1679691505, "recipient_settlement_id": null, "created_at": 1580459321, "linked_account_notes": [], "processed_at": 1580459321 } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/route/#transfers/)** razorpay/documents/payment.md 0000666 00000031724 15165415146 0012436 0 ustar 00 ## Payments ### Capture payment ```php $api->payment->fetch($paymentId)->capture(array('amount'=>$amount,'currency' => 'INR')); ``` **Parameters:** | Name | Type | Description | |-----------|---------|--------------------------------------------------------------------------------| | paymentId* | string | Id of the payment to capture | | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | currency | string | The currency of the payment (defaults to INR) | **Response:** ```json { "id": "pay_G8VQzjPLoAvm6D", "entity": "payment", "amount": 1000, "currency": "INR", "status": "captured", "order_id": "order_G8VPOayFxWEU28", "invoice_id": null, "international": false, "method": "upi", "amount_refunded": 0, "refund_status": null, "captured": true, "description": "Purchase Shoes", "card_id": null, "bank": null, "wallet": null, "vpa": "gaurav.kumar@exampleupi", "email": "gaurav.kumar@example.com", "contact": "+919999999999", "customer_id": "cust_DitrYCFtCIokBO", "notes": [], "fee": 24, "tax": 4, "error_code": null, "error_description": null, "error_source": null, "error_step": null, "error_reason": null, "acquirer_data": { "rrn": "033814379298" }, "created_at": 1606985209 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch all payments ```php $api->payment->all($options) ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | from | timestamp | timestamp after which the payments were created | | to | timestamp | timestamp before which the payments were created | | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | **Response:** ```json { "entity": "collection", "count": 2, "items": [ { "id": "pay_G8VaL2Z68LRtDs", "entity": "payment", "amount": 900, "currency": "INR", "status": "captured", "order_id": "order_G8VXfKDWDEOHHd", "invoice_id": null, "international": false, "method": "netbanking", "amount_refunded": 0, "refund_status": null, "captured": true, "description": "Purchase Shoes", "card_id": null, "bank": "KKBK", "wallet": null, "vpa": null, "email": "gaurav.kumar@example.com", "contact": "+919999999999", "customer_id": "cust_DitrYCFtCIokBO", "notes": [], "fee": 22, "tax": 4, "error_code": null, "error_description": null, "error_source": null, "error_step": null, "error_reason": null, "acquirer_data": { "bank_transaction_id": "0125836177" }, "created_at": 1606985740 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch a payment ```php $api->payment->fetch($paymentId); ``` **Parameters:** | Name | Type | Description | |------------|--------|-----------------------------------| | paymentId* | string | Id of the payment to be retrieved | **Response:** ```json { "id": "pay_G8VQzjPLoAvm6D", "entity": "payment", "amount": 1000, "currency": "INR", "status": "captured", "order_id": "order_G8VPOayFxWEU28", "invoice_id": null, "international": false, "method": "upi", "amount_refunded": 0, "refund_status": null, "captured": true, "description": "Purchase Shoes", "card_id": null, "bank": null, "wallet": null, "vpa": "gaurav.kumar@exampleupi", "email": "gaurav.kumar@example.com", "contact": "+919999999999", "customer_id": "cust_DitrYCFtCIokBO", "notes": [], "fee": 24, "tax": 4, "error_code": null, "error_description": null, "error_source": null, "error_step": null, "error_reason": null, "acquirer_data": { "rrn": "033814379298" }, "created_at": 1606985209 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch payments for an order ```php $api->order->fetch($orderId)->payments(); ``` **Parameters** | Name | Type | Description | |----------|--------|-------------------------------------| | orderId* | string | The id of the order to be retrieve payment info | **Response:** ```json { "count": 1, "entity": "collection", "items": [ { "id": "pay_DovGQXOkPBJjjU", "entity": "payment", "amount": 600, "currency": "INR", "status": "captured", "order_id": "order_DovFx48wjYEr2I", "method": "netbanking", "amount_refunded": 0, "refund_status": null, "captured": true, "description": "A Wild Sheep Chase is a novel by Japanese author Haruki Murakami", "card_id": null, "bank": "SBIN", "wallet": null, "vpa": null, "email": "gaurav.kumar@example.com", "contact": "9364591752", "fee": 70, "tax": 10, "error_code": null, "error_description": null, "error_source": null, "error_step": null, "error_reason": null, "notes": [], "acquirer_data": { "bank_transaction_id": "0125836177" }, "created_at": 1400826750 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Update a payment ```php $api->payment->fetch($paymentId)->edit(array('notes'=> array('key_1'=> 'value1','key_2'=> 'value2'))); ``` **Parameters:** | Name | Type | Description | |-------------|---------|--------------------------------------| | paymentId* | string | Id of the payment to update | | notes* | array | A key-value pair | **Response:** ```json { "id": "pay_CBYy6tLmJTzn3Q", "entity": "payment", "amount": 1000, "currency": "INR", "status": "authorized", "order_id": null, "invoice_id": null, "international": false, "method": "netbanking", "amount_refunded": 0, "refund_status": null, "captured": false, "description": null, "card_id": null, "bank": "UTIB", "wallet": null, "vpa": null, "email": "testme@acme.com", "notes": { "key1": "value1", "key2": "value2" }, "fee": null, "tax": null, "error_code": null, "error_description": null, "error_source": null, "error_step": null, "error_reason": null, "acquirer_data": { "bank_transaction_id": "0125836177" }, "created_at": 1553504328 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch expanded card or emi details for payments Request #1: Card ```php $api->payment->all(array('expand[]'=>'card') ``` Request #2: EMI ```php $api->payment->all(array('expand[]'=>'emi') ``` **Response:**<br> For expanded card or emi details for payments response please click [here](https://razorpay.com/docs/api/payments/#fetch-expanded-card-or-emi-details-for-payments) ------------------------------------------------------------------------------------------------------- ### Fetch card details with paymentId ```php $api->payment->fetch($paymentId)->fetchCardDetails(); ``` **Parameters:** | Name | Type | Description | |-------------|---------|--------------------------------------| | paymentId* | string | Id of the payment to update | **Response:** ```json { "id": "card_6krZ6bcjoeqyV9", "entity": "card", "name": "Gaurav", "last4": "3335", "network": "Visa", "type": "debit", "issuer": "SBIN", "international": false, "emi": null, "sub_type": "business" } ``` ------------------------------------------------------------------------------------------------------- ### Fetch Payment Downtime Details ```php $api->payment->fetchPaymentDowntime(); ``` **Response:** <br> For payment downtime response please click [here](https://razorpay.com/docs/api/payments/downtime/#fetch-payment-downtime-details) ------------------------------------------------------------------------------------------------------- ### Fetch Payment Downtime ```php $api->payment->fetchPaymentDowntimeById($downtimeId); ``` **Parameters:** | Name | Type | Description | |-------------|---------|--------------------------------------| | downtimeId* | string | Id to fetch payment downtime | **Response:** <br> For payment downtime by id response please click [here](https://razorpay.com/docs/api/payments/downtime/#fetch-payment-downtime-details-by-id) ------------------------------------------------------------------------------------------------------- ### Payment capture settings API ```php $api->order->create(array('amount' => 50000,'currency' => 'INR','receipt' => 'rcptid_11','payment' => array('capture' => 'automatic','capture_options' => array('automatic_expiry_period' => 12,'manual_expiry_period' => 7200,'refund_speed' => 'optimum')))); ``` **Parameters:** | Name | Type | Description | |-------------|---------|--------------------------------------| | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | | payment | array | please refer this [doc](https://razorpay.com/docs/payments/payments/capture-settings/api/) for params | **Response:** <br> ```json { "id": "order_DBJOWzybf0sJbb", "entity": "order", "amount": 50000, "amount_paid": 0, "amount_due": 50000, "currency": "INR", "receipt": "rcptid_11", "status": "created", "attempts": 0, "notes": [], "created_at": 1566986570 } ``` ------------------------------------------------------------------------------------------------------- ### Create Payment Json ```php $api->payment->createPaymentJson(array('amount' => 100,'currency' => 'INR','email' => 'gaurav.kumar@example.com','contact' => '9123456789','order_id' => 'order_I6LVPRQ6upW3uh','method' => 'card','card' => array('number' => '4854980604708430','cvv' => '123','expiry_month' => '12','expiry_year' => '21','name' => 'Gaurav Kumar'))); ``` **Parameters:** please refer this [doc](https://razorpay.com/docs/payment-gateway/s2s-integration/payment-methods/) for params **Response:** <br> ```json { "razorpay_payment_id": "pay_FVmAstJWfsD3SO", "next": [ { "action": "redirect", "url": "https://api.razorpay.com/v1/payments/FVmAtLUe9XZSGM/authorize" }, { "action": "otp_generate", "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_generate?track_id=FVmAtLUe9XZSGM&key_id=<YOUR_KEY_ID>" } ] } ``` ------------------------------------------------------------------------------------------------------- ### OTP Generate ```php $api->payment->fetch($paymentId)->otpGenerate(); ``` **Parameters:** | Name | Type | Description | |-------------|---------|--------------------------------------| | paymentId* | integer | Unique identifier of the payment | **Response:** <br> ```json { "razorpay_payment_id": "pay_FVmAstJWfsD3SO", "next": [ { "action": "otp_submit", "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_submit/ac2d415a8be7595de09a24b41661729fd9028fdc?key_id=<YOUR_KEY_ID>" }, { "action": "otp_resend", "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_resend/json?key_id=<YOUR_KEY_ID>" } ], "metadata": { "issuer": "HDFC", "network": "MC", "last4": "1111", "iin": "411111" } } ``` ------------------------------------------------------------------------------------------------------- ### OTP Submit ```php $api->payment->fetch($paymentId)->otpSubmit(array('otp'=> '12345')); ``` **Parameters:** | Name | Type | Description | |-------------|---------|--------------------------------------| | paymentId* | integer | Unique identifier of the payment | **Response:** <br> Success ```json { "razorpay_payment_id": "pay_D5jmY2H6vC7Cy3", "razorpay_order_id": "order_9A33XWu170gUtm", "razorpay_signature": "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" } ``` Failure ```json { "error": { "code" : "BAD_REQUEST_ERROR", "description": "payment processing failed because of incorrect otp" }, "next": ["otp_submit", "otp_resend"] } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/payments/)** razorpay/documents/settlement.md 0000666 00000030464 15165415146 0013145 0 ustar 00 ## Settlements ### Fetch all settlements ```php $api->settlement->all($options); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | from | timestamp | timestamp after which the settlement were created | | to | timestamp | timestamp before which the settlement were created | | count | integer | number of settlements to fetch (default: 10) | | skip | integer | number of settlements to be skipped (default: 0) | **Response:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "setl_DGlQ1Rj8os78Ec", "entity": "settlement", "amount": 9973635, "status": "processed", "fees": 471699, "tax": 42070, "utr": "1568176960vxp0rj", "created_at": 1568176960 } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch a settlement ```php $api->settlement->fetch($settlementId); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | $settlementId* | string | The id of the settlement to be fetched | **Response:** ```json { "id": "setl_DGlQ1Rj8os78Ec", "entity": "settlement", "amount": 9973635, "status": "processed", "fees": 471699, "tax": 42070, "utr": "1568176960vxp0rj", "created_at": 1568176960 } ``` ------------------------------------------------------------------------------------------------------- ### Settlement report for a month ```php $api->settlement->reports(array("year"=>2020,"month"=>09)); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | year* | integer | The year the settlement was received in the `YYYY` format. For example, `2020` | | month* | integer | The month the settlement was received in the `MM` format. For example, `09` | | day | integer | The date the settlement was received in the `DD` format. For example, `01` | | count | integer | number of settlements to fetch (default: 10) | | skip | integer | number of settlements to be skipped (default: 0) | **Response:** ```json { "entity": "collection", "count": 4, "items": [ { "entity_id": "pay_DEXrnipqTmWVGE", "type": "payment", "debit": 0, "credit": 97100, "amount": 100000, "currency": "INR", "fee": 2900, "tax": 0, "on_hold": false, "settled": true, "created_at": 1567692556, "settled_at": 1568176960, "settlement_id": "setl_DGlQ1Rj8os78Ec", "posted_at": null, "credit_type": "default", "description": "Recurring Payment via Subscription", "notes": "{}", "payment_id": null, "settlement_utr": "1568176960vxp0rj", "order_id": "order_DEXrnRiR3SNDHA", "order_receipt": null, "method": "card", "card_network": "MasterCard", "card_issuer": "KARB", "card_type": "credit", "dispute_id": null }, { "entity_id": "rfnd_DGRcGzZSLyEdg1", "type": "refund", "debit": 242500, "credit": 0, "amount": 242500, "currency": "INR", "fee": 0, "tax": 0, "on_hold": false, "settled": true, "created_at": 1568107224, "settled_at": 1568176960, "settlement_id": "setl_DGlQ1Rj8os78Ec", "posted_at": null, "credit_type": "default", "description": null, "notes": "{}", "payment_id": "pay_DEXq1pACSqFxtS", "settlement_utr": "1568176960vxp0rj", "order_id": "order_DEXpmZgffXNvuI", "order_receipt": null, "method": "card", "card_network": "MasterCard", "card_issuer": "KARB", "card_type": "credit", "dispute_id": null }, { "entity_id": "trf_DEUoCEtdsJgvl7", "type": "transfer", "debit": 100296, "credit": 0, "amount": 100000, "currency": "INR", "fee": 296, "tax": 46, "on_hold": false, "settled": true, "created_at": 1567681786, "settled_at": 1568176960, "settlement_id": "setl_DGlQ1Rj8os78Ec", "posted_at": null, "credit_type": "default", "description": null, "notes": null, "payment_id": "pay_DEApNNTR6xmqJy", "settlement_utr": "1568176960vxp0rj", "order_id": null, "order_receipt": null, "method": null, "card_network": null, "card_issuer": null, "card_type": null, "dispute_id": null }, { "entity_id": "adj_EhcHONhX4ChgNC", "type": "adjustment", "debit": 0, "credit": 1012, "amount": 1012, "currency": "INR", "fee": 0, "tax": 0, "on_hold": false, "settled": true, "created_at": 1567681786, "settled_at": 1568176960, "settlement_id": "setl_DGlQ1Rj8os78Ec", "posted_at": null, "description": "test reason", "notes": null, "payment_id": null, "settlement_utr": null, "order_id": null, "order_receipt": null, "method": null, "card_network": null, "card_issuer": null, "card_type": null, "dispute_id": null } ] } ``` ------------------------------------------------------------------------------------------------------- ### Settlement recon ```php $api->settlement->settlementRecon(array('year' => 2018, 'month' => 2, 'day'=>11)); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | year* | integer | The year the settlement was received in the `YYYY` format. For example, `2020` | | month* | integer | The month the settlement was received in the `MM` format. For example, `09` | | day | integer | The day the settlement was received in the `DD` format. For example, | **Response:** ```json { "entity": "collection", "count": 4, "items": [ { "entity_id": "pay_DEXrnipqTmWVGE", "type": "payment", "debit": 0, "credit": 97100, "amount": 100000, "currency": "INR", "fee": 2900, "tax": 0, "on_hold": false, "settled": true, "created_at": 1567692556, "settled_at": 1568176960, "settlement_id": "setl_DGlQ1Rj8os78Ec", "posted_at": null, "credit_type": "default", "description": "Recurring Payment via Subscription", "notes": "{}", "payment_id": null, "settlement_utr": "1568176960vxp0rj", "order_id": "order_DEXrnRiR3SNDHA", "order_receipt": null, "method": "card", "card_network": "MasterCard", "card_issuer": "KARB", "card_type": "credit", "dispute_id": null }, { "entity_id": "rfnd_DGRcGzZSLyEdg1", "type": "refund", "debit": 242500, "credit": 0, "amount": 242500, "currency": "INR", "fee": 0, "tax": 0, "on_hold": false, "settled": true, "created_at": 1568107224, "settled_at": 1568176960, "settlement_id": "setl_DGlQ1Rj8os78Ec", "posted_at": null, "credit_type": "default", "description": null, "notes": "{}", "payment_id": "pay_DEXq1pACSqFxtS", "settlement_utr": "1568176960vxp0rj", "order_id": "order_DEXpmZgffXNvuI", "order_receipt": null, "method": "card", "card_network": "MasterCard", "card_issuer": "KARB", "card_type": "credit", "dispute_id": null }, { "entity_id": "trf_DEUoCEtdsJgvl7", "type": "transfer", "debit": 100296, "credit": 0, "amount": 100000, "currency": "INR", "fee": 296, "tax": 46, "on_hold": false, "settled": true, "created_at": 1567681786, "settled_at": 1568176960, "settlement_id": "setl_DGlQ1Rj8os78Ec", "posted_at": null, "credit_type": "default", "description": null, "notes": null, "payment_id": "pay_DEApNNTR6xmqJy", "settlement_utr": "1568176960vxp0rj", "order_id": null, "order_receipt": null, "method": null, "card_network": null, "card_issuer": null, "card_type": null, "dispute_id": null }, { "entity_id": "adj_EhcHONhX4ChgNC", "type": "adjustment", "debit": 0, "credit": 1012, "amount": 1012, "currency": "INR", "fee": 0, "tax": 0, "on_hold": false, "settled": true, "created_at": 1567681786, "settled_at": 1568176960, "settlement_id": "setl_DGlQ1Rj8os78Ec", "posted_at": null, "description": "test reason", "notes": null, "payment_id": null, "settlement_utr": null, "order_id": null, "order_receipt": null, "method": null, "card_network": null, "card_issuer": null, "card_type": null, "dispute_id": null } ] } ``` ------------------------------------------------------------------------------------------------------- ### Create on-demand settlement ```php $api->settlement->createOndemandSettlement(array("amount"=> 1221, "settle_full_balance"=> false, "description"=>"Testing","notes" => array("notes_key_1"=> "Tea, Earl Grey, Hot","notes_key_2"=> "Tea, Earl Grey… decaf."))); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | amount*| integer | Maximum amount that can be settled | | settle_full_balance* | boolean | true or false | | description | string | The description may not be greater than 30 characters | | notes | array | A key-value pair | **Response:** ```json { "id": "setlod_FNj7g2YS5J67Rz", "entity": "settlement.ondemand", "amount_requested": 200000, "amount_settled": 0, "amount_pending": 199410, "amount_reversed": 0, "fees": 590, "tax": 90, "currency": "INR", "settle_full_balance": false, "status": "initiated", "description": "Need this to make vendor payments.", "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "created_at": 1596771429, "ondemand_payouts": { "entity": "collection", "count": 1, "items": [ { "id": "setlodp_FNj7g2cbvw8ueO", "entity": "settlement.ondemand_payout", "initiated_at": null, "processed_at": null, "reversed_at": null, "amount": 200000, "amount_settled": null, "fees": 590, "tax": 90, "utr": null, "status": "created", "created_at": 1596771429 } ] } } ``` ------------------------------------------------------------------------------------------------------- ### Fetch all on-demand settlements ```php $api->settlement->fetchAllOndemandSettlement($options); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | from | timestamp | timestamp after which the payments were created | | to | timestamp | timestamp before which the payments were created | | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | **Response:**<br> For all on-demand settlements response please click [here](https://razorpay.com/docs/api/settlements/#fetch-all-on-demand-settlements) ------------------------------------------------------------------------------------------------------- ### Fetch on-demand settlement by ID ```php $api->settlement->fetch($settlementId)->fetchOndemandSettlementById(); ``` **Parameters:** | Name | Type | Description | |------------|--------|-----------------------------------| | $settlementId* | string | Settlement Id of the On-demand settlement| **Response:**<br> For on-demand settlement by ID response please click [here](https://razorpay.com/docs/api/settlements/#fetch-on-demand-settlements-by-id) ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/settlements/)** razorpay/documents/refund.md 0000666 00000017520 15165415146 0012242 0 ustar 00 ## Refunds ### Create a normal refund ```php $api->payment->fetch($paymentId)->refund(array("amount"=> "100", "speed"=>"normal", "notes"=>array("notes_key_1"=>"Beam me up Scotty.", "notes_key_2"=>"Engage"), "receipt"=>"Receipt No. 31")); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | paymentId* | string | The id of the payment | | amount | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | | speed | string | Here, it must be normal | | notes | array | A key-value pair | | receipt | string | A unique identifier provided by you for your internal reference. | **Response:** ```json { "id": "rfnd_FP8QHiV938haTz", "entity": "refund", "amount": 500100, "receipt": "Receipt No. 31", "currency": "INR", "payment_id": "pay_FCXKPFtYfPXJPy", "notes": [], "acquirer_data": { "arn": null }, "created_at": 1597078866, "batch_id": null, "status": "processed", "speed_processed": "normal" } ``` ------------------------------------------------------------------------------------------------------- ### Create an instant refund ```php $api->payment->fetch($paymentId)->refund(array("amount"=> "100","speed"=>"optimum","receipt"=>"Receipt No. 31")); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | paymentId* | string | The id of the payment | | amount | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | speed* | string | Here, it must be optimum | | receipt | string | A unique identifier provided by you for your internal reference. | **Response:** ```json { "id": "rfnd_FP8R8EGjGbPkVb", "entity": "refund", "amount": 500100, "currency": "INR", "payment_id": "pay_FC8MmhMBZPKDHF", "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "receipt": "Receipt No. 31", "acquirer_data": { "arn": null }, "created_at": 1597078914, "batch_id": null, "status": "processed", "speed_requested": "optimum" } ``` ------------------------------------------------------------------------------------------------------- ### Fetch multiple refunds for a payment ```php $api->payment->fetch($paymentId)->fetchMultipleRefund($option); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | paymentId* | string | The id of the payment | | from | timestamp | timestamp after which the payments were created | | to | timestamp | timestamp before which the payments were created | | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | **Refund:** ```json { "entity": "collection", "count": 1, "items": [ { "id": "rfnd_FP8DDKxqJif6ca", "entity": "refund", "amount": 300100, "currency": "INR", "payment_id": "pay_FIKOnlyii5QGNx", "notes": { "comment": "Comment for refund" }, "receipt": null, "acquirer_data": { "arn": "10000000000000" }, "created_at": 1597078124, "batch_id": null, "status": "processed", "speed_processed": "normal", "speed_requested": "optimum" } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch a specific refund for a payment ```php $api->payment->fetch($paymentId)->fetchRefund($refundId); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | paymentId* | string | The id of the payment to be fetched | | refundId* | string | The id of the refund to be fetched | **Response:** ```json { "id": "rfnd_FP8DDKxqJif6ca", "entity": "refund", "amount": 300100, "currency": "INR", "payment_id": "pay_FIKOnlyii5QGNx", "notes": { "comment": "Comment for refund" }, "receipt": null, "acquirer_data": { "arn": "10000000000000" }, "created_at": 1597078124, "batch_id": null, "status": "processed", "speed_processed": "normal", "speed_requested": "optimum" } ``` ------------------------------------------------------------------------------------------------------- ### Fetch all refunds ```php $api->refund->all($options); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | from | timestamp | timestamp after which the payments were created | | to | timestamp | timestamp before which the payments were created | | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | **Response:** ```json { "entity": "collection", "count": 2, "items": [ { "id": "rfnd_FFX6AnnIN3puqW", "entity": "refund", "amount": 88800, "currency": "INR", "payment_id": "pay_FFX5FdEYx8jPwA", "notes": { "comment": "Issuing an instant refund" }, "receipt": null, "acquirer_data": {}, "created_at": 1594982363, "batch_id": null, "status": "processed", "speed_processed": "optimum", "speed_requested": "optimum" } ] } ``` ------------------------------------------------------------------------------------------------------- ### Fetch particular refund ```php $api->refund->fetch($refundId); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | refundId* | string | The id of the refund to be fetched | **Response:** ```json { "id": "rfnd_EqWThTE7dd7utf", "entity": "refund", "amount": 6000, "currency": "INR", "payment_id": "pay_EpkFDYRirena0f", "notes": { "comment": "Issuing an instant refund" }, "receipt": null, "acquirer_data": { "arn": "10000000000000" }, "created_at": 1589521675, "batch_id": null, "status": "processed", "speed_processed": "optimum", "speed_requested": "optimum" } ``` ------------------------------------------------------------------------------------------------------- ### Update the refund ```php $api->refund->fetch($refundId)->edit(array('notes'=> array('notes_key_1'=>'Beam me up Scotty.', 'notes_key_2'=>'Engage'))); ``` **Parameters:** | Name | Type | Description | |-------|-----------|--------------------------------------------------| | refundId* | string | The id of the refund to be fetched | | notes* | array | A key-value pair | **Response:** ```json { "id": "rfnd_FP8DDKxqJif6ca", "entity": "refund", "amount": 300100, "currency": "INR", "payment_id": "pay_FIKOnlyii5QGNx", "notes": { "notes_key_1": "Beam me up Scotty.", "notes_key_2": "Engage" }, "receipt": null, "acquirer_data": { "arn": "10000000000000" }, "created_at": 1597078124, "batch_id": null, "status": "processed", "speed_processed": "normal", "speed_requested": "optimum" } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/api/refunds/)** razorpay/documents/fund.md 0000666 00000003744 15165415146 0011716 0 ustar 00 ## Funds ### Create a fund account ```php $api->fundAccount->create(array('customer_id'=>$customerId,'account_type'=>'bank_account','bank_account'=>array('name'=>'Gaurav Kumar', 'account_number'=>'11214311215411', 'ifsc'=>'HDFC0000053'))) ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | customerId* | string | The id of the customer to be fetched | | account_type* | string | The bank_account to be linked to the customer ID | | bank_account* | array | A key-value pair | **Response:** ```json { "id":"fa_Aa00000000001", "entity":"fund_account", "customer_id":"cust_Aa000000000001", "account_type":"bank_account", "bank_account":{ "name":"Gaurav Kumar", "account_number":"11214311215411", "ifsc":"HDFC0000053", "bank_name":"HDFC Bank" }, "active":true, "created_at":1543650891 } ``` ------------------------------------------------------------------------------------------------------- ### Fetch all fund accounts ```php $api->fundAccount->all(array('customer_id'=>$customerIds)); ``` **Parameters:** | Name | Type | Description | |---------------|-------------|---------------------------------------------| | customerId* | string | The id of the customer to be fetched | **Response:** ```json { "id":"fa_Aa00000000001", "entity":"fund_account", "customer_id":"cust_Aa000000000001", "account_type":"bank_account", "bank_account":{ "name":"Gaurav Kumar", "account_number":"11214311215411", "ifsc":"HDFC0000053", "bank_name":"HDFC Bank" }, "active":true, "created_at":1543650891 } ``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** <br> <br> **For reference click [here](https://razorpay.com/docs/payments/customers/customer-fund-account-api/)** razorpay/composer.json 0000666 00000002072 15165415146 0011152 0 ustar 00 { "name": "razorpay/razorpay", "description": "Razorpay PHP Client Library", "keywords": ["razorpay", "api", "php", "client"], "authors": [ { "name": "Abhay Rana", "email": "nemo@razorpay.com", "homepage": "https://captnemo.in", "role": "Developer" }, { "name": "Shashank Kumar", "email": "shashank@razorpay.com", "role": "Developer" } ], "support": { "email": "contact@razorpay.com", "issues": "https://github.com/Razorpay/razorpay-php/issues", "source": "https://github.com/Razorpay/razorpay-php" }, "homepage": "https://docs.razorpay.com", "license": "MIT", "require": { "php": ">=5.3.0", "rmccue/requests": "v1.8.0", "ext-json": "*" }, "require-dev": { "raveren/kint": "1.*", "phpunit/phpunit": "~4.8|~5.0" }, "autoload": { "psr-4": { "Razorpay\\Api\\": "src/", "Razorpay\\Tests\\": "tests/" } } } razorpay/.editorconfig 0000666 00000000375 15165415146 0011111 0 ustar 00 # This file is for unifying the coding style for different editors and IDEs # editorconfig.org root = true [*] end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [**.php] indent_style = space indent_size = 4 razorpay/LICENSE 0000666 00000002027 15165415146 0007435 0 ustar 00 Copyright 2019 Razorpay Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. razorpay/src/Webhook.php 0000666 00000001327 15165415146 0011330 0 ustar 00 <?php namespace Razorpay\Api; use Requests; class Webhook extends Entity { /** * @param $id webhook id description */ public function create($attributes = array()) { return parent::create($attributes); } public function fetch($id) { return parent::fetch($id); } public function all($options = array()) { return parent::all($options); } /** * Patches given webhook with new attributes * * @param array $attributes * * @return Webhooks */ public function edit($attributes = array(), $id) { $url = $this->getEntityUrl() . $id; return $this->request(Requests::PUT, $url, $attributes); } } razorpay/src/Api.php 0000666 00000003160 15165415146 0010440 0 ustar 00 <?php namespace Razorpay\Api; class Api { protected static $baseUrl = 'https://api.razorpay.com/v1/'; protected static $key = null; protected static $secret = null; /* * App info is to store the Plugin/integration * information */ public static $appsDetails = array(); const VERSION = '2.8.1'; /** * @param string $key * @param string $secret */ public function __construct($key, $secret) { self::$key = $key; self::$secret = $secret; } /* * Set Headers */ public function setHeader($header, $value) { Request::addHeader($header, $value); } public function setAppDetails($title, $version = null) { $app = array( 'title' => $title, 'version' => $version ); array_push(self::$appsDetails, $app); } public function getAppsDetails() { return self::$appsDetails; } public function setBaseUrl($baseUrl) { self::$baseUrl = $baseUrl; } /** * @param string $name * @return mixed */ public function __get($name) { $className = __NAMESPACE__.'\\'.ucwords($name); $entity = new $className(); return $entity; } public static function getBaseUrl() { return self::$baseUrl; } public static function getKey() { return self::$key; } public static function getSecret() { return self::$secret; } public static function getFullUrl($relativeUrl) { return self::getBaseUrl() . $relativeUrl; } } razorpay/src/Addon.php 0000666 00000001054 15165415146 0010754 0 ustar 00 <?php namespace Razorpay\Api; class Addon extends Entity { // To create an Addon, // use the createAddon method of the Subscription class public function fetch($id) { return parent::fetch($id); } public function delete() { $entityUrl = $this->getEntityUrl(); return $this->request('DELETE', $entityUrl . $this->id); } public function fetchAll($attributes = array()) { $entityUrl = $this->getEntityUrl(); return $this->request('GET', $entityUrl , $attributes); } } razorpay/src/Customer.php 0000666 00000001321 15165415146 0011525 0 ustar 00 <?php namespace Razorpay\Api; class Customer extends Entity { /** * @param $id Customer id description */ public function fetch($id) { return parent::fetch($id); } public function all($options = array()) { return parent::all($options); } public function create($attributes = array()) { return parent::create($attributes); } public function edit($attributes = null) { $entityUrl = $this->getEntityUrl().$this->id; return $this->request('PUT', $entityUrl, $attributes); } public function tokens() { $token = new Token(); $token['customer_id'] = $this->id; return $token; } } razorpay/src/PaymentPage.php 0000666 00000001106 15165415146 0012137 0 ustar 00 <?php namespace Razorpay\Api; class PaymentPage extends Entity { public function fetch($id) { return parent::fetch($id); } public function all($options = array()) { return parent::all($options); } public function activate($id) { $relativeUrl = $this->getEntityUrl() . $id . '/activate'; return $this->request('PATCH', $relativeUrl); } public function deactivate($id) { $relativeUrl = $this->getEntityUrl() . $id . '/deactivate'; return $this->request('PATCH', $relativeUrl); } } razorpay/src/Collection.php 0000666 00000000460 15165415146 0012022 0 ustar 00 <?php namespace Razorpay\Api; use Countable; class Collection extends Entity implements Countable { public function count() { $count = 0; if (isset($this->attributes['count'])) { return $this->attributes['count']; } return $count; } } razorpay/src/Transfer.php 0000666 00000002642 15165415146 0011517 0 ustar 00 <?php namespace Razorpay\Api; class Transfer extends Entity { /** * @param $id Transfer ID */ public function fetch($id) { return parent::fetch($id); } public function all($options = array()) { if (isset($this->payment_id) === true) { $relativeUrl = 'payments/' . $this->payment_id. '/transfers'; return $this->request('GET', $relativeUrl, $options); } return parent::all($options); } /** * Create a direct transfer from merchant's account to * any of the linked accounts, without linking it to a * payment */ public function create($attributes = array()) { return parent::create($attributes); } public function edit($attributes = null) { $entityUrl = $this->getEntityUrl() . $this->id; return $this->request('PATCH', $entityUrl, $attributes); } /** * Create a reversal for a transfer */ public function reverse($attributes = array()) { $relativeUrl = $this->getEntityUrl() . $this->id . '/reversals'; return $this->request('POST', $relativeUrl, $attributes); } /** * Fetches all reversals */ public function reversals($attributes = array()) { $relativeUrl = $this->getEntityUrl() . $this->id . '/reversals'; return $this->request('GET', $relativeUrl, $attributes); } } razorpay/src/ArrayableInterface.php 0000666 00000000261 15165415146 0013451 0 ustar 00 <?php namespace Razorpay\Api; interface ArrayableInterface { /** * Get the instance as an array. * * @return array */ public function toArray(); } razorpay/src/Subscription.php 0000666 00000004306 15165415146 0012416 0 ustar 00 <?php namespace Razorpay\Api; class Subscription extends Entity { public function create($attributes = array()) { return parent::create($attributes); } public function fetch($id) { return parent::fetch($id); } public function all($options = array()) { return parent::all($options); } public function cancel($attributes = array()) { $relativeUrl = $this->getEntityUrl() . $this->id . '/cancel'; return $this->request('POST', $relativeUrl, $attributes); } public function createAddon($attributes = array()) { $relativeUrl = $this->getEntityUrl() . $this->id . '/addons'; return $this->request('POST', $relativeUrl, $attributes); } /** * Create a Registration Link * @param array $attributes * @return array */ public function createSubscriptionRegistration($attributes = array()) { $relativeUrl = 'subscription_registration/auth_links'; return $this->request('POST', $relativeUrl, $attributes); } public function update($attributes = array()) { $relativeUrl = $this->getEntityUrl() . $this->id; return $this->request('PATCH', $relativeUrl, $attributes); } public function pendingUpdate() { $relativeUrl = $this->getEntityUrl() . $this->id . '/retrieve_scheduled_changes'; return $this->request('GET', $relativeUrl, null); } public function cancelScheduledChanges() { $relativeUrl = $this->getEntityUrl() . $this->id . '/cancel_scheduled_changes'; return $this->request('POST', $relativeUrl, null); } public function pause($attributes = array()) { $relativeUrl = $this->getEntityUrl() . $this->id.'/pause'; return $this->request('POST', $relativeUrl, $attributes); } public function resume($attributes = array()) { $relativeUrl = $this->getEntityUrl() . $this->id.'/resume'; return $this->request('POST', $relativeUrl, $attributes); } public function deleteOffer($offerId) { $relativeUrl = $this->getEntityUrl() . $this->id.'/'.$offerId; return $this->request('DELETE', $relativeUrl); } } razorpay/src/Request.php 0000666 00000013650 15165415146 0011364 0 ustar 00 <?php namespace Razorpay\Api; use Requests; use Exception; use Requests_Hooks; use Razorpay\Api\Errors; use Razorpay\Api\Errors\ErrorCode; // Available since PHP 5.5.19 and 5.6.3 // https://git.io/fAMVS | https://secure.php.net/manual/en/curl.constants.php if (defined('CURL_SSLVERSION_TLSv1_1') === false) { define('CURL_SSLVERSION_TLSv1_1', 5); } /** * Request class to communicate to the request libarary */ class Request { /** * Headers to be sent with every http request to the API * @var array */ protected static $headers = array( 'Razorpay-API' => 1 ); /** * Fires a request to the API * @param string $method HTTP Verb * @param string $url Relative URL for the request * @param array $data Data to be passed along the request * @param array $additionHeader headers to be passed along the request * @return array Response data in array format. Not meant * to be used directly */ public function request($method, $url, $data = array()) { $url = Api::getFullUrl($url); $hooks = new Requests_Hooks(); $hooks->register('curl.before_send', array($this, 'setCurlSslOpts')); $options = array( 'auth' => array(Api::getKey(), Api::getSecret()), 'hook' => $hooks, 'timeout' => 60 ); $headers = $this->getRequestHeaders(); $response = Requests::request($url, $headers, $data, $method, $options); $this->checkErrors($response); return json_decode($response->body, true); } public function setCurlSslOpts($curl) { curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_1); } /** * Adds an additional header to all API requests * @param string $key Header key * @param string $value Header value * @return null */ public static function addHeader($key, $value) { self::$headers[$key] = $value; } /** * Returns all headers attached so far * @return array headers */ public static function getHeaders() { return self::$headers; } /** * Process the statusCode of the response and throw exception if necessary * @param Object $response The response object returned by Requests */ protected function checkErrors($response) { $body = $response->body; $httpStatusCode = $response->status_code; try { $body = json_decode($response->body, true); } catch (Exception $e) { $this->throwServerError($body, $httpStatusCode); } if (($httpStatusCode < 200) or ($httpStatusCode >= 300)) { $this->processError($body, $httpStatusCode, $response); } } protected function processError($body, $httpStatusCode, $response) { $this->verifyErrorFormat($body, $httpStatusCode); $code = $body['error']['code']; // We are basically converting the error code to the Error class name // Replace underscores with space // Lowercase the words, capitalize first letter of each word // Remove spaces $error = str_replace('_', ' ', $code); $error = ucwords(strtolower($error)); $error = str_replace(' ', '', $error); // Add namespace // This is the fully qualified error class name $error = __NAMESPACE__.'\Errors\\' . $error; $description = $body['error']['description']; $field = null; if (isset($body['error']['field'])) { $field = $body['error']['field']; // Create an instance of the error and then throw it throw new $error($description, $code, $httpStatusCode, $field); } throw new $error($description, $code, $httpStatusCode); } protected function throwServerError($body, $httpStatusCode) { $description = "The server did not send back a well-formed response. " . PHP_EOL . "Server Response: $body"; throw new Errors\ServerError( $description, ErrorCode::SERVER_ERROR, $httpStatusCode); } protected function getRequestHeaders() { $uaHeader = array( 'User-Agent' => $this->constructUa() ); $headers = array_merge(self::$headers, $uaHeader); return $headers; } protected function constructUa() { $ua = 'Razorpay/v1 PHPSDK/' . Api::VERSION . ' PHP/' . phpversion(); $ua .= ' ' . $this->getAppDetailsUa(); return $ua; } protected function getAppDetailsUa() { $appsDetails = Api::$appsDetails; $appsDetailsUa = ''; foreach ($appsDetails as $app) { if ((isset($app['title'])) and (is_string($app['title']))) { $appUa = $app['title']; if ((isset($app['version'])) and (is_scalar($app['version']))) { $appUa .= '/' . $app['version']; } $appsDetailsUa .= $appUa . ' '; } } return $appsDetailsUa; } /** * Verifies error is in proper format. If not then * throws ServerErrorException * * @param array $body * @param int $httpStatusCode * @return void */ protected function verifyErrorFormat($body, $httpStatusCode) { if (is_array($body) === false) { $this->throwServerError($body, $httpStatusCode); } if ((isset($body['error']) === false) or (isset($body['error']['code']) === false)) { $this->throwServerError($body, $httpStatusCode); } $code = $body['error']['code']; if (Errors\ErrorCode::exists($code) === false) { $this->throwServerError($body, $httpStatusCode); } } } razorpay/src/VirtualAccount.php 0000666 00000002523 15165415146 0012674 0 ustar 00 <?php namespace Razorpay\Api; class VirtualAccount extends Entity { public function create($attributes = array()) { return parent::create($attributes); } public function fetch($id) { return parent::fetch($id); } public function all($options = array()) { return parent::all($options); } public function close() { $relativeUrl = $this->getEntityUrl() . $this->id . '/close'; return $this->request('POST', $relativeUrl); } public function payments($options = array()) { $relativeUrl = $this->getEntityUrl() . $this->id . '/payments'; return $this->request('GET', $relativeUrl, $options); } public function addReceiver($attributes = array()) { $relativeUrl = $this->getEntityUrl() . $this->id . '/receivers'; return $this->request('POST', $relativeUrl, $attributes); } public function addAllowedPayer($attributes = array()) { $relativeUrl = $this->getEntityUrl() . $this->id . '/allowed_payers'; return $this->request('POST', $relativeUrl, $attributes); } public function deleteAllowedPayer($allowedPlayerId) { $relativeUrl = $this->getEntityUrl() . $this->id . '/allowed_payers/'.$allowedPlayerId; return $this->request('DELETE', $relativeUrl); } } razorpay/src/QrCode.php 0000666 00000002735 15165415146 0011113 0 ustar 00 <?php namespace Razorpay\Api; class QrCode extends Entity { /** * Create QR code * @param array $attributes * @return Entity|QrCode */ public function create($attributes = array()) { $relativeUrl = "payments/". $this->getEntityUrl() ; return $this->request('POST', $relativeUrl, $attributes); } /** * Fetch QR code details based QR id * @param $id * @return Entity|QrCode */ public function fetch($id) { $relativeUrl = "payments/". $this->getEntityUrl(). $id ; return $this->request('GET', $relativeUrl); } /** * Close the QR code based on id * @return Entity|QrCode */ public function close() { $relativeUrl = "payments/{$this->getEntityUrl()}{$this->id}/close" ; return $this->request('POST', $relativeUrl); } /** * Fetch all QR code details * @param array $options * @return Entity|QrCode */ public function all($options = array()) { $relativeUrl = "payments/". $this->getEntityUrl(); return $this->request('GET', $relativeUrl, $options); } /** * Fetch payments made to a QR Code based on QR id * @param array $options * @return Entity|QrCode */ public function fetchAllPayments($options = array()) { $relativeUrl = "payments/{$this->getEntityUrl()}{$this->id}/payments" ; return $this->request('GET', $relativeUrl, $options); } } razorpay/src/Errors/BadRequestError.php 0000666 00000000561 15165415146 0014256 0 ustar 00 <?php namespace Razorpay\Api\Errors; class BadRequestError extends Error { protected $field = null; public function __construct($message, $code, $httpStatusCode, $field = null) { parent::__construct($message, $code, $httpStatusCode); $this->field = $field; } public function getField() { return $this->field; } } razorpay/src/Errors/SignatureVerificationError.php 0000666 00000000155 15165415146 0016522 0 ustar 00 <?php namespace Razorpay\Api\Errors; use Exception; class SignatureVerificationError extends Exception { } razorpay/src/Errors/ErrorCode.php 0000666 00000000610 15165415146 0013064 0 ustar 00 <?php namespace Razorpay\Api\Errors; class ErrorCode { const BAD_REQUEST_ERROR = 'BAD_REQUEST_ERROR'; const SERVER_ERROR = 'SERVER_ERROR'; const GATEWAY_ERROR = 'GATEWAY_ERROR'; public static function exists($code) { $code = strtoupper($code); return defined(get_class() . '::' . $code); } } razorpay/src/Errors/ServerError.php 0000666 00000000112 15165415146 0013455 0 ustar 00 <?php namespace Razorpay\Api\Errors; class ServerError extends Error { } razorpay/src/Errors/GatewayError.php 0000666 00000000113 15165415146 0013611 0 ustar 00 <?php namespace Razorpay\Api\Errors; class GatewayError extends Error { } razorpay/src/Errors/Error.php 0000666 00000000624 15165415146 0012276 0 ustar 00 <?php namespace Razorpay\Api\Errors; use Exception; class Error extends Exception { protected $httpStatusCode; public function __construct($message, $code, $httpStatusCode) { $this->code = $code; $this->message = $message; $this->httpStatusCode = $httpStatusCode; } public function getHttpStatusCode() { return $this->httpStatusCode; } } razorpay/src/Invoice.php 0000666 00000004503 15165415146 0011325 0 ustar 00 <?php namespace Razorpay\Api; use Requests; /** * Invoice entity gets used for both Payment Links and Invoices system. * Few of the methods are only meaningful for Invoices system and calling those * for against/for a Payment Link would throw Bad request error. */ class Invoice extends Entity { /** * Creates invoice of any type(invoice|link|ecod). * * @param array $attributes * * @return Invoice */ public function create($attributes = array()) { return parent::create($attributes); } /** * Fetches invoice entity with given id * * @param string $id * * @return Invoice */ public function fetch($id) { return parent::fetch($id); } /** * Fetches multiple invoices with given query options * * @param array $options * * @return Collection */ public function all($options = array()) { return parent::all($options); } /** * Cancels issued invoice * * @return Invoice */ public function cancel() { $url = $this->getEntityUrl() . $this->id . '/cancel'; return $this->request(Requests::POST, $url); } /** * Send/re-send notification for invoice by given medium * * @param $medium - sms|email * * @return array */ public function notifyBy($medium) { $url = $this->getEntityUrl() . $this->id . '/notify_by/' . $medium; $r = new Request(); return $r->request(Requests::POST, $url); } /** * Patches given invoice with new attributes * * @param array $attributes * * @return Invoice */ public function edit($attributes = array()) { $url = $this->getEntityUrl() . $this->id; return $this->request(Requests::PATCH, $url, $attributes); } /** * Issues drafted invoice * * @return Invoice */ public function issue() { $url = $this->getEntityUrl() . $this->id . '/issue'; return $this->request(Requests::POST, $url); } /** * Deletes drafted invoice * * @return Invoice */ public function delete() { $url = $this->getEntityUrl() . $this->id; $r = new Request(); return $r->request(Requests::DELETE, $url); } } razorpay/src/Token.php 0000666 00000001245 15165415146 0011011 0 ustar 00 <?php namespace Razorpay\Api; class Token extends Entity { /** * @param $id Token id */ public function fetch($id) { $relativeUrl = 'customers/'.$this->customer_id.'/'.$this->getEntityUrl().$id; return $this->request('GET', $relativeUrl); } public function all($options = array()) { $relativeUrl = 'customers/'.$this->customer_id.'/'.$this->getEntityUrl(); return $this->request('GET', $relativeUrl, $options); } public function delete($id) { $relativeUrl = 'customers/'.$this->customer_id.'/'.$this->getEntityUrl().$id; return $this->request('DELETE', $relativeUrl); } } razorpay/src/Payment.php 0000666 00000010273 15165415146 0011347 0 ustar 00 <?php namespace Razorpay\Api; use Requests; class Payment extends Entity { /** * @param $id Payment id */ public function fetch($id) { return parent::fetch($id); } public function all($options = array()) { if(isset($options['X-Razorpay-Account'])){ Request::addHeader('X-Razorpay-Account', $options['X-Razorpay-Account']); unset($options['X-Razorpay-Account']); } return parent::all($options); } /** * Patches given payment with new attributes * * @param array $attributes * * @return Payment */ public function edit($attributes = array()) { $url = $this->getEntityUrl() . $this->id; return $this->request(Requests::PATCH, $url, $attributes); } /** * @param $id Payment id */ public function refund($attributes = array()) { $refund = new Refund; $attributes = array_merge($attributes, array('payment_id' => $this->id)); return $refund->create($attributes); } /** * @param $id Payment id */ public function capture($attributes = array()) { $relativeUrl = $this->getEntityUrl() . $this->id . '/capture'; return $this->request('POST', $relativeUrl, $attributes); } public function transfer($attributes = array()) { $relativeUrl = $this->getEntityUrl() . $this->id . '/transfers'; return $this->request('POST', $relativeUrl, $attributes); } public function refunds() { $refund = new Refund; $options = array('payment_id' => $this->id); return $refund->all($options); } public function transfers() { $transfer = new Transfer(); $transfer->payment_id = $this->id; return $transfer->all(); } public function bankTransfer() { $relativeUrl = $this->getEntityUrl() . $this->id . '/bank_transfer'; return $this->request('GET', $relativeUrl); } public function fetchMultipleRefund($options = array()) { $relativeUrl = $this->getEntityUrl() . $this->id . '/refunds'; return $this->request('GET', $relativeUrl, $options); } public function fetchRefund($refundId) { $relativeUrl = $this->getEntityUrl() . $this->id . '/refunds/'.$refundId; return $this->request('GET', $relativeUrl); } public function createRecurring($attributes = array()) { $relativeUrl = $this->getEntityUrl() . 'create/recurring'; return $this->request('POST', $relativeUrl, $attributes); } /** * fetch Card Details * * @param id $id * * @return card */ public function fetchCardDetails() { $relativeUrl = $this->getEntityUrl() . $this->id . '/card'; return $this->request('GET', $relativeUrl); } /** * fetchPaymentDowntime * */ public function fetchPaymentDowntime() { $relativeUrl = $this->getEntityUrl() . 'downtimes'; return $this->request('GET', $relativeUrl); } /** * fetch Payment Downtime Id * * @param id $id * * @return card */ public function fetchPaymentDowntimeById($id) { $relativeUrl = $this->getEntityUrl() . 'downtimes' . $id; return $this->request('GET', $relativeUrl); } /** * create Payment Json * * @param array $attributes */ public function createPaymentJson($attributes = array()) { $relativeUrl = $this->getEntityUrl() . 'create/json'; return $this->request('POST', $relativeUrl, $attributes); } /** * submit otp * * @param id $id * * @param array $attributes */ public function otpSubmit($attributes = array()) { $relativeUrl = $this->getEntityUrl(). $this->id . '/otp/submit'; return $this->request('POST', $relativeUrl, $attributes); } /** * Generate otp * * @param id $id * * @param array $attributes */ public function otpGenerate() { $relativeUrl = $this->getEntityUrl(). $this->id . '/otp_generate'; return $this->request('POST', $relativeUrl); } } razorpay/src/PaymentLink.php 0000666 00000003367 15165415146 0012173 0 ustar 00 <?php namespace Razorpay\Api; use Requests; class PaymentLink extends Entity { /** * Creates Payment link . * * @param array $attributes * * @return PaymentLink */ public function create($attributes = array()) { $attributes = json_encode($attributes); Request::addHeader('Content-Type', 'application/json'); return parent::create($attributes); } /** * Fetches Payment link entity with given id * * @param string $id * * @return PaymentLink */ public function fetch($id) { return parent::fetch($id); } /** * Fetches multiple Payment link with given query options * * @param array $options * * @return Collection */ public function all($options = array()) { return parent::all($options); } /** * Cancels Payment link * * @return PaymentLink */ public function cancel() { $url = $this->getEntityUrl() . $this->id . '/cancel'; return $this->request(Requests::POST, $url); } public function edit($attributes = array()) { $relativeUrl = $this->getEntityUrl() . $this->id; $attributes = json_encode($attributes); Request::addHeader('Content-Type', 'application/json'); return $this->request('PATCH', $relativeUrl, $attributes); } /** * Send/re-send notification with short url by given medium * * @param $medium - sms|email * * @return array */ public function notifyBy($medium) { $url = $this->getEntityUrl() . $this->id . '/notify_by/' . $medium; $r = new Request(); return $r->request(Requests::POST, $url); } } razorpay/src/Refund.php 0000666 00000001360 15165415146 0011152 0 ustar 00 <?php namespace Razorpay\Api; class Refund extends Entity { /** * @param $id Refund id */ public function fetch($id) { return parent::fetch($id); } public function create($attributes = array()) { return parent::create($attributes); } public function all($options = array()) { return parent::all($options); } public function edit($attributes = array()) { $url = $this->getEntityUrl() . $this->id; return $this->request('PATCH', $url, $attributes); } public function refund($options = array()) { $relativeUrl = $this->getEntityUrl() . $this->id . '/refund'; return $this->request('POST', $relativeUrl, $options); } } razorpay/src/FundAccount.php 0000666 00000001012 15165415146 0012132 0 ustar 00 <?php namespace Razorpay\Api; use Requests; class FundAccount extends Entity { /** * Create a Fund Account . * * @param array $attributes * * @return FundAccount */ public function create($attributes = array()) { return parent::create($attributes); } /** * Fetch all Fund Accounts * * @param array $options * * @return Collection */ public function all($options = array()) { return parent::all($options); } } razorpay/src/Entity.php 0000666 00000013112 15165415146 0011201 0 ustar 00 <?php namespace Razorpay\Api; use Razorpay\Api\Errors; class Entity extends Resource implements ArrayableInterface { protected $attributes = array(); /** * Create method * * @param array $attributes * */ protected function create($attributes = null) { $entityUrl = $this->getEntityUrl(); return $this->request('POST', $entityUrl, $attributes); } protected function fetch($id) { $entityUrl = $this->getEntityUrl(); $this->validateIdPresence($id); $relativeUrl = $entityUrl . $id; return $this->request('GET', $relativeUrl); } protected function validateIdPresence($id) { if ($id !== null) { return; } $path = explode('\\', get_class($this)); $class = strtolower(array_pop($path)); $message = 'The ' . $class . ' id provided is null'; $code = Errors\ErrorCode::BAD_REQUEST_ERROR; throw new Errors\BadRequestError($message, $code, 500); } protected function all($options = array()) { $entityUrl = $this->getEntityUrl(); return $this->request('GET', $entityUrl, $options); } protected function getEntityUrl() { $fullClassName = get_class($this); $pos = strrpos($fullClassName, '\\'); $className = substr($fullClassName, $pos + 1); $className = $this->snakeCase($className); return $className.'s/'; } protected function snakeCase($input) { $delimiter = '_'; $output = preg_replace('/\s+/u', '', ucwords($input)); $output = preg_replace('/(.)(?=[A-Z])/u', '$1'.$delimiter, $output); $output = strtolower($output); return $output; } /** * Makes a HTTP request using Request class and assuming the API returns * formatted entity or collection result, wraps the returned JSON as entity * and returns. * * @param string $method * @param string $relativeUrl * @param array $data * @param array $additionHeader * * @return Entity */ protected function request($method, $relativeUrl, $data = null) { $request = new Request(); $response = $request->request($method, $relativeUrl, $data); if ((isset($response['entity'])) and ($response['entity'] == $this->getEntity())) { $this->fill($response); return $this; } else { return static::buildEntity($response); } } /** * Given the JSON response of an API call, wraps it to corresponding entity * class or a collection and returns the same. * * @param array $data * * @return Entity */ protected static function buildEntity($data) { $entities = static::getDefinedEntitiesArray(); if (isset($data['entity'])) { if (in_array($data['entity'], $entities)) { $class = static::getEntityClass($data['entity']); $entity = new $class; } else { $entity = new static; } } else { $entity = new static; } $entity->fill($data); return $entity; } protected static function getDefinedEntitiesArray() { return array( 'collection', 'payment', 'refund', 'order', 'customer', 'token', 'settlement'); } protected static function getEntityClass($name) { return __NAMESPACE__.'\\'.ucfirst($name); } protected function getEntity() { $class = get_class($this); $pos = strrpos($class, '\\'); $entity = strtolower(substr($class, $pos)); return $entity; } public function fill($data) { $attributes = array(); if(is_array($data)) { foreach ($data as $key => $value) { if (is_array($value)) { if (static::isAssocArray($value) === false) { $collection = array(); foreach ($value as $v) { if (is_array($v)) { $entity = static::buildEntity($v); array_push($collection, $entity); } else { array_push($collection, $v); } } $value = $collection; } else { $value = static::buildEntity($value); } } $attributes[$key] = $value; } } $this->attributes = $attributes; } public static function isAssocArray($arr) { return array_keys($arr) !== range(0, count($arr) - 1); } public function toArray() { return $this->convertToArray($this->attributes); } protected function convertToArray($attributes) { $array = $attributes; foreach ($attributes as $key => $value) { if (is_object($value)) { $array[$key] = $value->toArray(); } else if (is_array($value) and self::isAssocArray($value) == false) { $array[$key] = $this->convertToArray($value); } } return $array; } } razorpay/src/Resource.php 0000666 00000002270 15165415146 0011517 0 ustar 00 <?php namespace Razorpay\Api; use ArrayAccess; use ArrayIterator; use IteratorAggregate; class Resource implements ArrayAccess, IteratorAggregate { protected $attributes = array(); #[\ReturnTypeWillChange] public function getIterator() { return new ArrayIterator($this->attributes); } #[\ReturnTypeWillChange] public function offsetExists($offset) { return (isset($this->attributes[$offset])); } #[\ReturnTypeWillChange] public function offsetSet($offset, $value) { $this->attributes[$offset] = $value; } #[\ReturnTypeWillChange] public function offsetGet($offset) { return $this->attributes[$offset]; } #[\ReturnTypeWillChange] public function offsetUnset($offset) { unset($this->attributes[$offset]); } public function __get($key) { return $this->attributes[$key]; } public function __set($key, $value) { return $this->attributes[$key] = $value; } public function __isset($key) { return (isset($this->attributes[$key])); } public function __unset($key) { unset($this->attributes[$key]); } } razorpay/src/Card.php 0000666 00000000266 15165415146 0010604 0 ustar 00 <?php namespace Razorpay\Api; class Card extends Entity { /** * @param $id Card id */ public function fetch($id) { return parent::fetch($id); } } razorpay/src/Item.php 0000666 00000001216 15165415146 0010625 0 ustar 00 <?php namespace Razorpay\Api; class Item extends Entity { public function create($attributes = array()) { return parent::create($attributes); } public function fetch($id) { return parent::fetch($id); } public function edit($attributes = array()) { $url = $this->getEntityUrl() . $this->id; return $this->request('PATCH', $url, $attributes); } public function all($options = array()) { return parent::all($options); } public function delete() { $url = $this->getEntityUrl() . $this->id; return $this->request('DELETE', $url); } } razorpay/src/Plan.php 0000666 00000000525 15165415146 0010623 0 ustar 00 <?php namespace Razorpay\Api; class Plan extends Entity { public function create($attributes = array()) { return parent::create($attributes); } public function fetch($id) { return parent::fetch($id); } public function all($options = array()) { return parent::all($options); } } razorpay/src/Settlement.php 0000666 00000003723 15165415146 0012060 0 ustar 00 <?php namespace Razorpay\Api; /** * Settlement related actions can be done from here */ class Settlement extends Entity { /** * create Ondemand Settlemententity * @param array $attributes * @return Settlement */ public function createOndemandSettlement($attributes = array()) { $relativeUrl = $this->getEntityUrl() ."ondemand" ; return $this->request('POST', $relativeUrl, $attributes); } /** * Fetch single settlement entity * @param string $id * @return Settlement */ public function fetch($id) { return parent::fetch($id); } /** * Get all settlements according to options * @param array $options * @return Collection */ public function all($options = array()) { return parent::all($options); } /** * Get combined report of settlements * @param array $options * @return array */ public function reports($options = array()) { $relativeUrl = $this->getEntityUrl() . 'report/combined'; return $this->request('GET', $relativeUrl, $options); } /** * Get Settlement Recon * @param array $options * @return array */ public function settlementRecon($options = array()) { $relativeUrl = $this->getEntityUrl() . 'recon/combined'; return $this->request('GET', $relativeUrl, $options); } /** * fetch Ondemand Settlement by Id * @param string $id * @return array */ public function fetchOndemandSettlementById() { $relativeUrl = $this->getEntityUrl(). "ondemand/" . $this->id ; return $this->request('GET', $relativeUrl); } /** * fetch all Ondemand Settlement * @return array */ public function fetchAllOndemandSettlement() { $relativeUrl = $this->getEntityUrl(). "ondemand/"; return $this->request('GET', $relativeUrl); } } razorpay/src/Order.php 0000666 00000001624 15165415146 0011005 0 ustar 00 <?php namespace Razorpay\Api; class Order extends Entity { /** * @param $id Order id description */ public function create($attributes = array()) { return parent::create($attributes); } public function fetch($id) { return parent::fetch($id); } public function all($options = array()) { return parent::all($options); } public function edit($attributes = array()) { $url = $this->getEntityUrl() . $this->id; return $this->request('PATCH', $url, $attributes); } public function payments() { $relativeUrl = $this->getEntityUrl().$this->id.'/payments'; return $this->request('GET', $relativeUrl); } public function transfers($options = array()) { $relativeUrl = $this->getEntityUrl().$this->id; return $this->request('GET', $relativeUrl, $options); } } razorpay/src/Utility.php 0000666 00000005206 15165415146 0011375 0 ustar 00 <?php namespace Razorpay\Api; class Utility { const SHA256 = 'sha256'; public function verifyPaymentSignature($attributes) { $actualSignature = $attributes['razorpay_signature']; $paymentId = $attributes['razorpay_payment_id']; if (isset($attributes['razorpay_order_id']) === true) { $orderId = $attributes['razorpay_order_id']; $payload = $orderId . '|' . $paymentId; } else if (isset($attributes['razorpay_subscription_id']) === true) { $subscriptionId = $attributes['razorpay_subscription_id']; $payload = $paymentId . '|' . $subscriptionId; } else if (isset($attributes['razorpay_payment_link_id']) === true) { $paymentLinkId = $attributes['razorpay_payment_link_id']; $paymentLinkRefId = $attributes['razorpay_payment_link_reference_id']; $paymentLinkStatus = $attributes['razorpay_payment_link_status']; $payload = $paymentLinkId . '|'. $paymentLinkRefId . '|' . $paymentLinkStatus . '|' . $paymentId; } else { throw new Errors\SignatureVerificationError( 'Either razorpay_order_id or razorpay_subscription_id or razorpay_payment_link_id must be present.'); } $secret = Api::getSecret(); self::verifySignature($payload, $actualSignature, $secret); } public function verifyWebhookSignature($payload, $actualSignature, $secret) { self::verifySignature($payload, $actualSignature, $secret); } public function verifySignature($payload, $actualSignature, $secret) { $expectedSignature = hash_hmac(self::SHA256, $payload, $secret); // Use lang's built-in hash_equals if exists to mitigate timing attacks if (function_exists('hash_equals')) { $verified = hash_equals($expectedSignature, $actualSignature); } else { $verified = $this->hashEquals($expectedSignature, $actualSignature); } if ($verified === false) { throw new Errors\SignatureVerificationError( 'Invalid signature passed'); } } private function hashEquals($expectedSignature, $actualSignature) { if (strlen($expectedSignature) === strlen($actualSignature)) { $res = $expectedSignature ^ $actualSignature; $return = 0; for ($i = strlen($res) - 1; $i >= 0; $i--) { $return |= ord($res[$i]); } return ($return === 0); } return false; } }
| ver. 1.4 |
Github
|
.
| PHP 5.4.45 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings