CARDS
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 | 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. |
Sample Request
public async Task<IActionResult> CustomPay()
{
var merchantOrderID = $"Order_{DateTime.UtcNow:yyyyMMddHHmmssfff}";
var metaInfo = MetaInfo.Builder()
.SetUdf1("xyz")
.Build();
var payRequest = PgPaymentRequest.CardPayRequestBuilder()
.SetMerchantOrderId(merchantOrderID)
.SetMerchantUserId("")
.SetAmount(100)
.SetCardHolderName("")
.SetAuthMode("3DS")
.SetEncryptionKeyId(12)
.SetEncryptedCvv("")
.SetEncryptedCardNumber("")
.SetExpiryMonth("")
.SetExpiryYear("")
.SetMetaInfo(metaInfo)
.SetExpireAfter(1200)
.Build();
_logger.LogInformation("Custom Pay Request:\n{Request}", JsonSerializer.Serialize(payRequest, JsonOptions.IndentedWithRelaxedEscaping));
try
{
var response = await _customCheckoutClient.Pay(payRequest);
_logger.LogInformation("Custom Pay Response:\n{Response}", JsonSerializer.Serialize(response, JsonOptions.IndentedWithRelaxedEscaping));
return Ok(response);
}
catch (Exception ex)
{
_logger.LogError(ex, "Custom Pay API Failed");
return StatusCode(500, new { message = ex.Message });
}
}
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 |