From 399ad089201bd3e605efb1e8760b5a456bbdd10d Mon Sep 17 00:00:00 2001 From: Dipesh79 Date: Tue, 5 Dec 2023 21:41:46 +0545 Subject: [PATCH] Merchant Transaction Id Error Fixed --- README.md | 4 ++-- src/LaravelPhonePe.php | 7 ++----- src/config/phonepe.php | 3 +-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 8c18f52..21bc0d5 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,6 @@ PHONEPE_ENV="staging" //staging or production PHONEPE_SALT_KEY="099eb0cd-02cf-4e2a-8aca-3e6c6aff0399" PHONEPE_SALT_INDEX="1" PHONEPE_CALLBACK_URL="http://localhost:8000" -PHONEPE_MERCHANT_TRANSACTION_ID="MT7850590068188104" ``` ### Publish Vendor File @@ -40,7 +39,8 @@ use Dipesh79\LaravelPhonePe\LaravelPhonePe; public function phonePePayment() { $phonepe = new LaravelPhonePe(); - $url = $phonepe->makePayment(1000, '9999999999', 'https://locahost:8000/redirct-url'); + //amount, phone number, callback url, unique merchant transaction id + $url = $phonepe->makePayment(1000, '9999999999', 'https://locahost:8000/redirct-url','1'); return redirect()->away($url); } diff --git a/src/LaravelPhonePe.php b/src/LaravelPhonePe.php index 0f4d3ac..719888c 100644 --- a/src/LaravelPhonePe.php +++ b/src/LaravelPhonePe.php @@ -13,8 +13,6 @@ class LaravelPhonePe private $saltIndex; private $callBackUrl; - private $merchantTransactionId; - public function __construct() { $this->merchantId = config('phonepe.merchantId'); @@ -23,14 +21,13 @@ public function __construct() $this->saltKey = config('phonepe.saltKey'); $this->saltIndex = config('phonepe.saltIndex'); $this->callBackUrl = config('phonepe.callBackUrl'); - $this->merchantTransactionId = config('phonepe.merchantTransactionId'); } - public function makePayment($amount, $phone,$redirectUrl) + public function makePayment($amount, $phone,$redirectUrl,$merchantTransactionId) { $data = array( 'merchantId' => $this->merchantId, - 'merchantTransactionId' => $this->merchantTransactionId, + 'merchantTransactionId' => $merchantTransactionId, 'merchantUserId' => $this->merchantUserId, 'amount' => $amount * 100, 'redirectUrl' => $redirectUrl, diff --git a/src/config/phonepe.php b/src/config/phonepe.php index 2b2ce55..0d2e2c6 100644 --- a/src/config/phonepe.php +++ b/src/config/phonepe.php @@ -7,6 +7,5 @@ 'saltKey' => env('PHONEPE_SALT_KEY'), 'saltIndex' => env('PHONEPE_SALT_INDEX'), 'redirectUrl' => env('PHONEPE_REDIRECT_URL'), - 'callBackUrl' => env('PHONEPE_CALLBACK_URL'), - 'merchantTransactionId' => env('PHONEPE_MERCHANT_TRANSACTION_ID'), + 'callBackUrl' => env('PHONEPE_CALLBACK_URL') );