PhonePe PG JAVA SDK
Copied !
Class Initialisation for StandardCheckoutClient
StandardCheckoutClient class will be used to communicate with the PhonePe APIs. Merchant can create the instance only once per runtime; hence use the correct credentials while initializing the object.
Parameters :
Parameter Name | Data Type | Mandatory | Description |
---|---|---|---|
clientId | Integer | Yes | Client ID for secure communication with PhonePe. |
clientVersion | String | Yes | Client version for secure communication with PhonePe. |
clientSecret | String | Yes | Secret provided by PhonePe. To be kept secure on the merchant side. |
env | Env | Yes | Environment for the StandardCheckoutClient: Env.PRODUCTION (Production) Env.SANDBOX (Testing) |
Throws PhonePeException:
If another StandardCheckoutClient object is initialized, PhonePeException is thrown.
Example usage:
import com.phonepe.sdk.pg.Env;
import com.phonepe.sdk.pg.payments.v2.StandardCheckoutClient;
String clientId = "<clientId>";
String clientSecret = "<clientSecret>";
Integer clientVersion = 1; //insert your client version here
Env env = Env.SANDBOX; //Change to Env.PRODUCTION when you go live
StandardCheckoutClient client = StandardCheckoutClient.getInstance(clientId, clientSecret, clientVersion, env);