• 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
  • getAccessToken API

    Use Case


    Using this API merchant can get the access token corresponding to a Auth Code (received from the App side in earlier step). For the same merchant backend needs to make a S2S call with Paytm backend. This token can be used to fetch the User details in the getUserInfo API.


    Request Attributes

    API Content format: JSON

    Head

    AttributeDescriptionMandatory
    AuthorizationThis is a base64 encoded string of “clientId:clientSecret”Yes

    Body

    AttributeDescriptionExample
    grant_typeauthorization_codeauthorization_code
    codeAuth code you get in response from paytmFetchAuthCode bridgerwtw-fsdfk-vcvx-tweq
    client_idClient ID provided during onboarding your mini programmerchant-abc
    scopescope of the mini programbasic

    Response Attributes

    Head

    AttributeDescriptionExample
    statusstatus of response200

    Success:

    ParameterDescriptionExample Value
    scopescope of the mini programpaytm
    access_tokenaccess token of the user sent by paytm7522b293-cad6-4ed8-bdc6-7c3bc3637100
    expiresexpiration time1570465786000
    resourceOwnerIdResource owner IDXXXXXXX

    Error Responses:

    ParameterDescriptionExample Value
    errorerror nameInternal error
    error_descriptionerror messageSomething went wrong

    ERROR CODES

    StatusError
    400Internal Error
    400unsupported_grant_type
    400invalid_grant
    401NO RESPONSE BODY


    Endpoints

    UAT: https://accounts-uat.paytm.com/oauth2/v2/token

    Production: https://accounts.paytm.com/oauth2/v2/token

    Request CodeResponse JSON
    curl -X POST 'https://accounts.paytm.com/oauth2/v2/token'  
               --header 'Content-Type: application/x-www-form-urlencoded'            --header 'cache-control: no-cache'            --header 'Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l'            --data 'grant_type=authorization_code&code=rwtw-fsdfk-vcvx-tweq&client_id=mmerchant-abc&scope=basic'