From 4ed3af48ca3b063304f9b88dba7c18916b4fa650 Mon Sep 17 00:00:00 2001 From: Anand Siddharth Date: Tue, 27 Nov 2018 13:16:10 +0530 Subject: [PATCH] refund docs --- README.md | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/README.md b/README.md index 1dfb068..b6d84d7 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,85 @@ class OrderController extends Controller } ``` +### Initiating Refunds + +```php +prepare([ + 'order' => $order->id, + 'reference' => "refund-order-4", // provide refund reference for your future reference (should be unique for each order) + 'amount' => 300, // refund amount + 'transaction' => $order->transaction_id // provide paytm transaction id referring to this order + ]); + $refund->initiate(); + $response = $refund->response() // To get raw response as object + + if($refund->isSuccessful()){ + //Refund Successful + }else if($refund->isFailed()){ + //Refund Failed + }else if($refund->isOpen()){ + //Refund Open/Processing + }else if($refund->isPending()){ + //Refund Pending + } + } +} +``` + +### Check Refund Status + +```php +prepare([ + 'order' => $order->id, + 'reference' => "refund-order-4", // provide reference number (the same which you have entered for initiating refund) + ]); + $refundStatus->check(); + + $response = $refundStatus->response() // To get raw response as object + + if($refundStatus->isSuccessful()){ + //Refund Successful + }else if($refundStatus->isFailed()){ + //Refund Failed + }else if($refundStatus->isOpen()){ + //Refund Open/Processing + }else if($refundStatus->isPending()){ + //Refund Pending + } + } +} +``` + ## Support on Beerpay [![Beerpay](https://beerpay.io/anandsiddharth/laravel-paytm-wallet/badge.svg?style=beer-square)](https://beerpay.io/anandsiddharth/laravel-paytm-wallet) [![Beerpay](https://beerpay.io/anandsiddharth/laravel-paytm-wallet/make-wish.svg?style=flat-square)](https://beerpay.io/anandsiddharth/laravel-paytm-wallet?focus=wish)