CARDS
Request
| 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 | 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. |
encryptedCardNumber | String | yes | Encrypted 16-Digit Card Number entered by the user. |
encryptedCvv | String | yes | Encrypted CVV of the card with which payment is being initiated. |
cardHolderName | String | No | 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 pkg from '@phonepe-pg/pg-sdk-node';
const { CustomCheckoutClient, Env, MetaInfo, CustomCheckoutPayRequest } = pkg;
import { v4 as uuid } from 'uuid';
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 = CustomCheckoutClient.getInstance(clientId, clientSecret, clientVersion, env);
const merchantOrderId = uuid();
const amount = 100;
const encryptionKeyId = 1;
const authMode = '3DS'; // Accepted values: 3DS, QUICK_CHECK_OUT, H2H, SI_MANDATE, DEBIT_PIN
const encryptedCardNumber = '<ENCRYPTED_CARD_NUMBER>';
const encryptedCvv = '123';
const cardHolderName = 'CARD HOLDERNAME';
const expiryYear = '2029';
const expiryMonth = '12';
const redirectUrl = 'https://redirecturl.com';
const merchantUserId = 'dummyuser';
const metaInfo = MetaInfo.builder()
.udf1("free-text-value-1")
.udf2("free-text-value-2")
.udf3("free-text-value-3")
.udf4("free-text-value-4")
.udf5("free-text-value-5")
.udf6("free-text-value-6")
.udf7("free-text-value-7")
.udf8("free-text-value-8")
.udf9("free-text-value-9")
.udf10("free-text-value-10")
.udf11("ref_11")
.udf12("tag-12")
.udf13("user@13")
.udf14("code.14")
.udf15("val+15")
.build();
const request = CustomCheckoutPayRequest.CardPayRequestBuilder()
.merchantOrderId(merchantOrderId)
.amount(amount)
.encryptionKeyId(encryptionKeyId)
.encryptedCvv(encryptedCvv)
.authMode(authMode)
.merchantUserId(merchantUserId)
.encryptedCardNumber(encryptedCardNumber)
.cardHolderName(cardHolderName)
.expiryMonth(expiryMonth)
.expiryYear(expiryYear)
.metaInfo(metaInfo)
.build();
client.pay(request).then((response) => {
const orderId = response.orderId;
const state = response.state;
const redirectUrl = response.redirectUrl;
console.log("Order ID:", orderId);
console.log("Payment State:", state);
console.log("Redirect URL:", 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 |