Process OTP

This will complete the authentication and authorization. It takes OTP as input and returns the transaction response.

Request

TypeParamsValuesDescription
HEADERapi_keystring
EMBEDDEDidstringUnique id generated for the transaction in a generate OTP API call.
POSTchallenge_idstringChallenge id generated against the transaction in generating OTP API call.
answer.otpstringOTP to be sent for authenticating the transaction.
auto_capture[optional]stringOptional parameter. Send false if you want to capture at a later stage. The default is true.

Example

curl -X POST https://api.juspay.in/v2/txns/:id/authenticate \
-u your_api_key: \
-d "challenge_id=ch_xyz" \
-d "answer.otp=123456"

Response

{
  "id": "txn_035b4e708d5148478828ea3136a9efd7",
  "order_id": ":order_id",
  "txn_id": ":txn_id",
  "status": "CHARGED",
  "gateway": "RAZORPAY",
  "created": "2017-05-05T12:12:08Z",
  "resp_code": "00",
  "resp_message": "",
  "payment_info": {
    "payment_method_type": "CARD",
    "payment_method": "VISA",
    "card": {
    "last_four_digits": "",
    "card_isin": "400020",
    "expiry_month": "09",
    "expiry_year": "2020",
    "name_on_card": "",
    "card_type": "",
    "card_issuer": "",
    "card_brand": "VISA",
    "card_reference": "",
    "card_fingerprint": "37sug6sns7p8ubota3md74va3u",
    "using_saved_card": false,
    "saved_to_locker": false
    }
  },"payment"  : {
    "authentication": {
    "method": "POST",
    "url": "https://api.juspay.in/v2/txns/:id/authenticate",
    "params": {
            "id"                    : "8646a7a029974fa99995fec00340a507",
            "challenge_id"          : "ch_xyz",
            "auth_type"         : "OTP",
            "card_isin"             : "424242",
            "card_issuer_bank_name" : "AXIS BANK LTD",
            “submit_otp_allowed”    : true,
            “resend_otp_allowed”    : false,
            “fallback_url”          : "https://sandbox.juspay.in/v2/pay/start/guest/eul5g88vzCXbswrHYMh"

    }
    }
   },
  "payment_gateway_response": {
    "created": "2017-05-05T12:12:42Z",
    "txn_id": ":txn_id",
    "rrn": "",
    "epg_txn_id": ":epg_txn_id",
    "auth_id_code": "",
    "resp_code": "00",
    "resp_message": "",
    "gateway_response_map": {
    //gateway dependent response parameters
    }
  },
  "refunds":[ ]
}
{
  "id": "txn_035b4e708d5148478828ea3136a9efd7",
  "order_id": ":order_id",
  "txn_id": ":txn_id",
  "status": "AUTHENTICATION_FAILED",
  "gateway": "RAZORPAY",
  "created": "2017-05-05T12:12:08Z",
  "resp_code": "00",
  "resp_message": "",
  "payment"  : {
    "authentication": {
    "method": "POST",
    "url": "https://api.juspay.in/v2/txns/:id/authenticate",
    "params": {
            "id"                    : "8646a7a029974fa99995fec00340a507",
            "challenge_id"          : "ch_xyz",
            "auth_type"         : "OTP",
            "card_isin"             : "424242",
            "card_issuer_bank_name" : "AXIS BANK LTD",
            “submit_otp_allowed”    : true,
            “resend_otp_allowed”    : false,
            “fallback_url”          : "https://sandbox.juspay.in/v2/pay/start/guest/eul5g88vzCXbswrHYMh"

    }
    }
   },
  "payment_info": {
    "payment_method_type": "CARD",
    "payment_method": "VISA",
    "card": {
    "last_four_digits": "",
    "card_isin": "400020",
    "expiry_month": "09",
    "expiry_year": "2020",
    "name_on_card": "",
    "card_type": "",
    "card_issuer": "",
    "card_brand": "VISA",
    "card_reference": "",
    "card_fingerprint": "37sug6sns7p8ubota3md74va3u",
    "using_saved_card": false,
    "saved_to_locker": false
    }
  },
  "payment_gateway_response": {
    "created": "2017-05-05T12:12:42Z",
    "txn_id": ":txn_id",
    "rrn": "",
    "epg_txn_id": ":epg_txn_id",
    "auth_id_code": "",
    "resp_code": "00",
    "resp_message": "",
    "gateway_response_map": {
    //gateway dependent response parameters
    }
  },
  "refunds":[ ]
}
{ "status": "invalid_request_error",
  "error_code": "invalid",
  "error_message": "Invalid authentication account id."}
{ "status": "error",
  "error_code": "access_denied",
  "error_message": "Invalid Authentication"}
Response ParamsValuesDescription
idstringUnique id generated for the transaction.
order_idstringOrder Id provided by you while order creation.
txn_idstringTransaction id for a given order.
statusstringStatus of the transaction. If you receive “CHARGED”, then the transaction is successful. “AUTHORIZED” in case if auto_capture is false.
gatewaystringGateway through which authorization process was performed.
createdstringCreation date of transaction.
resp_codestringGateway response code for the transaction.
resp_messagestringError message from the gateway in case if the transaction failed.
payment_infoobjectThis contains the payment details provided during the transaction.
payment_gateway_responseobjectThis will give the payment response received from the gateway.
refundsarrayList of refunds attempted for a given transaction.

Did this page help you?