# MD for: https://www.mercadopago.com.ar/developers/pt/docs/checkout-api-payments/integration-configuration/integrate-mp-wallet.md \# Mercado Pago Account The option to pay with Mercado Pago Wallet, by default, is presented in all Mercado Pago Checkouts in combination with guest user payments (no login). > NOTE > > In addition to the options available in this documentation, it is also possible to integrate payments with \*\*Mercado Pago Account\*\* using the \*\*Wallet Brick\*\*. Check \[Default rendering\](https://www.mercadopago.com.ar/developers/en/docs/checkout-bricks/wallet-brick/default-rendering#editor\_2) documentation of Payment for more details. This option allows users registered in Mercado Pago and/or Mercado Livre to log in and use the available methods to make their payments, in addition to being able to include new payment options, such as credit cards. It is possible to pay with \*\*card\*\*, \*\*available balance\*\* and Cuotas sin Tarjeta in a safe and optimized environment, increasing the chances of converting sales, in addition to allowing the seller to only offer payments with wallet. With this, the option to pay without logging in will not exist, however, it will contribute to an increase in the conversion of payments. > 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 Wallet as a payment method. > SERVER\_SIDE > > h2 > > Create preference If you are a user and want all your payments to be made via Wallet, you can determine this via an attribute in the preferences API. To create a preference, use one of the SDKs below. > In addition to the SDKs, it is also possible to create a preference through the preferences API. For that, send a \*\*POST\*\* with the parameter \`purpose\` and the value \`wallet\_purchase\` to the endpoint \[/checkout/preferences\](https://www.mercadopago.com.ar/developers/en/reference/online-payments/checkout-pro/preferences/create-preference/post) and execute the request or, if you prefer, use one of the SDKs below. * [csharp ](#editor%5F5) * [java ](#editor%5F3) * [node ](#editor%5F2) * [php ](#editor%5F1) * [python ](#editor%5F6) * [ruby ](#editor%5F4) php node java ruby csharp python Wallet mode works by adding the _purpose_ attribute to the preference. ``` title = 'My product'; $item->quantity = 1; $item->unit_price = 75; $preference->items = array($item); $preference->purpose = 'wallet_purchase'; $preference->save(); ?> ``` Copiar Wallet mode works by adding the _purpose_ attribute to the preference. ``` // Create a preference object let preference = { items: [ { title: 'My product', unit_price: 100, quantity: 1, } ], purpose: 'wallet_purchase' }; Mercadopago.preferences.create(preference) .then(function(response){ global.id = response.body.id; }).catch(function(error){ console.log(error); }); ``` Copiar Wallet 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(); MercadoPagoConfig.setAccessToken("YOUR_ACCESS_TOKEN"); List items = new ArrayList<>(); items.add(item); PreferenceRequest request = PreferenceRequest.builder().items(items).purpose("wallet_purchase").build(); client.create(request); ``` Copiar Wallet 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 Wallet mode works by adding the _purpose_ attribute to the preference. ``` // Create the preference request object var request = new PreferenceRequest { Items = new List { new PreferenceItemRequest { Title = "My product, quantity = 1, CurrencyId = "ARS", UnitPrice = 75m, }, }, Purpose = "wallet_purchase", }; // Create the preference var client = new PreferenceClient(); Preference preference = await client.CreateAsync(request); ``` Copiar ``` 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 \> CLIENT\_SIDE > > h2 > > Add checkout After creating the preference in the backend, it will be necessary to install the Mercado Pago frontend SDK to the project to add the payment button. The installation is done in \*\*two steps\*\*: \*\*including the Mercado Pago SDK\*\* to the project with its configured credentials and \*\*initiating checkout\*\* from the preference generated previously. To do this, follow the steps listed below. 1\. To include the MercadoPago.js SDK, add the code below to the project's HTML or install it via NPM as indicated in the examples below. * [bash ](#editor%5F8) * [html ](#editor%5F7) html bash ``` ``` Copiar ``` npm install @mercadopago/sdk-js ``` Copiar Next, initialize the integration by setting your \[public key\](https://www.mercadopago.com.ar/developers/en/docs/checkout-pro/resources/credentials) using the following code. * [html ](#editor%5F9) * [javascript ](#editor%5F10) html javascript ``` ``` Copiar ``` import { loadMercadoPago } from "@mercadopago/sdk-js"; await loadMercadoPago(); const mp = new window.MercadoPago("YOUR_PUBLIC_KEY"); ``` Copiar Once this is done, it is necessary to create a container to define the location where the button will be inserted on the screen. The container is created by inserting an element into the HTML code of the page where the component will be rendered. > NOTE > > The value displayed below in the \*\*ID property\*\* is just an example and can be changed, but it must always match the ID indicated in the rendering step. * [html ](#editor%5F11) html ```
``` Copiar 2\. After completing the previous step, initialize your checkout using the ID of the preference previously created with the identifier of the element where the button should be displayed. * [javascript ](#editor%5F12) javascript ``` mp.bricks().create("wallet", "wallet_container", { initialization: { preferenceId: "", }, }); ``` Copiar When creating a payment it is possible to receive 3 different statuses: \`Pending\`, \`Rejected\` and \`Approved\`. To keep up with updates, you need to configure your system to receive payment notifications and other status updates. See \[Notifications\](https://www.mercadopago.com.ar/developers/en/docs/checkout-api-payments/additional-content/your-integrations/notifications) for more details.