SDK details
Class Initialization
StandardCheckoutClient class will be used to communicate with the PhonePe APIs. You can initiate the instance of this class only once.
Use required credentials while initializing the object.
Parameters
Parameter Name | Data Type | Mandatory | Description |
---|---|---|---|
clientId | String | Yes | Client ID for secure communication with PhonePe. |
clientSecret | String | Yes | Secret provided by PhonePe. To be kept secure on the merchant side. |
clientVersion | Number | Yes | Client version for secure communication with PhonePe. |
env | Env | Yes | Environment for the StandardCheckoutClient: ‘PRODUCTION’ (production), ‘SANDBOX’ (testing). |
Throws PhonePeException
If another StandardCheckoutClient object is initialized, PhonePeException
is thrown.
Example Usage :
import { StandardCheckoutClient, Env } from 'pg-sdk-node';
const clientId = "<clientId>";
const clientSecret = "<clientSecret>";
const clientVersion = 1; //insert your client version here
const env = Env.SANDBOX; //change to Env.PRODUCTION when you go live
const client = StandardCheckoutClient.getInstance(clientId, clientSecret, clientVersion, env);