AI resources
Create agreement

This endpoint allows creating an agreement between buyer and seller, generating an authorization link to be sent to the buyer so the seller can access their Mercado Pago wallet and process payments. In case of success, the request will return a response with status 201.

POST

https://api.mercadopago.com/v2/wallet_connect/agreements
Request parameters
Header
Authorization
string

REQUIRED

Access Token obtained through the developer panel. Must be sent in all requests.
Query
client.id
string
Unique identifier of the client application.
Body
return_uri
string

REQUIRED

URI to which the buyer will be redirected after completing the agreement flow. It must match a URI previously registered for the application and accepts up to 2048 characters.
external_flow_id
string

REQUIRED

Seller's internal identifier for the current flow state, used to correlate the agreement result with the purchase session in your system. Accepts up to 64 characters.
external_user
object
Data used by the seller to identify the buyer within their own system.
agreement_data
object
Additional data about the agreement, including optional amount and description.
Response parameters
agreement_id
string
Unique identifier of the agreement.
agreement_uri
string
URI to redirect the buyer to complete the wallet linking flow in the frontend.
Errors

400Request error.

RedirectUriMismatch

The redirect URI does not match the one registered for this application. Check the value sent in return_uri and confirm that it is registered in your application settings.

ReturnUriNull

The return_uri field is required and was not provided. Make the request again including it.

ExternalFlowIdTooLong

The external_flow_id value exceeds the maximum allowed length of 64 characters. Reduce the size of the identifier sent.

ReturnUriTooLong

The return_uri value exceeds the maximum allowed length of 2048 characters. Reduce the size of the URI sent.

ExternalUserNull

The external_user field is required and was not provided. Make the request again including the buyer's identifier in your system.

AgreementDataDescriptionInvalid

The agreement_data.description value is invalid. Check the content sent and respect the 256-character limit.

403Forbidden.

forbidden

You don't have permission to access the requested resource. Check whether the Access Token used has the permissions and scopes required for this operation.

500Generic error.

internal_error

An internal server error occurred. Please try again later. If the problem persists, contact support and provide the x-request-id and details about the operation performed.

Request
curl -X POST \
    'https://api.mercadopago.com/v2/wallet_connect/agreements?client.id=<CLIENT_ID>'\
    -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer APP_USR-1*********550113-12*********b4773884a*********e8df16347*********786' \
    -d '{
  "return_uri": "https://www.mercadopago.com/",
  "external_flow_id": "EXTERNAL_FLOW_ID",
  "external_user": {
    "id": "usertest",
    "description": "Test account"
  },
  "agreement_data": {
    "validation_amount": 24.5,
    "description": "Test agreement"
  }
}'
Response
{
  "agreement_id": "22abcd1235ed497f945f755fcaba3c6c",
  "agreement_uri": "https://www.mercadopago.com.pe/wallet-connect/vinculation/onboarding?22abcd1235ed497f945f755fcaba3c6c"
}