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 Card Details (card_details) parameter. "card_details " is one of the mandatory parameters exclusively for the Own-Form that the request should have, which indicates the card details.


Specifications 


The Parameter Tag/Namecard_details
JSON Example
{ 
    "card_details": {
        "pan": "4111111111111111",
        "cvv": "123",
        "expiry_month": 12,
        "expiry_year": 2022
    }
}
JavaScript
Data TypeObject
Required

exclusively with Own-Form integration type
Validation Rules

Accept only valid card details.




Card Details Object parameters:


Parameter
Data Type
Min
Max
Required

card_details.pan 

STRING 

16

-

card_details.cvv 

STRING 

Valid CVV/CVC

card_details.expiry_month 

INTEGER

Valid expiry month between 01-12 

card_details.expiry_year 

INTEGER

Valid expiry year




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 "card_details" as shown below:



Sample Request Payload

{
    "profile_id": {{profile_id}},
    "tran_type": "sale",
    "tran_class": "ecom",
    "cart_id": "cart_77777",
    "cart_currency": "{{currency}}",
    "cart_amount": 12.3,
    "cart_description": "Description of the items/services",
    "paypage_lang": "en",
    "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"
    },
    
    "card_details": {
        "pan": "4111111111111111",
        "cvv": "123",
        "expiry_month": 12,
        "expiry_year": 2022
    }
}

Sample Response Payload

{
    "tran_ref": "TST2033600019179",
    "tran_type": "Sale",
    "cart_id": "cart_11111",
    "cart_description": "Description of the items/services",
    "cart_currency": "AED",
    "cart_amount": "12.3",
    "return": "https://webhook.site/92ac6a52-256d-434b-bde8-94b1e73d3aa1",
    "redirect_url": "https://secure.paytabs.com/payment/page/00C5499B82E406E003415A157D77D5FD9CBCCE3E537AD06E5865E7CA/redirect",
    "customer_details": {
        "name": "first last",
        "email": "[email protected]",
        "phone": "0522222222",
        "street1": "address street",
        "city": "dubai",
        "state": "DU",
        "country": "AE",
        "ip": "1.1.1.1"
    },
    "shipping_details": {
        "name": "name1 last1",
        "email": "[email protected]",
        "phone": "971555555555",
        "street1": "street2",
        "city": "dubai",
        "state": "DU",
        "country": "AE",
        "ip": "2.2.2.2"
    },
    "payment_info": {
        "card_type": "Credit",
        "card_scheme": "Visa",
        "payment_description": "4000 00## #### 0002"
    }
}