Ensure PayPal shoppers provide first and last name

Account-based storefronts have an additional requirement for shoppers who use PayPal as their payment method.

Specifically, an account-based storefront must ensure that the shopper provides a first and last name before clicking the PayPal button on the Checkout page.

To understand this requirement, it is helpful to have some context. When the PayPal button is clicked, a request is made to create an order. To pass validation, this request can either:

  • Include a complete and valid address for the shopper, or
  • Contain no address information for the shopper (the expectation in this case is that the shopper will provide complete address information after going through the PayPal process and returning to the Commerce storefront to complete the order).

Either case is acceptable and will pass validation. The issue for an account-based storefront is that every contact has a partial address, in the form of the address provided for the contact’s parent account, that does not include a first and last name. Using this partial address when attempting to create the order causes a validation error.

The best method for ensuring that a shopper provides a first and last name before clicking the PayPal button depends on your storefront’s requirements. Note that the first and last name requirement exists only for the Checkout page. The Cart page, which also has a PayPal button, does not have the same restriction because it never passes an address when it makes the create order request (because the shopper has no way of entering address information on the Cart page).