Request: Payment Methods (payment_methods)
PayTabs Technical Portal 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 parameter behaving differently according to the integration type you are using (Managed Form, and Own Form).
Why you should use the parameter
This article is dedicated to the clarification of the payment_methods parameter. "payment_methods" is one of the optional parameters that the request should have, which initiates the payment page with one or more specific payment methods, which should be configured first in your profile.
Specifications
Parameter |
| Data Type | Array |
---|---|---|---|
Required | ❌ | ||
Validation Rules | Pass one or more of the following list: creditcard amex mada urpay unionpay stcpay stcpayqr valu aman meezaqr omannet knet knetdebit knetcredit applepay samsungpay installment forsa halan tamara amaninstallments souhoola tabby touchpoints paypal sadad | ||
Description | To initiate the payment page with one or more specific payment methods, which should be configured first in your profile and then set array of the valid payment methods. To know more about this parameter please click here. | ||
Code Sample |
|
Workflow Sequence
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:
All available Payment Methods
You can send the value "all" to show all available/configured payment methods on your PayTabs account on the payment page.
{
"payment_methods": ["all"]
}
This is the default value. In other words, not passing this parameter at all will be the same as passing this "all" value.
Multiple Payment Methods
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", "valu"] // same as ["all", "-valu", "-aman"]
}
Excluding Payment Methods
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", "-applepay"]
}
Sample Request and Response Payload
- Sample Request Payload
- Sample Response Payload
{
"profile_id": "987654",
"tran_type": "sale",
"tran_class": "ecom",
"cart_id": "CART#1001",
"cart_currency": "SAR",
"cart_amount": 500,
"cart_description": "Description of the items/services",
"payment_methods": ["creditcard", "valu"]
}
{
"tran_ref": "TST2232001383974",
"tran_type": "Sale",
"cart_id": "CART#1001",
"cart_description": "Description of the items/services",
"cart_currency": "SAR",
"cart_amount": "500.00",
"tran_currency": "",
"tran_total": "0",
"return": "none",
"redirect_url": "https://secure.paytabs.sa/payment/page/5987375382E410C088F3CE0CDB6E13A0AXXXXXXXXXXXXXXXXXXXXX",
"serviceId": 2,
"profileId": 81XXX,
"merchantId": 31XXX,
"trace": "PMNT0403.6374F24A.0000XXXX"
}
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.
Payment methods is depending on transaction classes and currencies. For example, Mada doesn't support recurring, and ValU is only supported for EGP transactions.
- Hosted Payment Page
- Invoice
- PayLinks
- Managed Form
- Own From
The Payment Page Have Multiple Payment Methods"
Details
The Payment Page Have One Payment Method
Each payment method had its own payment page view experience, as clarified in the samples below:
Credit Cards
CreditCard: | creditcard |
Amex: | amex |
mada: | mada |
UnionPay: | unionpay |
OmanNet Debit: | omannet |
KnPay: | knet |
KnPay (Debit): | knetdebit |
KnPay (Credit): | knetcredit |
Wallet
UrPay: | urpay |
StcPay: | stcpay |
StcPay(QR): | stcpayqr |
Meeza (QR): | meezaqr |
ApplePay: | applepay |
SamsungPay: | samsungpay |
PayPal: | paypal |
Cash
Aman: | aman |
Sadad: | sadad |
Installments
NBE installment: | installment |
Aman installments: | amaninstallments |