PayTabs Laravel Package makes integration with the PayTabs payment gateway very easy by providing a ready-made payment class that handles the card entry and, billing & shipping information and completes the missing details.

To void a transaction means that the previously authorized/held amount from a previous auth transaction will be released back to the cardholder's bank account from his own bank side, as it was kept on hold there. In this article, we walk you through how to use and manage the below function:


     

Paypage::void('tran_ref','order_id','amount','void description');


Void requests are available for ONLY authenticated "Auth" transactions that are NOT fully captured yet.


Through out the article we will use the transaction types clarified in our What is "tran_type"? solution article.


Transaction Reference 



The Parameter Tag/Nametran_ref
Example
$tran_ref = "TST2016700000692";
Data TypeSTRING
Required

PurposeIndicates the reference to the "Auth" transaction you want to capture.
Validation RulesAccept only valid "Auth" transaction references.




Order Id


The Parameter Tag/Nameorder_id
Example
$order_id = "CART#1001";
Data TypeSTRING
Required

PurposeIndicates the cart id to the transaction you want to create.




Amount


The Parameter Tag/Nameamount
Example
$amount = 100.50
Data TypeDECIMAL
Required

PurposeIndicates the amount you want to void, either the full amount for a void or partial one for a release.
Validation RulesAccept only decimal amounts, which must be less than or equal to the authorized amount that has not been captured yet.




Description 


The Parameter Tag/Namedescription
Example
$description = "order description";
Data TypeSTRING
Required

PurposeIndicates the cart/order description at your end to easily relate this transaction to. It might contain the reason for the capture.



Sample Response Payload


To process a capture request, you have to pass a tran_type that MUST be void” and the transaction reference of the original authenticated "Auth" transaction that you want to void, as shown in the below sample:


$void = Paypage::void('tran_ref','order_id','amount','void description');
return $void;


Void requests are available for ONLY authenticated "Auth" transactions that are NOT fully captured yet.



Sample Response Payload

Generic


The response PayTabs will send to you will be a JSON object that contains the full details regarding this void transaction, as shown below:

 
{
"tran_ref": "TST2111100150608",
"tran_type": "Void",
"cart_id": "cart_11111",
"cart_description": "Void reason",
"cart_currency": "EGP",
"cart_amount": "100.00",
"customer_details": {
"name": "first last",
"email": "[email protected]",
"phone": "0522222222",
"street1": "address street",
"city": "dubai",
"state": "DU",
"country": "AE",
"ip": "196.219.145.121"
},
"payment_result": {
"response_status": "A",
"response_code": "G98948",
"response_message": "Authorised",
"transaction_time": "2021-04-21T09:55:48Z"
},
"payment_info": {
"card_type": "Credit",
"card_scheme": "Visa",
"payment_description": "4111 11## #### 1111"
}
}
Generic








⌂ To get familiar with the whole process and the other steps, kindly navigate to our "The Laravel Packge Integration Manual" solution article. 

 And to get familiar with the rest of the steps regarding the current step "Step 7 - Manage Transactions" kindly click here.

 And to navigate to the previous step in the integration process "Step 6 - Handle the post payment responses" kindly click here.