When the WooCommerce checkout is processed it requires that gateways return an array (which is then converted into JSON) telling the checkout whether or not it was successful. It’s been this way since v1.
In 2.4+ this was made more strict in that the response must be valid JSON. Anything else in the response (such as HTML, notices or whitespace) will invalidate this JSON and you may see an error along the lines of:
SyntaxError: Unexpected token
See a way to debug it in this blog post https://mikejolley.com/2015/11/12/debugging-unexpected-token-in-woocommerce-2-4/
I followed all the instructions on that blog post, disabled all the plug-ins, and it turned out that the JSON response was sending back an error instead of correctly formatted JSON. My response was:
<br />
<b>Notice</b>: Use of undefined constant CURLOPT_SSLVERSION - assumed 'CURLOPT_SSLVERSION' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Transport/PayPalRestCall.php</b> on line <b>57</b><br />
<br />
<b>Notice</b>: Use of undefined constant CURLOPT_CONNECTTIMEOUT - assumed 'CURLOPT_CONNECTTIMEOUT' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Transport/PayPalRestCall.php</b> on line <b>57</b><br />
<br />
<b>Notice</b>: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Transport/PayPalRestCall.php</b> on line <b>57</b><br />
<br />
<b>Notice</b>: Use of undefined constant CURLOPT_TIMEOUT - assumed 'CURLOPT_TIMEOUT' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Transport/PayPalRestCall.php</b> on line <b>57</b><br />
<br />
<b>Notice</b>: Use of undefined constant CURLOPT_USERAGENT - assumed 'CURLOPT_USERAGENT' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Transport/PayPalRestCall.php</b> on line <b>57</b><br />
<br />
<b>Notice</b>: Use of undefined constant CURLOPT_HTTPHEADER - assumed 'CURLOPT_HTTPHEADER' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Transport/PayPalRestCall.php</b> on line <b>57</b><br />
<br />
<b>Notice</b>: Use of undefined constant CURLOPT_SSL_VERIFYHOST - assumed 'CURLOPT_SSL_VERIFYHOST' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Transport/PayPalRestCall.php</b> on line <b>57</b><br />
<br />
<b>Notice</b>: Use of undefined constant CURLOPT_SSL_VERIFYPEER - assumed 'CURLOPT_SSL_VERIFYPEER' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Transport/PayPalRestCall.php</b> on line <b>57</b><br />
<br />
<b>Notice</b>: Use of undefined constant CURLOPT_SSL_CIPHER_LIST - assumed 'CURLOPT_SSL_CIPHER_LIST' in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Transport/PayPalRestCall.php</b> on line <b>57</b><br />
<br />
<b>Fatal error</b>: Call to undefined function PayPal\Core\curl_version() in <b>/var/www/html/wp-content/plugins/woocommerce-product-vendors/includes/gateways/paypal-php-sdk/paypal/rest-api-sdk-php/lib/PayPal/Core/PayPalHttpConfig.php</b> on line <b>65</b><br />
In my case, it was a problem with WooCommerce PayPal Pro payment gateway and WooCommerce Product Vendors because cURL was not installed by default on my DigitalOcean server. With WooCommerce Product Vendors, every time a customer places an order, the vendor gets paid commission with PayPal Mass Payments. In order for PayPal Mass Payment to work, you have to make sure that you enable Mass Payments on your PayPal account and to make sure the cURL is installed on your server.
As soon as I installed the cURL, it worked. Here is how to install cURL on DigitalOcean https://www.digitalocean.com/community/questions/curl-is-not-installed-in-your-php-installation
Hope this helps someone out there.