Paytabs provides you with a collection of API endpoints which used to process all payments, regardless of if they are through either your own payment pages, the managed payment pages, or if you are using the hosted payment pages. 




This article is dedicated to the clarification of the customer details parameters. The Customer Details also called Billing information is the customer/cardholder details that indicate the customer details for this payment. If provided, the payment page will be prefilled with the provided data. if you didn't pass this information the customer/cardholder will be required to enter these details on the payment page.


In this article, you will be going to know


Specifications 


The Parameter Tag/Namecustomer_details 
JSON Example
{
    "customer_details": {
    "name": "first last",
    "email": "[email protected]",
    "phone": "0522222222",
    "street1": "address street",
    "city": "dubai",
    "state": "du",
    "country": "AE",
    "zip": "12345"
    }
}
Data TypeObject
Required
Validation Rules
  •  To provide the customer details for the payment used as keys and values.
  • Can be empty.
  • If empty the payment page will ask the customer to fill out these details



Customer Details Object parameters:


Parameter
Data Type
Min
Max
Required

customer_details.name 

STRING 

4

128 

customer_details.email 

STRING 

Valid email format 

customer_details.phone 

STRING 

Valid number + country code prefix 

customer_details.street1 

STRING 

4

128 

customer_details.city 

STRING 

2

128 

customer_details.state 

STRING 

2 

2 

customer_details.country 

STRING 

ISO 3166-1 alpha-2 codes (two-letter country codes) 

customer_details.zip 

STRING 

Valid zip code 



Usage Workflow


Along with the required parameters mentioned in our Step 3 - PT2 API Endpoints | Initiating the payment solution article, you will need to set the customer details as shown below:


Sample Request Payload

   

{
    "profile_id": "987654",
    "tran_type": "sale",
    "tran_class": "ecom",
    "cart_id": "CART#1001",
    "cart_currency": "USD",
    "cart_amount": 500,
    "cart_description": "Description of the items/services",
"customer_details": {
        "name": "first last",
        "email": "[email protected]",
        "phone": "0522222222",
        "street1": "address street",
        "city": "dubai",
        "state": "du",
        "country": "AE",
         "zip": "12345"
    }
}


Sample Response Payload

    

{
    "tran_ref": "TST2231101374414",
    "tran_type": "Sale",
    "cart_id": "CART#1001",
    "cart_description": "Description of the items/services",
    "cart_currency": "USD",
    "cart_amount": "500.00",
    "return": "https://example.com/order/10001",
    "redirect_url": "https://secure-egypt.paytabs.com/payment/page/59***ED7",
    "customer_details":
    {
        "name": "first last",
        "email": "[email protected]",
        "phone": "0522222222",
        "street1": "address street",
        "city": "dubai",
        "state": "du",
        "country": "AE",
        "zip": "12345",
        "ip":"1.1.1.1"
    }
    "serviceId": 2,
    "profileId": 987654,
    "merchantId": 123456,
    "trace": "PMNT0404.6368BC3D.000BAF4C"
}



The Expected Parameter Behaviors


After passing the customer details the Pay Page will not ask the customer/cardholder to fill in any details.


The expected behaviors according to the passed value are:


  • Passing invalid values or missing parameters

    In case any of the details are missing or passed with invalid values; these details will be ignored and the cardholder will be required to enter any of the missing details on the payment page as shown below:





  • Edit the Customer/Billing details after passing it. 


    The customer still has the ability to edit the passed details on the Pay Page via clicking on Edit billing info tab, however you can present this using the