AI resources

Opening mode

The opening scheme allows you to define how the checkout will open for the user. By default, Checkout Bricks is opened in a redirect way, that is, with user redirection within the same page. However, it is possible to customize the opening so that the opening is on an external page.

Pay attention to the back_urls configuration when creating the preference, as they guide the return flow to your website when the checkout is completed. Do not use local domains for this value (such as 'localhost/' or '127.0.0.1' with or without a specified port). We recommend using a server with a named domain (DNS) or development IPs. For more details, see the Callback URLs section.

Redirection scheme to another page

Changing the redirection behavior is done by the redirectMode property, which can assume the values self or blank.

ValorDescrição
selfKeeps the redirect on the same page.
blankExternalizes the redirect to a new page.
The code blocks below implement checkout in redirect mode to another page.
const renderComponent = async (bricksBuilder) => {
 const settings = {
   initialization: {
     preferenceId: '<PREFERENCE_ID>',
     redirectMode: 'blank'
   }
 };
 const brickController = await bricksBuilder.create(
   'wallet',
   'wallet_container',
   settings
 );
};
renderComponent (bricksBuilder);
<Wallet initialization={{ preferenceId: '<PREFERENCE_ID>', redirectMode: 'blank' }} />