Home
Documentation
Resources
Certifications
Community

Resources

Check for updates on our solutions and system performance, or request technical support.

Community

Get the latest news, ask others for help and share your knowledge.

Update data - Advanced features - Mercado Pago Developers

Intelligent search powered by OpenAI 

Update data

To update data in Card Payment Brick, we provide the update method through the Controller. When called, the update method will update the provided data while preserving the current instance of the Brick.

Data available for updating:

FieldTypeDescriptionValidation
amountnumberPayment amount.Before updating the amount, the Brick checks if the new value is greater than or equal to the minimum value allowed by the payment method selected by the user.
If the validation is successful, the update method will return true. Otherwise, it will return false.
          
let amount = 95;
cardPaymentBrickController.update({ amount });

        
          
import Card, { useCardPaymentBrick } from '@mercadopago/sdk-react';

const App = () => {
  const { update } = useCardPaymentBrick();

  return (
    <>
      <button type="button" onClick={() => update({ amount: 95 })}>
        Update amount
      </button>

      <Card
        initialization={{ amount: 100 }}
        onSubmit={async (param) => {
          console.log(param);
        }}
      />
    </>
  );
};

export default App;