• Callback Response
  • Getting Started
    • Mobile Integration (Android/IOS)
      Enterprise Solutions
      Retail Solutions
      Accept Payments
      Process Payments
      API References
      Other links
      Mini Program Platform
  • Features for Investments PG
  • paytmFetchAuthCode JS API

    Use Case

    This API can be used to get AuthCode and OpenID for the user accessing the Mini Program. When merchants front-end calls this method, Paytm will show the user a popup asking for permission to share these details. If the user allows on the consent popup same will be shared with the merchants. If the user denies, ideal expectation is for Merchants to call the API again

    Please Note: No Manual Login from the user is allowed in the Paytm Mini Programs Platform.

    AuthCode:This is a one time use AuthCode passed by Paytm to the merchant’s Mini Program Frontend/client codebase via JS API. This has a validity of 5 mins and is for single use only. This code is required to fetch the Paytm AuthToken via S2S call with Paytm’s Oauth backend.

    OpenId: This is a unique user identifier passed by Paytm to Mini Program. It remains the same throughout the lifetime of the user.

    Request Attributes

    Content format: JSON

    ParameterDescriptionRequiredExample Value
    clientIdMerchant's client id received from paytmYesmerchant-xyz

    Response Attributes


    Note: Response will come as JSON with key data.

    ParameterDescriptionExample Value
    data.authIdauthId generated by paytmabhd-jhsd-ujyt-afrw
    data.openIdopenId generated by paytmabhdjhsd860154

    Error Responses:

    Note: Response will come as JSON with key data.

    ParameterDescriptionExample Value
    errorerror code in integers-3
    errorMessageerror messageInvalid clientID


    0"Unable to process your request"
    2"clientID not passed"
    -1"User denied consent"
    -2"user login failed"
    -3"Invalid clientID"
    -4"Invalid token"(Check Consent Status API failed)
    -5"Failed to save consent"
    -6"Invalid clientID"
    -7"Invalid token"(Fetch Authcode API failed)
    -8"Device Not Verified"
    -9"Invalid Authorisation"
    -10"Failed to fetch AuthCode"
    -11"user consent failure"
    -12"Invalid clientId"
    -13""Invalid SSO token""
    -14""Failed to fetch OpenID""

    Request CodeResponse JSON
                function ready (callback) {
                      // call if jsbridge is injected
                     if(window.JSBridge) {
                        callback && callback();
                       } else{// listen to jsbridge ready event
                       document.addEventListener('JSBridgeReady', callback, false);
    ready(function () {  JSBridge.call('paytmFetchAuthCode',{    clientId:"/*your reqClient ID*/"},    function(result) {     console.log(JSON.stringify(result))  });