TOKEN
Request Details
| Parameter Name | Data Type | Mandatory | Description |
|---|---|---|---|
merchantOrderId | String | yes | Unique order ID generated by merchant |
amount | long | yes | Amount of order in Paisa |
contraints | List<InstrumentConstraint> | No | Different type of constraints that must be applied to the payment |
authMode | String | yes | Default to 3DS |
encryptionKeyId | long | yes | KeyId of key which merchant uses to encrypt card number & cvv. |
encryptedToken | String | yes | Encrypted TOKEN number which merchant passes to process card transaction |
encryptedCvv | String | yes | Encrypted CVV of the card with which payment is being initiated. |
cryptogram | String | yes | The cryptogram fetched from the gateway where the card was tokenized. |
panSuffix | String | yes | Last four digits of card number |
cardHolderName | String | yes | Card Holder Name |
expiryMonth | String | yes | Token expiry month |
expiryYear | String | yes | Token expiry year |
merchantUserId | String | No | The 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 encryptedCvv = '<ENCRYPTED_CVV>';
const authMode = '<AUTH_MODE>';
const panSuffix = '<PAN_SUFFIX>';
const cryptogram = '<CRYPTOGRAM>';
const encryptedToken = '<ENCRYPTED_TOKEN>';
const merchantUserId = '<MERCHANT_USER_ID>';
const cardHolderName = '<CARD_HOLDER_NAME>';
const redirectUrl = 'https://redirecturl.com';
const expiryYear = '<EXPIRY_YEAR>';
const expiryMonth = '<EXPIRY_MONTH>';
const request = PgPaymentRequest.
TokenPayRequestBuilder()
.
merchantOrderId(merchantOrderId)
.
amount(amount)
.
encryptionKeyId(encryptionKeyId)
.
encryptedCvv(encryptedCvv)
.
authMode(authMode)
.
panSuffix(panSuffix)
.
cryptogram(cryptogram)
.
encryptedToken(encryptedToken)
.
merchantUserId(merchantUserId)
.
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
| Property | Type | Description |
|---|---|---|
orderId | String | Order Id created by PhonePe |
state | String | State of the order. Initially it will be PENDING. |
expireAt | Long | Order expire date in epoch |
redirectUrl | String | Redirect url to perform the transaction |