Skip to main content

Manage Shipping and Billing Details

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 article is dedicated to walking you through how to manage/manipulate both shipping and billing/customer information in the Laravel package, as shown below:

you should know
Through out the article we will use the same concept clarified in our How to remove/hide the billing/shipping information? solution article.





Code Sample:

Those two methods indicate the customer/billing details and shipping details for the initiated payment. Only if provided the payment page will be prefilled with these data.

sendCustomerDetails($name, $email, $phone, $street1, $city, $state, $country, $zip, $ip)
sendShippingDetails($name, $email, $phone, $street1, $city, $state, $country, $zip, $ip)
Be Aware

The customer details are still required and must be passed, in case any of the details are missing or passed with invalid values; the cardholder will be required to enter any of the missing details on the payment page




Method Parameters:

The following parameters are required to be sent within the function but optional to be sent within the sendShippingDetails function, as shown below:



Customer Details:

Parameter
customer_details
DescriptionIndicates the customer details for this payment. If provided, the payment page will be prefilled with the provided data.
To know more about this parameter please click here.
Data TypeOBJECT
Required
Sample
{
"customer_details": {
"name": "first last",
"email": "[email protected]",
"phone": "0522222222",
"street1": "address street",
"city": "dubai",
"state": "du",
"country": "AE",
"zip": "12345"
}
}
customer_details's Nested Parameters
Nested ParameterData TypeMinMaxRequired
name
STRING3128
email
STRINGN/AN/A
phone
STRINGN/AN/A
street1
STRING3128
city
STRING3128
state
STRING22
country
STRINGN/AN/A
zip
STRINGN/AN/A

Shipping Details:

Parameter
shipping_details
DescriptionIndicates the customer shipping details for this payment. If provided, the payment page will be prefilled with the provided data..
Data TypeOBJECT
Required
Sample
{
"shipping_details": {
"name": "first last",
"email": "[email protected]",
"phone": "0522222222",
"street1": "address street",
"city": "dubai",
"state": "du",
"country": "AE",
"zip": "12345"
}
}
shipping_details's Nested Parameters
Nested ParameterData TypeMinMaxRequired
name
STRING3128
email
STRINGN/AN/A
phone
STRINGN/AN/A
street1
STRING3128
city
STRING3128
state
STRING22
country
STRINGN/AN/A
zip
STRINGN/AN/A



Expected payment flow behaviour:


  1. As a merchant you would initiate a payment request per the above Specifications, which include a sample code.

  2. Then, you will call the method create_pay_page() and return the result to redirect the customer to the payment page.

    try {
    $paymentPage = paypage::sendTransaction('sale','ecom')
    ->sendCart("Order_101", 1000.00, 'Order Description')
    ->create_pay_page();

    return $paymentPage;

    } catch (\Exception $e) {
    // Handle errors appropriately
    return back()->with('error', 'Payment initiation failed: ' . $e->getMessage());
    }

  3. After this, your customer would proceed normally with payment by choosing the preferred payment method (if available), and providing his card information.

    Payment Page

  4. Then, he will be redirected to his issuer bank 3DS/OTP page to authenticate the used card

  5. Finally, he would be redirect to a success/error page accordingly. By this time, you will be able to see his transaction on your merchant dashboard, whether it's accepted/authorized or not.transaction view

    transaction view

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.