Step 3 - Laravel Package | Initiating the payment

Modified on Wed, Apr 17, 2024 at 1:44 PM

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:










⌂ 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.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article