CARDS

Request Details

Parameter NameData TypeMandatoryDescription
merchantOrderIdStringyesUnique order ID generated by merchant
amountlongyesAmount of order in Paisa
contraintsListNoDifferent type of constraints that must be applied to the payment
authModeStringyesDefault to 3DS
encryptionKeyIdlongyesKeyId of key which merchant uses to encrypt card number & cvv.
encryptedCardNumberStringyesEncrypted 16-Digit Card Number entered by the user.
encryptedCvvStringyesEncrypted CVV of the card with which payment is being initiated.
cardHolderNameStringNoCard Holder Name
expiryMonthStringyesToken expiry month
expiryYearStringyesToken expiry year
merchantUserIdStringNoThe unique identifier of the merchant user. It is used to associate the payment with a specific user.

Example :

import {CustomCheckoutClient, Env} 
from 'pg-sdk-node'
import { PgPaymentRequest, PgPaymentResponse } 
from 'pg-sdk-node';
import { v4 
as uuid } 
from 'uuid';
 

const clientId:
string = "<clientId>";

const clientSecret:
string = "<clientSecret>";

const clientVersion:number = 1;  //insert your client version here

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

const client = CustomCheckoutClient.
getInstance(clientId, clientSecret, clientVersion, env);
 

const merchantOrderId = 
uuid();

const amount = 100;

const encryptionKeyId = 1;

const authMode = '<AUTH_MODE>';

const encryptedCardNumber = '<ENCRYPTED_CARD_NUMBER>';

const encryptedCvv = '<ENCRYPTED_CVV>';

const cardHolderName = '<CARD_HOLDER_NAME>';

const expiryYear = '<EXPIRY_YEAR>';

const expiryMonth = '<EXPIRY_MONTH>';

const redirectUrl = 'https://redirecturl.com';

const merchantUserId = '<MERCHANT_USER_ID>';
 

const request = PgPaymentRequest.
CardPayRequestBuilder()
  .
merchantOrderId(merchantOrderId)
  .
amount(amount)
  .
encryptionKeyId(encryptionKeyId)
  .
encryptedCvv(encryptedCvv)
  .
authMode(authMode)
  .
merchantUserId(merchantUserId)
  .
encryptedCardNumber(encryptedCardNumber)
  .
cardHolderName(cardHolderName)
  .
expiryMonth(expiryMonth)
  .
expiryYear(expiryYear)
  .
build();
 
client.
pay(request).
then((response) => {
  
const redirectUrl = response.redirectUrl;
});

Extract the redirectUrl from the response received

Response Details

PropertyTypeDescription
orderIdStringOrder Id created by PhonePe
stateStringState of the order. Initially it will be PENDING.
expireAtLongOrder expire date in epoch
redirectUrlStringRedirect url to perform the transaction

Is this article helpful?