Submitting the order to the API

At this point, we've successfully performed our own client-side validation of the checkout form, and validated the payment card details with the Stripe API. Therefore, we are ready to submit the order to our API for processing. The first thing we need to do is construct an object to represent the order using a mixture of data from the local checkout form component state, and the cart items array from the global store. Add the following object declaration:

stripe.createToken(card, details).then(result => {  if (result.error) {    this.loading = false;  } else {    const order = {      stripeToken: result.token.id,      firstName: this.firstName,      lastName: this.lastName,      address1: this.address,      address2: this.address2, townCity: ...

Get ASP.NET Core 2 and Vue.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.