Sequence
- Payment Options
- Custom – NetBanking
Payment Options
This method is used to retrieve available payment options.
Parameters
Parameter | Type | Mandatory | Description |
---|---|---|---|
includeNetBankingBanksList | boolean | No | If set to True , the response will include the list of Net Banking banks. Default: False |
Example – Payment Options
const $MERCHANTID="<merchantId>";
const $SALTKEY="<saltKey>";
const $SALTINDEX="<saltIndex>";
const $env=Env::UAT;
const $SHOULDPUBLISHEVENTS=true;
$phonePePaymentsClient = new PhonePePaymentClient(MERCHANTID, SALTKEY, SALTINDEX, Env::UAT, SHOLDPUBLISHEVENTS);
$paymentOptionsResponse = $phonePePaymentsClient->paymentOptions(true);
Returns
The function returns a PgPaymentsOptionsResponse
object with the following properties:
PgPaymentsOptionsResponse Properties
Property | Type | Description |
---|---|---|
upiCollect | PaymentOption | UPI Collect options |
intent | PaymentOption | Intent options |
cards | PaymentOption | External cards options |
netBanking | PaymentOptionNetBanking | Net Banking options |
Custom – NetBanking
Builds PgPayRequest with NetBanking as the payment instrument.
Instrument Parameters
Parameter | Type | Mandatory | Description |
---|---|---|---|
bankId | mixed | Yes | The ID of the bank for Net Banking payment. You can find the possible values in PaymentOptions response with includeNetBankingBanksList=True |
Example (Custom – NetBanking)
const $MERCHANTID="<merchantId>";
const $SALTKEY="<saltKey>";
const $SALTINDEX="<saltIndex>";
const $env=Env::UAT;
const $SHOULDPUBLISHEVENTS=true;
$phonePePaymentsClient = new PhonePePaymentClient(MERCHANTID, SALTKEY, SALTINDEX, Env::UAT, SHOLDPUBLISHEVENTS);
// To get the bankList Id's and other payment options
$includeNetBankingBanksList = true;
$paymentOptionsResponse = $phonePePaymentsClient->paymentOptions($includeNetBankingBanksList);
$merchantTransactionId = "<merchantTRansactionId>";
$request = PgPayRequestBuilder::builder()
->mobileNumber("9090909090")
->callbackUrl("https://webhook.in/test ")
->merchantId(MERCHANTID)
->merchantUserId("<merchantUserId>")
->amount(<amountInPaise>)
->merchantTransactionId($merchantTransactionId)
->paymentInstrument(
InstrumentBuilder::getNetbankingInstrumentBuilder()
->bankId("HDFC")
->build()
)
->build();
$response = $phonePePaymentsClient->pay($request);
$url = $response->getInstrumentResponse()->getRedirectInfo()->getUrl();
Returns
The pay function returns a PgPayResponse object. With NetBankingInstrumentResponse object in data.
Sample Response
{
"success": true,
"code": "SUCCESS",
"message": "Your request has been successfully completed.",
"data": {
"upiCollect": {
"enabled": true
},
"intent": {
"enabled": true
},
"cards": {
"enabled": true
},
"netBanking": {
"enabled": true,
"popularBanks": [
{
"bankId": "ICIC",
"bankName": "ICICI Bank",
"bankShortName": "ICICI",
"available": "AVAILABLE",
"accountConstraintSupported": false,
"priority": 1
},
{
"bankId": "KVBL",
"bankName": "Karur Vysya Bank",
"bankShortName": "Karur",
"available": "AVAILABLE",
"accountConstraintSupported": false,
"priority": 2
},
{
"bankId": "LAVB",
"bankName": "Laxmi Vilas Bank",
"bankShortName": "Laxmi",
"available": "AVAILABLE",
"accountConstraintSupported": false,
"priority": 3
}
],
"allBanks": [
{
"bankId": "ICIC",
"bankName": "ICICI Bank",
"bankShortName": "ICICI",
"available": "AVAILABLE",
"accountConstraintSupported": false,
"priority": 1
},
{
"bankId": "KVBL",
"bankName": "Karur Vysya Bank",
"bankShortName": "Karur",
"available": "AVAILABLE",
"accountConstraintSupported": false,
"priority": 2
},
{
"bankId": "LAVB",
"bankName": "Laxmi Vilas Bank",
"bankShortName": "Laxmi",
"available": "AVAILABLE",
"accountConstraintSupported": false,
"priority": 3
}
]
}
}
}
Merchant’s should depend on the available parameter
- Indicates whether the bank is currently available for Net Banking transactions. Its value will be one of the following: ● AVAILABLE ● UNAVAILABLE ● DEGRADED
- Merchant’s should display the Bank to the user only if the available parameter has the value as “AVAILABLE” so avoid any know failures due to unavailability of the bank.