Skip to main content

Initiating the payment

PayTabs provides you with the backend packages that make the integrating with PayTabs payment gateway very easy by providing ready-made classes that handle the payment process.

This manual 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 method, transaction type/class, 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:

/app/Http/Controllers/PayTabsController.php
<?php
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Paytabscom\Laravel_paytabs\Facades\paypage;

class PayTabsController extends Controller
{

public function initiatePayment(Request $request)
{

//your code here

$pay = paypage::sendPaymentCode($payment_method) //required
->sendTransaction($tran_type,$tran_class) //required
->sendCart($cart_id, $cart_amount, $cart_description) //required
->sendCustomerDetails($name, $email, $phone, $street1, $city, $state, $country, $zip, $ip)
->sendShippingDetails($name, $email, $phone, $street1, $city, $state, $country, $zip, $ip)
->shipping_same_billing() //If you call this method then remove sendShippingDetails() method
->sendHideShipping(false)
->sendURLs($return, $callback)
->sendLanguage($language)
->sendFramed(false)
->sendTokinse($status)
->sendToken($tran_ref,$token)
->sendUserDefined(["udf1"=>"UDF1", "udf2"=>"UDF2", "udf3"=>"UDF3"])
->create_pay_page(); // to initiate payment page
}
}


We are glad to be always in help. We aim to serve you better each time. As such, please spare a minute to share feedback about your recent experience with PayTabs Developers , on Trustpilot, or Google Reviews.