Home
Documentation
Resources
Certifications
Community
Auxiliary callbacks - User interface - Mercado Pago Developers

Intelligent search powered by OpenAI 

Auxiliary callbacks

In order to offer more transparency and possibilities of acting in specific flows, we provide the option to add callbacks that will be executed in specific moments of the flow.

CallbackDescriptionWhen to use
onReadyCallback called when the button is fully loaded.Here you can hide loadings from your site, for example.
onSubmitCallback called on button click.This callback could be used to indicate to the user that the flow must be completed in another tab, for example. Supported in redirect mode.

See below for an example of how to integrate them into your integration.

          
mp.bricks().create("wallet", "wallet_container", {
   initialization: {
       preferenceId: "<PREFERENCE_ID>",
       redirectMode: "self",
   },
   callbacks: {
       onReady: () => {},
       onSubmit: () => {},
       onError: (error) => console.error(error),
     },
});

        
          
<Wallet
  initialization={{ preferenceId: '<PREFERENCE_ID>', redirectMode: 'self' }}
  onReady={() => {}}
  onError={() => {}}
  onSubmit={() => {}}
/>