Skip to content

Instantly share code, notes, and snippets.

@rsolomakhin
Created February 10, 2016 19:37
Show Gist options
  • Save rsolomakhin/d329fddab88cfcf54835 to your computer and use it in GitHub Desktop.
Save rsolomakhin/d329fddab88cfcf54835 to your computer and use it in GitHub Desktop.
if (!checkoutDetails.finished)
checkout.continue().then(finishCheckout);
else
checkout.finish(...);
var checkout = new Checkout();
checkout
.onEvent('shippingOptionChange', recalculateLineItems)
.show()
.then(finishCheckout);
// Returns line items with updated price/tax/etc based on the options that the user has selected in checkoutDetails.
function recalculateLineItems(checkoutDetails) {
...
}
// Requests the payment from the browser.
function finishCheckout(checkoutDetails) {
checkout.finish(...);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment