TOKEN
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<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. |
Sample Request
public async Task<IActionResult> CustomPay()
{
var merchantOrderID = $"Order_{DateTime.UtcNow:yyyyMMddHHmmssfff}";
var metaInfo = MetaInfo.Builder()
.SetUdf1("free-text-value-1")
.SetUdf2("free-text-value-2")
.SetUdf3("free-text-value-3")
.SetUdf4("free-text-value-4")
.SetUdf5("free-text-value-5")
.SetUdf6("free-text-value-6")
.SetUdf7("free-text-value-7")
.SetUdf8("free-text-value-8")
.SetUdf9("free-text-value-9")
.SetUdf10("free-text-value-10")
.SetUdf11("ref_11")
.SetUdf12("tag-12")
.SetUdf13("user@13")
.SetUdf14("code.14")
.SetUdf15("val+15")
.Build();
var payRequest = PgPaymentRequest.TokenPayRequestBuilder()
.SetMerchantOrderId(merchantOrderID)
.SetAmount(100)
.SetAuthMode("3DS")
.SetCardHolderName("<cardHolderName>")
.SetEncryptionKeyId(0)
.SetEncryptedToken("<encryptedToken>")
.SetEncryptedCvv("<encryptedCvv>")
.SetCryptogram("<cryptogram>")
.SetPanSuffix("<panSuffix>")
.SetExpiryMonth("08")
.SetExpiryYear("2050")
.SetRedirectUrl("<redirectUrl>")
.SetMetaInfo(metaInfo)
.SetExpireAfter(300)
.Build();
try
{
var response = await _customCheckoutClient.Pay(payRequest);
return Ok(response); // Extract response.RedirectUrl
}
catch (Exception ex)
{
_logger.LogError(ex, "Custom Pay API Failed");
return StatusCode(500, new { message = ex.Message });
}
}Response
Extract the redirectUrl from the response received.
| 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 |