• Callback Response
  • Getting Started
    • Mobile Integration (Android/IOS)
      Enterprise Solutions
      Retail Solutions
      Accept Payments
      Process Payments
      Disbursals
      API References
      Refunds
      Guides
      Other links
      Mini Program Platform
  • Features for Investments PG
  • post OAuth Token API

    Use Case


    This api is used to generate a token corresponding to Paytm user. To generate the same use the authorization code received through FetchAuthCode method.

    Header

    ATTRIBUTE DESCRIPTION
    Authorizationstring
    mandatory
    This will be a base64 encoded string of client_id:client_secret
    Example: Basic bWVyY2hlBTSXllbkdGWU9Bdm9BYw==

    Request Attributes


    API Content Type: URL Encoded

    ATTRIBUTE DESCRIPTION
    grant_typestring
    mandatory
    authorization_code
    Possible Values: authorization_code
    scopestring
    mandatory
    Should be sent as Paytm
    Example: paytm
    codestring
    mandatory
    The authorization code received from in Custom UI SDK.
    Example: 999e3877-97c1-XXXX-b19d-6c8787983300
    client_idstring
    mandatory
    Client id as shared for the merchant

    Response Attributes


    API Content Type: URL Encoded

    Success Response

    ATTRIBUTE DESCRIPTION
    scopestring Scope of the token received
    Example: paytm
    access_tokenstring Received SSO token of the user
    Example: ae74f8b5-be5f-4503-XXXX-a60c9dcd3300
    expiresstring Expiry timer of the SSO token
    Example: 1594011297000

    Failure Response

    ATTRIBUTE DESCRIPTION
    errorstring This is the error corresponding to a particular error description and is returned to the merchant.
    Possible Values: Internal ErrorSomething went wrong, unsupported_grant_typeThe supported grant_type values are "authorization_code" and "refresh_token", invalid_grantThe authorization code is invalid
    error_descriptionstring This parameter is the error_description which contains information about the failure result.
    Note: If Authorization header is incorrect then the response will not come and you will face HTTP Status code "401"

    StagingProduction
    REQUESTRESPONSE
    curl --location --request POST 'https://accounts-uat.paytm.com/oauth2/v2/token' \
    --header 'Authorization:  Basic {BASE64_ENCODED_CLIENT_ID_AND_CLIENT_SECRET}' \
    --header 'Content-Type: application/x-www-form-urlencoded' \
    --data-urlencode 'grant_type=authorization_code' \
    --data-urlencode 'scope=paytm' \
    --data-urlencode 'code=999e3877-97c1-XXXX-b19d-6c8787983300'