# MD for: https://www.mercadopago.com.uy/developers/es/docs/checkout-pro/additional-settings/mp-wallet.md \# 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. > WARNING > > 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. ::::TabsComponent :::TabComponent{title="Configure via frontend SDK"} 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. * [csharp ](#editor%5F5) * [go ](#editor%5F7) * [java ](#editor%5F3) * [node ](#editor%5F2) * [php ](#editor%5F1) * [python ](#editor%5F6) * [ruby ](#editor%5F4) php node java ruby csharp python go Mercado Pago Account mode works by adding the _purpose_ attribute to the preference. ``` 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); ?> ``` Copiar Mercado Pago Account mode works by adding the _purpose_ attribute to the preference. ``` const client = new MercadoPagoConfig({ accessToken: '' }); const preference = new Preference(client); preference.create({ body: { items: [ { id: '', title: '', quantity: 1, unit_price: 100 } ], purpose: "wallet_purchase", } }).then(console.log).catch(console.log); ``` Copiar 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); ``` Copiar 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'] ``` Copiar 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 = "UYU", UnitPrice = 75m, }, }, Purpose = "wallet_purchase", }; // Create the preference var client = new PreferenceClient(); Preference preference = await client.CreateAsync(request); ``` Copiar 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"] ``` Copiar 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) ``` Copiar ::: :::TabComponent{title="Configure via API"} To restrict payments only to users with a Mercado Pago account, send a \*\*POST\*\* request to the endpoint :TagComponent{tag="API" text="/checkout/preferences" href="https://www.mercadopago.com.uy/developers/pt/reference/online-payments/checkout-pro/preferences/create-preference/post"} including the \`purpose\` parameter with the value \`wallet\_purchase\`. \`\`\`cURL curl -X POST \\ 'https://api.mercadopago.com/checkout/preferences'\\ -H 'Content-Type: application/json' \\ -H 'Authorization: Bearer TEST-484\*\*\*\*\*\*\*\*49456-07\*\*\*\*\*\*\*\*cb4fb5d7\*\*\*\*\*\*\*\*240915e1\*\*\*\*\*\*\*\*548830' \\ -d '{ "items": \[ { "id": "Sound system", "title": "Dummy Title", "description": "Dummy description", "picture\_url": "https://www.myapp.com/myimage.jpg", "category\_id": "car\_electronics", "quantity": 1, "currency\_id": "BRL", "unit\_price": 10 } \], "purpose": "wallet\_purchase", "payer": { "name": "John", "surname": "Doe", "email": "john@doe.com", "phone": { "area\_code": "11", "number": 988888888 }, "identification": { "type": "CPF", "number": "19119119100" }, "address": { "zip\_code": "06233200", "street\_name": "Example Street", "street\_number": 123 }, "date\_created": "2024-04-01T00:00:00Z" }, "payment\_methods": { "excluded\_payment\_methods": \[ { "id": "master" } \], "excluded\_payment\_types": \[ { "id": "ticket" } \], "default\_payment\_method\_id": "amex", "installments": 10, "default\_installments": 5 }, "shipments": { "local\_pickup": false, "dimensions": "32 x 25 x 16", "default\_shipping\_method": null, "free\_methods": \[ { "id": null } \], "cost": 20, "free\_shipping": false, "receiver\_address": { "zip\_code": "72549555", "street\_name": "Street address test", "city\_name": "São Paulo", "state\_name": "São Paulo", "street\_number": 100, "country\_name": "Brazil" } }, "back\_urls": { "success": "https://test.com/success", "pending": "https://test.com/pending", "failure": "https://test.com/failure" }, "notification\_url": "https://notificationurl.com", "additional\_info": "Discount 12.00", "auto\_return": "approved", "external\_reference": "1643827245", "expires": false, "expiration\_date\_from": "2022-11-17T09:37:52.000-04:00", "expiration\_date\_to": "2022-11-17T10:37:52.000-05:00", "marketplace": "NONE", "marketplace\_fee": 0, "differential\_pricing": { "id": 1 }, "tracks": \[ { "type": "google\_ad", "values": { "conversion\_id": 123, "conversion\_label": "abc", "pixel\_id": "abc" } } \], "metadata": null }' \`\`\` ::: ::::