1. Go to this page and download the library: Download laraditz/razorpay 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/ */
use Laraditz\Razorpay\Facades\Razorpay;
$refund = Razorpay::refund()->create('pay_29QQoUBi66xm2f', ['amount' => 10000]);
use Laraditz\Razorpay\Facades\Razorpay;
$settlements = Razorpay::settlement()->all(['count' => 20]);
use Laraditz\Razorpay\Models\RazorpayOrder;
$order = RazorpayOrder::where('razorpay_id', 'order_EKwxwAgItmmXdp')->first();
if ($order->status->isPaid()) {
// ...
}
$order->payment; // the RazorpayPayment that settled it, via the payment_id column
use Laraditz\Razorpay\Exceptions\AuthenticationException; // 401
use Laraditz\Razorpay\Exceptions\ValidationException; // 400, carries field errors via getErrors()
use Laraditz\Razorpay\Exceptions\ApiException; // any other 4xx/5xx, carries the full body via getResponse()
try {
Razorpay::paymentLink()->create(['amount' => 50000]);
} catch (ValidationException $e) {
logger()->warning('Razorpay validation failed', $e->getErrors());
} catch (ApiException $e) {
logger()->error('Razorpay API error', $e->getResponse());
}
class FulfillOrder
{
public function handle(\Laraditz\Razorpay\Events\PaymentLinkPaid $event): void
{
if ($event->paymentLink === null) {
return;
}
// $event->paymentLink->status is already PaymentLinkStatus::Paid here
}
}