NodeJs SDK – Class Initialization

Class Initialization

CustomCheckoutClient 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 NameData TypeMandatoryDescription
clientIdStringyesClient ID for secure communication with PhonePe.
clientSecretStringyesSecret provided by PhonePe. To be kept secure on the merchant side.
cientVersionIntegeryesClient version for secure communication with PhonePe.
envEnvyesEnvironment for the CustomCheckoutClient: 
‘PRODUCTION’ (production), 
‘SANDBOX’ (testing).


Throws PhonePeException

If another CustomCheckoutClient object is initialized, PhonePeException is thrown.

Example

import {CustomCheckoutClient, Env} 
from 'pg-sdk-node';
 

const clientId:string = "<clientId>";

const clientSecret:string = "<clientSecret>";

const clientVersion:string = "<clientVersion>";  //insert your client version here

const env:Env = Env.SANDBOX;      //change to Env.PRODUCTION when you go live
 

const client = CustomCheckoutClient.getInstance(clientId, clientSecret, clientVersion, env);
Is this article helpful?