Skip to content

Commit 4087bb0

Browse files
Merge pull request #5 from devinweb/handle-transaction-failure
Transaction failure
2 parents 50f906f + f44eafd commit 4087bb0

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ use Devinweb\LaravelPaytabs\Facades\LaravelPaytabsFacade;
124124
$paytabs = LaravelPaytabsFacade::setRedirectUrl($url);
125125

126126
```
127-
If you use one redirect url for all the payments inside your project, you can add it to the .env as explained [above](#paytabs-keys).
127+
⚠️ If you use one redirect url for all the payments inside your project, you can add it to the .env as explained [above](#paytabs-keys).
128+
128129

129130
#### Framed Hosted Payment Page
130131
To display the hosted payment page in an embed frame within the merchant website, you can call `framedPage`.
@@ -176,7 +177,8 @@ use Devinweb\LaravelPaytabs\Facades\LaravelPaytabsFacade;
176177

177178
$paytabs = LaravelPaytabsFacade::hideShipping();
178179
```
179-
If the billing details are already added, this function will hide the billing section as well.
180+
181+
⚠️️ If the billing details are already added, this function will hide the billing section as well.
180182

181183

182184
#### Generate the hosted payment page
@@ -218,7 +220,26 @@ A row with `status=pending` will be added to the transactions table and a `Trans
218220

219221
}
220222
```
221-
After visiting the generated URL and finalizing your payment, the transaction status will be changed to `paid` and you will be redirected to your return url. A `TransactionSucceed` or a `TransactionFail` event will be fired.
223+
After visiting the generated URL and finalizing your payment, the transaction status will be changed to `paid` or `failed` and you will be redirected to your return url. A `TransactionSucceed` or a `TransactionFail` event will be fired.
224+
The payment result details will be posted to the redirect URL, as the example shown below:
225+
226+
```
227+
// Successful transaction response example
228+
acquirerMessage=
229+
&acquirerRRN=
230+
&cartId=cart_11111
231+
&customerEmail=imane%devinweb.com
232+
&respCode=G96376
233+
&respMessage=Authorised
234+
&respStatus=A
235+
&token=
236+
&tranRef=TST2110400143785
237+
&signature=db333934b8bd8d5f94d90ab28c72831d563dc10bb196ebd78a300af7df8fad7
238+
Generic
239+
```
240+
You can visit the paytabs [official documentation](https://support.paytabs.com/en/support/solutions/articles/60000711358-what-is-response-code-vs-the-response-status-) to learn more about other paytabs Response Code/Status.
241+
242+
222243
### Follow up a transaction
223244
After initiating or finalizing your payment, you may need to do some operations on it.
224245
#### Get a transaction by reference
@@ -262,7 +283,8 @@ $transaction = LaravelPaytabsFacade::setTransactionRef($transactionRef)
262283
}
263284
}
264285
```
265-
You can visit the paytabs [official documentation](https://support.paytabs.com/en/support/solutions/articles/60000711358-what-is-response-code-vs-the-response-status-) to learn more about payment_result section.
286+
⚠️ You can visit the paytabs [official documentation ](https://support.paytabs.com/en/support/solutions/articles/60000711358-what-is-response-code-vs-the-response-status) to learn more about payment_result section.
287+
266288
#### Refund, Capture or Void transaction
267289
> Refund request is available for those Authenticated Sale transactions or Authenticated Capture transactions.
268290

src/Actions/FinalizeTransaction.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public function __invoke(Request $request)
2424
]);
2525
event(new TransactionSucceed($response));
2626
} else {
27+
$transaction->update([
28+
'status' => 'failed',
29+
]);
2730
event(new TransactionFail($response));
2831
}
2932

0 commit comments

Comments
 (0)