Checkout
When using Credova as a 'payment method', the order can only be triggered and placed after confirming that the application status of SIGNED was sent back to your system via Credova's callback notification OR by checking that the Application status is SIGNED via the status endpoint.
Either way, it is important to check if the ApplicationId on the data package returned above was already used for another confirmed order in your system. If it is already being used, please take the required steps to notify the customer and/or cancel the order.
Once the users are able to pre-qualify and see the available financing options, the next step is to add our financing platform as a payment option in your website.
The checkout process involves some backend and frontend work. It starts with a call to our API from your backend passing the user data and the products from the cart to create an application. If your request is successful, the API will return a publicId
that you can use to open the checkout popup from within your website page while keeping the user on your site. Next, you can then get a confirmation response once the user completes the Credova process and the contract is SIGNED.
Open the checkout popup
To open the checkout popup you only have to call the checkout
method passing the publicId
returned by the API.
CRDV.plugin.checkout("the-public-id");
The popup will guide the user throughout the checkout process.
The checkout
method returns a promise that you can use to check if the user completed the process or closed the popup.
The checkout
promise should not be used to trigger an order internally. The promise is best used to trigger certain consumer interactions or
communication based on whether or not the consumer has successfuly moved through the entire checkout process or closed the checkout for
any reason.
CRDV.plugin.checkout("the-public-id").then(function(completed) {
if (completed) {
console.log("Checkout was completed");
} else {
console.log("Checkout was closed");
}
});
As a reminder, an order should only be created once the application status has been received as SIGNED via the callback notification or status endpoint.
Example: Opening the popup
You can use this HTML code to test the checkout
method. Just copy/paste this code in a file and save it on your computer.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CRDV</title>
</head>
<body>
<script src="https://plugin.credova.com/plugin.min.js"></script>
<script>
CRDV.plugin.config({ environment: CRDV.Environment.Sandbox, store: "ARV000" });
CRDV.plugin.checkout("the-public-id").then(function(completed) {
if (completed) {
console.log("Checkout was completed");
} else {
console.log("Checkout was closed");
}
});
</script>
</body>
</html>
The checkout
method will use options defined in plugin configuration