Submit a card OTP for a payment reference.
Use this endpoint to submit the card OTP for a payment. txnid is not a request field — a verified OTP returns txnStatus, mihpayid, and the message "OTP verified successfully".
POST
/partner/submitCardOtp
Environment
| Environment | URL |
|---|---|
| Test Environment | https://test-partnerapilayer.payu.in/apilayer/partner/submitCardOtp |
| Production Environment | https://api.payu.in/partner/submitCardOtp |
Sample Request
curl -X POST https://test-partnerapilayer.payu.in/apilayer/partner/submitCardOtp \
-H "Content-Type: application/json" \
-H "Authorization: Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123" \
-d '{
"merchant_id": 8739528,
"reseller_id": "11ed-933c-ece48d50-a41d-023f883eb17c",
"hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"reference_id": "REFERENCE_ID",
"otp": "123456"
}'import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class PartnerRequest {
public static void main(String[] args) throws Exception {
String body = "{\"merchant_id\": 8739528, \"reseller_id\": \"11ed-933c-ece48d50-a41d-023f883eb17c\", \"hash\": \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\", \"reference_id\": \"REFERENCE_ID\", \"otp\": \"123456\"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://test-partnerapilayer.payu.in/apilayer/partner/submitCardOtp"))
.header("Content-Type", "application/json")
.header("Authorization", "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}import requests
url = "https://test-partnerapilayer.payu.in/apilayer/partner/submitCardOtp"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123"
}
payload = {
"merchant_id": 8739528,
"reseller_id": "11ed-933c-ece48d50-a41d-023f883eb17c",
"hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"reference_id": "REFERENCE_ID",
"otp": "123456"
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://test-partnerapilayer.payu.in/apilayer/partner/submitCardOtp",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"merchant_id\": 8739528, \"reseller_id\": \"11ed-933c-ece48d50-a41d-023f883eb17c\", \"hash\": \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\", \"reference_id\": \"REFERENCE_ID\", \"otp\": \"123456\"}",
CURLOPT_HTTPHEADER => ["Content-Type: application/json", "Authorization: Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123"],
CURLOPT_RETURNTRANSFER => true,
]);
echo curl_exec($curl);
curl_close($curl);const response = await fetch("https://test-partnerapilayer.payu.in/apilayer/partner/submitCardOtp", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123"
},
body: JSON.stringify({
"merchant_id": 8739528,
"reseller_id": "11ed-933c-ece48d50-a41d-023f883eb17c",
"hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"reference_id": "REFERENCE_ID",
"otp": "123456"
})
});
console.log(await response.text());using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://test-partnerapilayer.payu.in/apilayer/partner/submitCardOtp");
request.Headers.TryAddWithoutValidation("Authorization", "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123");
request.Content = new StringContent("{\"merchant_id\": 8739528, \"reseller_id\": \"11ed-933c-ece48d50-a41d-023f883eb17c\", \"hash\": \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\", \"reference_id\": \"REFERENCE_ID\", \"otp\": \"123456\"}", System.Text.Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());require "net/http"
require "json"
uri = URI("https://test-partnerapilayer.payu.in/apilayer/partner/submitCardOtp")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer d4e5f6a7b8c90123456789abcdef0123456789abcdef0123456789abcdef0123"
request.body = {"merchant_id": 8739528, "reseller_id": "11ed-933c-ece48d50-a41d-023f883eb17c", "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "reference_id": "REFERENCE_ID", "otp": "123456"}.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
puts response.body
Mandatory ParametersParameters marked with * are mandatory.
| Parameter | Description |
|---|---|
Content-Type* | string Send the body as application/json. |
Authorization* | string Partner access token. Send as Authorization Bearer token. |
merchant_id* | integer Merchant id. |
reseller_id* | string Reseller id. |
hash* | string Hash. |
reference_id* | string PayU reference id for the in-progress card transaction. |
otp* | string Otp. |
Sample Response
{
"status": "success",
"attemptsLeft": 2,
"isSupported": true,
"txnStatus": "success",
"mihpayid": "403993715521855092",
"message": "OTP verified successfully"
}| Parameter | Description |
|---|---|
status | success when the OTP is verified. A failure uses failed. |
attemptsLeft | Attempts left after the OTP is accepted or rejected. |
isSupported | Returned with the OTP result. The sample value is true. |
txnStatus | Returned when the OTP is verified. The sample value is success. |
mihpayid | PayU payment id returned when the OTP is verified. |
message | OTP verified successfully. |
Errors
Below are the failure scenarios.
reference_id is mandatory
{
"errors": [
"reference_id is mandatory."
]
}Reason: This error occurs when reference_id is not included in the request.
Recommended Fix: Include the reference_id parameter in the request and retry.
Invalid OTP
{
"status": "failed",
"message": "Invalid OTP",
"attemptsLeft": 2
}Reason: This error occurs when the OTP in the request does not match.
Recommended Fix: Send the OTP the customer received and retry.
Invalid Auth token
{
"error": "Invalid Auth token"
}Reason: This error occurs when the auth token is missing or invalid.
Recommended Fix: Generate a new auth token and send it in the Authorization header.
