1. Creating the access token

ℹ️

Get 3DS credentials for each environment

  • Production environment

Get the credentials with Support.

  • Sandbox environment

For testing in the sandbox, use:

ClientId: dba3a8db-fa54-40e0-8bab-7bfb9b6f2e2e

ClientSecret: D/ilRsfoqHlSUChwAMnlyKdDNd7FMsM7cU/vo02REag=

To gain access to Cielo services that use Cielo Oauth, you will need to obtain an access token, following the steps below:

  1. Concatenate the ClientId and ClientSecret, **ClientId:ClientSecret**;
  2. Encode the result in Base64;
  3. Send the token creation request using the HTTP POST method.

Example of Concatenation

FIELDSFORMAT
ClientIddba3a8db-fa54-40e0-8bab-7bfb9b6f2e2e
ClientSecretD/ilRsfoqHlSUChwAMnlyKdDNd7FMsM7cU/vo02REag=
ClientId:ClientSecretdba3a8db-fa54-40e0-8bab-7bfb9b6f2e2e:D/ilRsfoqHlSUChwAMnlyKdDNd7FMsM7cU/vo02REag=
Base64ZGJhM2E4ZGItZmE1NC00MGUwLThiYWItN2JmYjliNmYyZTJlOkQvaWxSc2ZvcUhsU1VDaHdBTW5seUtkRE5kN0ZNc003Y1Uvdm8wMlJFYWc9

Authentication follows the Basic Authentication standard, so the Authorization field will be filled with the following value:

Basic YjUyMWI2YjItYjliNC00YTMwLTg4MWQtM2I2M2RlY2UwMDA2OjA4UWtqZTc5TndXUng1QmRnTkpzSWtCdUlUdDVjSVZP

Request

EnvironmentMethodEndpoint
Sandboxposthttps://mpisandbox.braspag.com.br/v2/auth/token
Produçãoposthttps://mpi.braspag.com.br/v2/auth/token
{
  "EstablishmentCode": ,
  	"MerchantName":,
  	"MCC":
}
curl
--request POST "https://mpisandbox.braspag.com.br/v2/auth/token"
--header "Content-Type: application/json"
--header "Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
--data-binary
--verbose
{
     "EstablishmentCode": ,
    	 "MerchantName": ,
    	 "MCC":
}

Body parameters

ParameterDescriptionTypeSize
EstablishmentCodeAcquirer merchant identifierNumeric10 positions
MerchantNameMerchant name as registered with the acquirer.Alphanumericup to 25 positions
MCCMerchant Category Code. MCC code registered with the acquirer.Numeric4 positions

Response

{
  "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjbGllbnRfbmFtZSI6IlFBXzNEU19BdXRoZW50aWNhdG9yIiwiY2xpZW50X2lkIjoiZGJhM2E4ZGItZmE1NC00MGUwLThiYWItN2JmYjliNmYyZTJlIiwic2NvcGVzIjoie1wiU2NvcGVcIjpcIjNEU0F1dGhlbnRpY2F0b3JcIixcIkNsYWltc1wiOlt7XCJOYW1lXCI6XCJNZXJjaGFudE5hbWVcIixcIlZhbHVlc1wiOFwiVmFsdWVzXCI6W1wiNTU1NVwiXX0se1wiTmFtZVwiOlwiUmVmZXJlbmNlSWRcIixcIlZhbHVlc1wiOltcImY3MjE1YmQ3LWM0OTQtNGQ5Yi1NzEyfQ.daMqXko3dZOV0TzNFQ2vSsVSKqOsrwuswg7RB82ecAASSSSSSSSSSSSFFFFFFFFFFFFFGGGGGGGGGGGGGGGGGGGGGGGG",
  "token_type": "barear",
  "expires_in": "86399"
}
--header "Content-Type: application/json"
--data-binary
{
      "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJjbGllbnRfbmFtZSI6IlFBXzNEU19BdXRoZW50aWNhdG9yIiwiY2xpZW50X2lkIjoiZGJhM2E4ZGItZmE1NC00MGUwLThiYWItN2JmYjliNmYyZTJlIiwic2NvcGVzIjoie1wiU2NvcGVcIjpcIjNEU0F1dGhlbnRpY2F0b3JcIixcIkNsYWltc1wiOlt7XCJOYW1lXCI6XCJNZXJjaGFudE5hbWVcIixcIlZhbHVlc1wiOFwiVmFsdWVzXCI6W1wiNTU1NVwiXX0se1wiTmFtZVwiOlwiUmVmZXJlbmNlSWRcIixcIlZhbHVlc1wiOltcImY3MjE1YmQ3LWM0OTQtNGQ5Yi1NzEyfQ.daMqXko3dZOV0TzNFQ2vSsVSKqOsrwuswg7RB82ecAASSSSSSSSSSSSFFFFFFFFFFFFFGGGGGGGGGGGGGGGGGGGGGGGG",
      "token_type": "barear",
      "expires_in": "2018-07-23T11:29:32"
}
ParameterDescriptionType
access_tokenToken required to continue with authenticationAlphanumeric
token_typeFixed "Bearer"Alphanumeric
expires_inToken expiration time (seconds)Numeric
ℹ️

The access_token created at this step should be parameterized in Class mapping in field bpmpi_accesstoken.

⚠️

Attention

  • For each 3DS authentication, it is necessary to obtain and provide a new access token;
  • Testing in the sandbox environment via Postman: When performing tests, enter the ClientId and ClientSecret directly in Postman. The tool will automatically encode these credentials in Base64 for authentication.