I have developed Payment Module for Magento 2.0 / 2.1, in these modules working fine with Registered users but when checkout as Guest there comes error "Please enter a customer email."
I have used below code under JS
/**
* Checkout for guest and registered customer.
*/
if (!customer.isLoggedIn()) {
serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/selected-payment-method', {
cartId: quote.getQuoteId()
});
payload = {
cartId: quote.getQuoteId(),
email: quote.guestEmail,
method: paymentData,
billingAddress: quote.billingAddress()
};
} else {
serviceUrl = urlBuilder.createUrl('/carts/mine/selected-payment-method', {});
payload = {
cartId: quote.getQuoteId(),
method: paymentData,
billingAddress: quote.billingAddress()
};
}
Please guide me to fix this issue,
Expertise are welcome!
Thank you.