To initiate a checkout object, Instance
is passed as an argument to the consuming function of the RevolutCheckout
promise (i.e. registered using .then
). It's used as the entry point to every payment option exposed by RevolutCheckout
e.g., to open a payment pop-up window, or create a card field.
Compared to the Payments
object, payment options related to the Instance
object require an order token (token
) to be created before checkout.
See an example initiating the payWithPopup
method:
type Instance = {
payWithPopup: InstancePayWithPopup;
createCardField: InstanceCreateCardField;
destroy: () => void;
};
RevolutCheckout("<token>").then(function (instance) {
instance.payWithPopup({
onSuccess() {
window.alert("Thank you!");
},
onError(message) {
window.alert("Oh no :(");
}
});
});