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 payment_methods(payment_methods) parameter along with kNET workflow. "payment_methods" is one of the optional parameters that the request could have, which initiates the payment page with one or more specific payment methods, which must be configured first in your profile.

By setting the Payment method parameter with kNET value, you are requesting to create a payment page with kNET as the only available payment method.


In this article, you will be going to know:



Specifications 


The Parameter Tag/Namepayment_methods
JSON Example
{
"payment_methods": [
"knet"
],
}
Data Typean array of valid payment methods
Required



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


  • Selecting only kNET

    You can send the value "knet" to only kNET payment methods on the payment page.
    {
    "payment_methods": [ "knet"],
    }

  • Multiple Payment Methods Including kNET

    To initiate a payment page with multiple specific payment methods, you can pass a comma-separated string with all the preferred payment methods, as shown below: 
    {
         "payment_methods": ["creditcard", "knet"]
    }
    // or
    {
         "payment_methods": ["creditcard", "knet", "applepay"]
    }
    
    


  • Excluding kNET

    You can initiate a payment page with all the configured payment methods, excluding one method or more from being displayed in the payment by adding (-) before the excluded payment method, as shown below:
    {
         "payment_methods": ["all", "-knet"]
    }
    // or
    {
         "payment_methods": ["all", "-knet", "-applepay"]
    }



Sample Request Payload

{
     "profile_id": "987654",
     "tran_type": "sale",
     "tran_class": "ecom",
     "cart_id": "CART#1001",
     "cart_currency": "KWD",
     "cart_amount": 500,
     "cart_description": "Description of the items/services",
     
     "payment_methods": ["knet"]
}



Sample Response Payload

{
     "tran_ref": "TST2232001383974",
     "tran_type": "Sale",
     "cart_id": "CART#1001",
    "cart_description": "Description of the items/services",
    "cart_currency": "KWD",
    "cart_amount": "500.00",
    "tran_currency": "",
    "tran_total": "0",
    "return": "none",
    "redirect_url": "https://secure-egypt.paytabs.com/payment/page/5987375382E410C088F3CE0CDB6E13A0A864AE069E87AB5EBE646BF5",
    "serviceId": 2,
    "profileId": 81784,
    "merchantId": 31237,
     "trace": "PMNT0403.6374F24A.00004935"
}



The Expected Behaviors


The payment_methods parameter is optional; not passing it within the payment page request payload would be the same as passing the "all" value (as a default), which would create a payment page with all the available payment methods for the merchant profile.

However, passing only the "knet" value have two expected payment page scenario based on the shipping and billing details.



Paytabs requires the billing address, if the addres was not sent within the request, Paytabs would show the billing address form on the payment page to be filled by the customer (cardholder).
Also, by default shipping address form would be showing up in the payment page to be filled by the customer if not sent within the request. However, unlike the billing address, shipping address is not required, and you can ask paytabs witin the reuqest to not show the shipping address form on the payment page.
Please check the following resources for better understanding:
- Request Parameters | Customer Details
Request Parameters | Shipping Details
Request Parameters | Hide Shipping 



kNET with customer_details sent


If the customer details or shipping address was NOT needed on the payment page, the customer would be directed to the kNET payment page instantly without any in-between pages.






kNET with no customer_details


If the customer details or shipping address was needed on the payment page, an in-between page will show up to add missing data.




Then, After submitting the billing and/or shipping details form, The customer would be redirected to the kNET payment page