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.
This article is dedicated to walking you through how to initiate the payment/request payload using the configuration options and parameters that have already been clarified in the previous step, "Step 2 - Configure the integration method". Please follow the below steps to initiate a Hosted Payment Page via this package:
- First thing, you will need to include our "paypage" facade within your uses.
- Then, create an object from the "Paypage" class while passing payment, transaction, cart, URLs, customer, and shipping details to initiate a pre-filled payment page with your provided information. Then, in the end/tail, you MUST call the create_pay_page() function to initiate the payment page with the previously provided information.
use Paytabscom\Laravel_paytabs\Facades\paypage; $pay = paypage::sendPaymentCode($payment_method) ->sendTransaction($tran_type,$tran_class) ->sendCart($cart_id, $cart_amount, $cart_description) ->sendCustomerDetails($name, $email, $phone, $street1, $city, $state, $country, $zip, $ip) ->sendShippingDetails($same_as_billing, $name = null, $email = null, $phone = null, $street1= null, $city = null, $state = null, $country = null, $zip = null, $ip = null) ->sendHideShipping($on = false) ->sendURLs($return, $callback) ->sendLanguage($language) ->sendFramed($on = false) ->sendTokinse($status) ->sendToken($tran_ref,$token) ->create_pay_page(); // to initiate payment page
To get to know each function and its passed parameters, kindly check the below:
- Manage the Payment Methods (sendPaymentCode())
- Manage the Transaction Type (sendTransaction())
- Manage the Cart Details (sendCart())
- Manage Shipping and Billing Details (sendShippingDetails() & send customer details())
- Hide the Shipping Details (sendHideShipping())
- Manage the Return and Callback URLs (sendURLs())
- Manage the Payment Page Display Language (sendLanguage())
- Initiate an iFramed/Embedded Payment Page (sendFramed())
- Sending Customized Parameters (user-defined)
- Manage Tokenization (sendTokinse())
- Manage Token Based transactions (sendToken()))
- Troubleshooting Issues
⌂ 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 previous step "Step 2 - Configure the integration method" kindly click here.
⇦ And to get familiar with the rest of the steps regarding the current step "Step 3 - Initiating the payment" click here.
⇨ And to navigate to the next step in the integration process "Step 4 - Accepting the payment" kindly click here.