PHP code example of loveycom / cashfree

1. Go to this page and download the library: Download loveycom/cashfree library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

loveycom / cashfree example snippets


LoveyCom\CashFree\CashFreeServiceProvider::class,

php artisan vendor:publish

    //import the class
    use LoveyCom\CashFree\PaymentGateway\Order;
    
    //instantiate the class
	$order = new Order();
	//prepare the order details
	//NOTE: Prepare a route for returnUrl and notifyUrl (something like a webhook). However, if you have webhook setup in your cashfree dashboard, no need for notifyUrl. But if notifyUrl is set, it will be called instead.
	$od["orderId"] = "ORDER-84984941";
    $od["orderAmount"] = 10000;
    $od["orderNote"] = "Subscription";
    $od["customerPhone"] = "9000012345";
    $od["customerName"] = "Test Name";
    $od["customerEmail"] = "[email protected]";
    $od["returnUrl"] = "http://127.0.0.1:8000/order/success";
    $od["notifyUrl"] = "http://127.0.0.1:8000/order/success";
	//call the create method
	$order->create($od);
	//get the payment link of this order for your customer
	$link = $order->getLink($od['orderId'])
	//You can now either send this link to your customer through email or redirect to it for them to complete the payment.
	//To confirm the payment,
	//Call either getDetails($orderId) or getStatus($orderId) method
    

composer dump-autoload
config/cashfree.php