Display Pay-me Flex
This is the final step, where you specify the DOM element in which the form should be rendered and define a callback function to be executed once the process is completed. As additional parameters, two extra callback functions can be included (they are not mandatory but allow you to obtain more detailed information about the process):
responseCallback: Executed when the process is completed (Authorized/Declined).trackingCallback: Executed for each event triggered during the process (e.g., click on pay, click on payment method, click on payment information, etc.).onErrorCallback: Executed when an error occurs during the process.
Mostrar Formulario de pago
function responseCallback(response){
console.log("-------Respuesta-------");
console.log({response});
}
function trackingCallback(trackdata) {
console.log("-------Tracking de Eventos-------");
console.log({trackdata});
}
function onErrorCallback(error) {
console.log("-------Error en el proceso-------");
console.log({error});
}
paymentForm.init(document.querySelector('#demo'), responseCallback, trackingCallback, onErrorCallback);
The {response} of the responseCallback function will be the same as the response returned by the API. API de Autorización - ecommerce | RESPONSE.