Create configuration
To configure the integration with the Split payments solution, you will need to create your application, request permissions from your users, and obtain the credentials. Keep reading to create the required configuration.
Create application
Create your application to integrate with the Split payments solution by following the steps below.
- Access Your Integrations. Once there, click on the Create application button, located in the upper right corner.
- Enter a name to identify your application (you have a limit of 50 characters).
- Choose the Online Payments solution.
- When choosing the product to integrate, you can select "Checkout Pro" or "Checkout API".
- Choose the Marketplace integration model.
- Once you have completed the requested information, click on Create application and you're done!
Configure the Redirect URL
In this step, it is necessary to configure the Redirect URL so that sellers can authorize the marketplace to carry out sales.
After creating the application, it is necessary to go to the editing screen to fill in the Redirect URL field (in OAuth requests, it is displayed as redirect_uri), which must contain the URL of the marketplace site where the seller's token will be sent upon completing the linking process.
Request permission from users
To request permission from your users to manage sales on their behalf, it is necessary to implement the authorization flow using OAuth. Follow the steps below:
- Redirect your users to the following URL to authorize sales management:
Value | Description |
<APP_ID> | Value obtained during application creation. |
<REDIRECT_URI> | Value entered in the Redirect URI field during Redirect URL configuration. |
curl
https://auth.mercadopago.com.ar/authorization?client_id=<APP_ID>&response_type=code&platform_id=mp&redirect_uri=<REDIRECT_URI>
- Once users authorize sales management, you will receive an authorization code in the URL you specified in the previous step. This code will be in the
code
parameter as follows:
curl
http://<REDIRECT_URI>?code=AUTHORIZATION_CODE
Obtain credentials
Use the authorization code obtained in the previous step to acquire user credentials through the OAuth API, enabling you to manage their sales.
Parameter | Description |
<CLIENT_ID> | Value of APP_ID obtained in the details of your application. |
<CLIENT_SECRET> | Your SECRET_KEY, also available in the details of your application. |
<AUTHORIZATION_CODE> | Authorization code obtained when redirecting the user back to your site. |
<REDIRECT_URI> | Should be the same Redirect URI configured in your application. |
<STATE> | Replace the "RANDOM_ID" value with an identifier that is unique for each attempt and does not include sensitive information so that you can identify who the received code is from. |
curl
curl -X POST \
-H 'accept: application/json' \
-H 'content-type: application/x-www-form-urlencoded' \
'https://api.mercadopago.com/oauth/token' \
-d 'client_id=<CLIENT_ID>' \
-d 'client_secret=<CLIENT_SECRET>' \
-d 'grant_type=authorization_code' \
-d 'code=<AUTHORIZATION_CODE>' \
-d 'redirect_uri=<REDIRECT_URI>' \
-d 'state=<RANDOM_ID>'
Response
json
{
"access_token": "SELLER_PAYER_TOKEN",
"public_key": "PUBLIC_KEY",
"refresh_token": "TG-XXXXXXXXX-XXXXX",
"live_mode": true,
"user_id": "COLLECTOR_ID DE PAGO",
"token_type": "bearer",
"expires_in": 15552000,
"scope": "offline_access payments write"
}
The response includes:
access_token
andpublic_key
of the linked seller.refresh_token
, which you should use to periodically renew the linkages.user_id
, equal to thecollector_id
used to capture payments.