Initializationπ
Copyuse Razorpay\Api\Api;
$api = new Api($api_key, $api_secret);
Copyuse Razorpay\Api\Api;
$api = new Api($api_key, $api_secret);
The Key Id
and Key Secret
appear on a pop-up page as shown below:
Test Mode API Keys
Live Mode API Keys
Watch Out!
Note:
Click here for request parameters and an example request and response.
Copy$api->order->create(array('receipt' => '123', 'amount' => 100, 'currency' => 'INR', 'notes'=> array('key1'=> 'value3','key2'=> 'value2')));
Copy$api->order->fetch($orderId);
Copy$api->order->all($options);
Copy$api->order->fetch($orderId)->payments();
Copy$api->order->fetch($orderId)->edit(array('notes'=> array('notes_key_1'=>'Beam me up Scotty. 1', 'notes_key_2'=>'Engage')));
Note:
Click here for request parameters and an example request and response.
Copy$api->payment->fetch($paymentId)->capture(array('amount'=>$amount,'currency' => 'INR'));
Copy$api->payment->fetch($paymentId);
Copy$api->payment->all($options)
Copy$api->order->fetch($orderId)->payments();
Copyecho $payment->amount;
echo $payment->currency;
// And so on for other attributes
Copy$api->payment->all(array('expand[]'=>'card')
Copy$api->payment->all(array('expand[]'=>'emi')
Copy$api->payment->fetch($paymentId)->fetchCardDetails();
Copy$api->payment->fetch($paymentId)->edit(array('notes'=> array('key_1'=> 'value1','key_2'=> 'value2')));
Copy$api->payment->fetchPaymentDowntime();
Copy$api->payment->fetchPaymentDowntimeById($downtimeId);
Note:
Click here for request parameters and an example request and response.
Copy$api->settlement->fetch($settlementId);
Copy$api->settlement->all($options);
Copy$api->settlement->reports(array("year"=>2020,"month"=>09));
Copy$api->settlement->settlementRecon(array('year' => 2018, 'month' =>02, 'day'=>11));
Copy$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.")));
Copy$api->settlement->fetchAllOndemandSettlement($options);
Copy$api->settlement->fetch($settlementId)->fetchOndemandSettlementById();
Note:
Click here for request parameters and an example request and response.
Copy$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"));
Copy$refund = $api->refund->create(array('payment_id' => $id, 'amount'=>$refundAmount));
Copy$$api->payment->fetch($paymentId)->refund(array("amount"=> "100","speed"=>"optimum","receipt"=>"Receipt No. 31"));
Copy$api->refund->fetch($refundId);
Copy$api->refund->all($options);
Copy$api->payment->fetch($paymentId)->fetchRefund($refundId);
Copy$api->payment->fetch($paymentId)->fetchMultipleRefund($option);
Copy$api->refund->fetch($refundId)->edit(array('notes'=> array('notes_key_1'=>'Beam me up Scotty.', 'notes_key_2'=>'Engage')));
Copy$card = $api->card->fetch($card_id);
Note:
Click here for request parameters and an example request and response.
Copy$api->customer->create(array('name' => 'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com','contact'=>'9123456780','notes'=> array('notes_key_1'=> 'Tea, Earl Grey, Hot','notes_key_2'=> 'Tea, Earl Grey⦠decaf'));
Copy$api->customer->fetch($customerId)
Copy$api->customer->all($options)
Copy$api->customer->fetch($customerId)->edit(array('name' => 'Gaurav Kumar', 'email' => 'gaurav.kumar@example.com','notes'=> array('notes_key_1'=> 'Tea, Earl Grey, Hot','notes_key_2'=> 'Tea, Earl Grey⦠decaf')));
Copy$token = $api->customer->token()->fetch($token_id);
Copy$tokens = $api->customer->token()->all($options);
Copy$api->customer->token()->delete($token_id);
Note:
Click here for request parameters and an example request and response.
Copy$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')));
Copy$api->plan->fetch($planId);
Copy$api->plan->all($options);
Copy$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')));
Copy$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')));
Copy$api->subscription->fetch($subscriptionId);
Copy$api->subscription->all($options);
Copy$api->subscription->fetch($subscriptionId)->cancel($options);
Note:
$options = ['cancel_at_cycle_end' => 1];
Copy$api->subscription->fetch($subscriptionId)->update($options);
Copy$api->subscription->fetch($subscriptionId)->pendingUpdate()
Copy$api->subscription->fetch($subscriptionId)->cancelScheduledChanges();
Copy$api->subscription->fetch($subscriptionId)->pause(array('pause_at'=>'now'))
Copy$api->subscription->fetch($subscriptionId)->resume(array('resume_at'=>'now'))
Copy$api->invoice->all(['subscription_id'=>$subscriptionId]);
Copy$api->utility->verifyPaymentSignature($options)
Copy$api->subscription->fetch($subscriptionId)->createAddon(array('item' => array('name' => 'Extra Chair', 'amount' => 30000, 'currency' => 'INR'), 'quantity' => 2))
Copy$api->addon->fetch($addonId);
Copy$api->addon->all($options);
Copy$api->addon->fetch($addonId)->delete();
Note:
Click here for request parameters and an example request and response.
Copy$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'));
Copy$api->paymentLink->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')));
Copy$api->paymentLink->fetch($paymentLinkId);
Copy$api->paymentLink->all();
Copy$api->paymentLink->fetch($paymentLinkId)->cancel();
Copy$api->paymentLink->fetch($paymentLinkId)->notifyBy($medium));
Copy$api->paymentLink->fetch($paymentLinkId)->edit(array("reference_id"=>"TS42", "expire_by"=>"1640270451" , "reminder_enable"=>0, "notes"=>["policy_name"=>"Jeevan Saral 2"]));
Note:
Click here for request parameters and an example request and response.
Copy$api->invoice->create(array ('type' => 'invoice','date' => 1589994898, 'customer_id'=> 'cust_E7q0trFqXgExmT', 'line_items'=>array(array('item_id'=>'item_DRt61i2NnL8oy6'))));
Copy$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.')));
Copy$api->invoice->fetch($invoiceId)->issue();
Copy$api->invoice->fetch($invoiceId)->notify($medium);
Copy$api->invoice->fetch($invoiceId);
Copy$api->invoice->all();
Copy$api->invoice->fetch($invoiceId)->cancel();
Copy$api->invoice->fetch($invoiceId)->delete();
Note:
Click here for request parameters and an example request and response.
Copy$api->virtualAccount->create(array('receivers' => array('types'=> arra('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')));
Copy$api->virtualAccount->create(array('receivers' => array('types' => array('qr_code')), 'description' => 'First QR code', 'amount_expected' => 100, 'notes' => array('receiver_key' => 'receiver_value')));
Copy$api->virtualAccount->fetch($virtualId);
Copy$api->virtualAccount->all($options);
Copy$bankTransfer = $api->payment->fetch($payment_id)->bankTransfer();
Copy$payments = $virtualAccount->payments();
Copy$api->virtualAccount->fetch($virtualId)->payments($options);
Copy$api->payment->fetch($virtualId)->bankTransfer();
Copy$api->payment->fetch($paymentId)->refunds();
Copy$api->virtualAccount->fetch($virtualId)->addReceiver(array('types' => array('vpa'),'vpa' => array('descriptor'=>'gauravkumar')));
Copy$api->virtualAccount->fetch($virtualId)->close();
Note:
Click here for request parameters and an example request and response.
Copy$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')));
Copy$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))));
Copy$api->transfer->create(array('account' => $accountId, 'amount' => 500, 'currency' => 'INR'));
Copy$transfer = $api->transfer->fetch($transfer_id)->edit($options);
Copy$api->payment->fetch($paymentId)->transfer();
Copy$api->order->fetch($orderId)->transfers(array('expand[]'=>'transfers'));
Copy$api->transfer->fetch($transferId);
Copy$transfers = $api->transfer->all();
Copy$api->transfer->all(array('recipient_settlement_id'=> $recipientSettlementId));
Copy$api->transfer->all(array('expand[]'=> 'recipient_settlement'));
Copy$api->payment->all(array('X-Razorpay-Account'=> $linkedAccountId));
Copy$api->payment->fetch($paymentId)->refund(array('amount'=> '100','reverse_all'=>'1'));
Copy$api->transfer->fetch($transferId)->reverse(array('amount'=>'100'));
Copy$api->payment->fetch($paymentId)->transfer(array('account' => $accountId, 'amount' => 500, 'currency' => 'INR','on_hold'=>'1'));
Copy$api->transfer->fetch($paymentId)->edit(array('on_hold' => '1', 'on_hold_until' => '1679691505'));
Note:
Click here for request parameters and an example request and response.
Copy$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")));
Copy$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")));
Copy$api->qrCode->all($options)
Copy$api->qrCode->fetch($qrCodeId)
Copy $api->qrCode->all(["customer_id" => $customerId])
Copy $api->qrCode->all(["payment_id" => $paymentId])
Copy$api->qrCode->fetch($qrCodeId)->fetchAllPayments($options)
Copy$api->qrCode->fetch($qrCodeId)->close()