NetBanking

Use the pay() method to initiate a payment via NetBanking.

Request Parameters
Parameter NameData TypeMandatoryDescription
merchantOrderIdStringYesUnique merchant order id generated by merchant.
amountLongYesOrder amount in paisa.
contraintsListYesDifferent type of constraints that must be applied to the payment.
bankIdStringYesBank id from where payment will be completed.
Sample Request
import com.phonepe.sdk.pg.common.models.request.PgPaymentRequest;
import java.util.UUID;
import com.phonepe.sdk.pg.Env;
import com.phonepe.sdk.pg.payments.v2.CustomCheckoutClient;
import com.phonepe.sdk.pg.common.models.response.PgPaymentResponse;
 
String clientId = "<clientId>";
String clientSecret = "<clientSecret>";
Integer clientVersion = clientVersion;  //insert your client version here
Env env = Env.SANDBOX;      //change to Env.PRODUCTION when you go live
 
CustomCheckoutClient customCheckoutClient = CustomCheckoutClient.getInstance(clientId, clientSecret,
        clientVersion, env);
 
String merchantOrderId = UUID.randomUUID().toString();
long amount = 100;
String bankId = "HDFC";
 
PgPaymentRequest pgPaymentRequest = PgPaymentRequest.NetBankingPayRequestBuilder()
        .merchantOrderId(merchantOrderId)
        .amount(amount)
        .bankId(bankId)
        .build();
 
PgPaymentResponse pgPaymentResponse = customCheckoutClient.pay(pgPaymentRequest);
String redirectUrl = pgPaymentResponse.getRedirectUrl();

Extract the redirectUrl from the response received.

Field NameData TypeDescription
orderIdStringPG generated internal order id.
stateStringState of the order created, initially it will be PENDING.
expiryAtLongOrder expiry date in epoch (in milliseconds).
redirectUrlStringRedirect url to perform the NetBanking for mentioned bankId
Is this article helpful?