Hide element
See below how to hide Card Payment Brick elements.
Hide title and flags
Client-Side
Brick | Card Payment Form |
Customization moment | When rendering the Brick |
Property | customization.hideFormTitle |
Type | Boolean |
Comments | When true, hides the title line and accepted flags. |
const settings = {
...,
customization: {
visual: {
hideFormTitle: true
}
}
}
const customization = {
visual: {
hideFormTitle: true
}
};
Hide payment button
Client-Side
Brick | Card Payment Form |
Customization moment | When rendering the Brick |
Property | customization.visual.hidePaymentButton |
Type | Boolean |
Comments | When true, the form submit button is not displayed and it becomes necessary to use the getFormData function to get the form data (see example below). |
const settings = {
...,
callbacks: {
onReady: () => {
// callback called when brick is ready
},
onError: (error) => {
// callback called for all Brick error cases
},
},
customization: {
visual: {
hidePaymentButton: true
}
}
}
const customization = {
visual: {
hidePaymentButton: true
}
};
Since the default payment button has been hidden, you will need to add some replacement. The following code blocks exemplify how to implement your custom payment button.
html
<button type="button" onclick="createPayment();">Custom Payment Button</button>
Javascript
function createPayment(){
window.cardPaymentBrickController.getFormData()
.then((cardFormData) => {
console.log('cardFormData received, creating payment...');
fetch("/process_payment", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(cardFormData),
})
})
.catch((error) => {
// error handling when calling getFormData()
});
};