11# PHP SSL-Wirless Payment client
22
3- php-sslwireless-payment is a PHP client for SSL Wirless Payment API. This package is also support Laravel.
3+ php-sslwireless-payment is a PHP client for SSL Wirless Payment Gateway API. This package is also support Laravel.
44
55## Installation
66
@@ -101,7 +101,7 @@ return [
101101#### Getting Payment Post Url
102102
103103In PHP:
104- ```
104+ ``` php
105105use \Shipu\SslWPayment\Payment;
106106
107107...
@@ -110,7 +110,7 @@ $payment = new Payment($config);
110110return $payment->paymentUrl();
111111```
112112In Laravel:
113- ```
113+ ``` php
114114use \Shipu\SslWPayment\Payment;
115115
116116...
@@ -120,7 +120,7 @@ return $payment->paymentUrl();
120120```
121121
122122#### Getting Hidden Input Field
123- ```
123+ ``` php
124124use \Shipu\SslWPayment\Payment;
125125
126126...
@@ -133,7 +133,7 @@ return $payment->customer([
133133])->transactionId('21005455540')->amount(3500)->hiddenValue();
134134```
135135Where Transaction id is random value. you can generate by yourself or follow bellow steps:
136- ```
136+ ``` php
137137use \Shipu\SslWPayment\Payment;
138138
139139...
@@ -154,7 +154,7 @@ return $payment->customer([
154154])->amount(3500)->hiddenValue();
155155```
156156#### Generate Transaction Id
157- ```
157+ ``` php
158158use \Shipu\SslWPayment\Payment;
159159
160160...
@@ -164,43 +164,44 @@ return $payment->generateTransaction();
164164```
165165
166166#### Checking Valid Response
167- ```
167+ ``` php
168168use \Shipu\SslWPayment\Payment;
169169
170170...
171171
172172$payment = new Payment(config('sslwpayment'));
173- return $payment->valid($request); // where `$request` is after post response in your success, fail or cancel url.
173+ return $payment->valid($request);
174174```
175175Checking valid response with amount:
176- ```
176+ ``` php
177177use \Shipu\SslWPayment\Payment;
178178
179179...
180180
181181$payment = new Payment(config('sslwpayment'));
182- return $payment->valid($request, '3500'); // where `$request` is after post response in your success, fail or cancel url.
182+ return $payment->valid($request, '3500');
183183```
184184
185185Checking valid response with amount and transaction id:
186- ```
186+ ``` php
187187use \Shipu\SslWPayment\Payment;
188188
189189...
190190
191191$payment = new Payment(config('sslwpayment'));
192- return $payment->valid($request, '3500', '21005455540'); // where `$request` is after post response in your success, fail or cancel url.
192+ return $payment->valid($request, '3500', '21005455540');
193193```
194+ Where ` $request ` will appear after post response.
194195
195196## In Blade
196197
197198#### Getting Payment Post Url
198- ```
199+ ``` php
199200{{ ssl_wireless_payment_url() }}
200201```
201202
202203#### Getting Hidden Input Field
203- ```
204+ ``` php
204205{!!
205206 ssl_wireless_hidden_input([
206207 'tran_id' => '21005455540', // random number
@@ -212,7 +213,7 @@ return $payment->valid($request, '3500', '21005455540'); // where `$request` is
212213```
213214
214215#### Complete Post Button View
215- ```
216+ ``` php
216217{!!
217218ssl_wireless_post_button([
218219 'tran_id' => '21005455540', // random number
@@ -222,8 +223,61 @@ ssl_wireless_post_button([
222223], 2000, '<i class =" fa fa-money" ></i >', 'btn btn-sm btn-success')
223224!!}
224225```
226+ ## Example
227+
228+ ##### Route
229+ ``` php
230+ Route::post('payment/success', 'YourMakePaymentsController@paymentSuccess')->name('payment.success');
231+ Route::post('payment/failed', 'YourMakePaymentsController@paymentFailed')->name('payment.failed');
232+ Route::post('payment/cancel', 'YourMakePaymentsController@paymentCancel')->name('payment.cancel');
233+ ```
234+
235+ or
236+
237+ ``` php
238+ Route::post('payment/success', 'YourMakePaymentsController@paymentSuccessOrFailed')->name('payment.success');
239+ Route::post('payment/failed', 'YourMakePaymentsController@paymentSuccessOrFailed')->name('payment.failed');
240+ Route::post('payment/cancel', 'YourMakePaymentsController@paymentSuccessOrFailed')->name('payment.cancel');
241+
242+ ```
243+ ##### Controller Method
244+ ``` php
245+ use Shipu\SslWPayment\Facades\Payment;
246+
247+ ...
248+
249+ public function paymentSuccessOrFailed(Request $request)
250+ {
251+ if($request->get('status') == 'CANCELLED') {
252+ return redirect()->back();
253+ }
254+
255+ $transactionId = $request->get('tran_id');
256+ $valid = Payment::valid($request, 3500, $transactionId);
257+
258+ if($valid) {
259+ // Successfully Paid.
260+ } else {
261+ // Something went wrong.
262+ }
263+
264+ return redirect()->back();
265+ }
266+ ```
267+
268+ ## To Disable CSRF token
269+ Open ` app/Http/Middleware/VerifyCsrfToken.php ` and adding :
270+ ``` php
271+ protected $except = [
272+ ...
273+ 'payment/*',
274+ ...
275+ ];
276+ ```
225277
278+ ## Credits
226279
227- That's it.
280+ - [ Shipu Ahamed] ( https://github.com/shipu )
281+ - [ All Contributors] ( ../../contributors )
228282
229- Thank you :)
283+ Special Thanks to [ Tawsif ul Karim ] ( https://github.com/tawsifkarim ) .
0 commit comments