AI resources

Restrict purchases to registered users only

Allows only users with a Mercado Pago account to make purchases in your Checkout Pro. When enabling this restriction, only authenticated customers will be able to access the checkout, log in and use the available payment methods to complete the purchase.

By adding this option, it will not be possible to receive payments from users not registered in Mercado Pago, as well as you will not be able to receive payments via cash or bank transfer.

Follow the steps below to configure the Mercado Pago account as the only payment method available in the checkout.

To restrict payments to users with a Mercado Pago account only, include the purpose parameter with the value wallet_purchase in the payment preference configuration. Below, see implementation examples using the Mercado Pago SDK for integration.

Mercado Pago Account mode works by adding the purpose attribute to the preference.

<?php
  $client = new PreferenceClient();
  $preference = $client->create([
    "items"=> array(
      array(
        "title" => "My product",
        "description" => "Test product",
        "picture_url" => "http://i.mlcdn.com.br/portaldalu/fotosconteudo/48029_01.jpg",
        "category_id" => "electronics",
        "quantity" => 1,
        "currency_id" => "BRL",
        "unit_price" => 100
      )
    ),
    "purpose"=> "wallet_purchase"
  ]);
  echo implode($preference);
?>

Mercado Pago Account mode works by adding the purpose attribute to the preference.

const client = new MercadoPagoConfig({ accessToken: '<ACCESS_TOKEN>' });

const preference = new Preference(client);

preference.create({ 
  body: {
    items: [
      {
        id: '<ID>',
        title: '<title>',
        quantity: 1,
        unit_price: 100
      }
    ],
    purpose: "wallet_purchase",
  }
}).then(console.log).catch(console.log);

Mercado Pago Account mode works by adding the purpose attribute to the preference.

// Create a preference object
PreferenceClient client = new PreferenceClient();

// Create an item in the preference
PreferenceItemRequest item =
  PreferenceItemRequest.builder()
    .title("My product")
    .quantity(1)
    .unitPrice(new BigDecimal("75"))
    .build();

List<PreferenceItemRequest> items = new ArrayList<>();
items.add(item);

PreferenceRequest request =
  PreferenceRequest.builder().items(items).purpose("wallet_purchase").build();

client.create(request);

Mercado Pago Account mode works by adding the purpose attribute to the preference.

sdk = Mercadopago::SDK.new('ENV_ACCESS_TOKEN')
# Create a preference object
preference_data = {
  items: [
    {
      title: 'My product',
      unit_price: 100,
      quantity: 1
    }
  ],
  purpose: 'wallet_purchase'
}
preference_response = sdk.preference.create(preference_data)
preference = preference_response[:response]

# This value will replace the string "<%= @preference_id %>" in your HTML
@preference_id = preference['id']

Mercado Pago Account mode works by adding the purpose attribute to the preference.

// Create the preference request object
var request = new PreferenceRequest
{
    Items = new List<PreferenceItemRequest>
    {
        new PreferenceItemRequest
        {
            Title = "My product",
            Quantity = 1,
            CurrencyId = "PEN",
            UnitPrice = 75m,
        },
    },
    Purpose = "wallet_purchase",
};
// Create the preference
var client = new PreferenceClient();
Preference preference = await client.CreateAsync(request);

Mercado Pago Account mode works by adding the purpose attribute to the preference.

preference_data = {
    "items": [
        {
            "title": "My product",
            "unit_price": 100,
            "quantity": 1
        }
    ],
    "purpose": "wallet_purchase"
}

preference_response = sdk.preference().create(preference_data)
preference = preference_response["response"]

Mercado Pago Account mode works by adding the purpose attribute to the preference.

import (
	"context"
	"fmt"
	"time"

	"github.com/mercadopago/sdk-go/pkg/config"
	"github.com/mercadopago/sdk-go/pkg/preference"
)

cfg, err := config.New("{{ACCESS_TOKEN}}")
if err != nil {
    fmt.Println(err)
}

client := preference.NewClient(cfg)

request := preference.Request{
	Items: []preference.ItemRequest{
		{
			Title:       "My product",
			UnitPrice:   100,
			Quantity:    1,
		},
	},
	Purpose: "wallet_purchase",
}

resource, err := client.Create(context.Background(), request)
if err != nil {
	fmt.Println(err)
	return
}

fmt.Println(resource)