Home > Back-end >  Woocommerce Paypal errors "404 on wc-ajax=ppc-create-order" And "unexpected token&quo
Woocommerce Paypal errors "404 on wc-ajax=ppc-create-order" And "unexpected token&quo

Time:11-20

in my wordpress site something gone wrong when i try to pay with paypal. The payment modal "blink" for a while on the screen and then i can see the error message: "Something went wrong. Please try again or choose another payment source."

In browser's console i can some errors :

1- this ajax url return a 404: https://www.demosite.com/?wc-ajax=ppc-create-order
2- after the 404 and maybe related to 404 i see another error create_order_error : "SyntaxError: Unexpected token < in JSON at position 0"

I'm trying to use paypal sandbox to test payments. Here there are my system details :

``### WordPress Environment ###

WordPress address (URL): https://www.demo.com
Site address (URL): https://www.demo.com
WC Version: 5.9.0
REST API Version: ✔ 5.9.0
WC Blocks Version: ✔ 6.1.0
Action Scheduler Version: ✔ 3.3.0
WC Admin Version: ✔ 2.8.0
Log Directory Writable: ✔
WP Version: 5.8.2
WP Multisite: –
WP Memory Limit: 1 GB
WP Debug Mode: –
WP Cron: ✔
Language: it_IT
External object cache: –

### Server Environment ###

Server Info: Apache
PHP Version: 7.4.24
PHP Post Max Size: 128 MB
PHP Time Limit: 900
PHP Max Input Vars: 1000
cURL Version: 7.76.1
OpenSSL/1.0.2k-fips

SUHOSIN Installed: –
MySQL Version: 5.7.32-35-log
Max Upload Size: 128 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

### Database ###

WC Database Version: 5.9.0
WC Database Prefix: wp_
Dimensione totale database: 13.93MB
Dimensione dati database: 11.61MB
Dimensione indice database: 2.32MB
wp_woocommerce_sessions: Dati: 0.02MB   indice: 0.02MB   motore InnoDB
wp_woocommerce_api_keys: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_woocommerce_attribute_taxonomies: Dati: 0.02MB   indice: 0.02MB   motore InnoDB
wp_woocommerce_downloadable_product_permissions: Dati: 0.02MB   indice: 0.06MB   motore InnoDB
wp_woocommerce_order_items: Dati: 0.02MB   indice: 0.02MB   motore InnoDB
wp_woocommerce_order_itemmeta: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_woocommerce_tax_rates: Dati: 0.02MB   indice: 0.06MB   motore InnoDB
wp_woocommerce_tax_rate_locations: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_woocommerce_shipping_zones: Dati: 0.02MB   indice: 0.00MB   motore InnoDB
wp_woocommerce_shipping_zone_locations: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_woocommerce_shipping_zone_methods: Dati: 0.02MB   indice: 0.00MB   motore InnoDB
wp_woocommerce_payment_tokens: Dati: 0.02MB   indice: 0.02MB   motore InnoDB
wp_woocommerce_payment_tokenmeta: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_woocommerce_log: Dati: 0.02MB   indice: 0.02MB   motore InnoDB
wp_actionscheduler_actions: Dati: 0.06MB   indice: 0.13MB   motore InnoDB
wp_actionscheduler_claims: Dati: 0.02MB   indice: 0.02MB   motore InnoDB
wp_actionscheduler_groups: Dati: 0.02MB   indice: 0.02MB   motore InnoDB
wp_actionscheduler_logs: Dati: 0.05MB   indice: 0.03MB   motore InnoDB
wp_commentmeta: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_comments: Dati: 0.02MB   indice: 0.09MB   motore InnoDB
wp_e_submissions: Dati: 0.02MB   indice: 0.27MB   motore InnoDB
wp_e_submissions_actions_log: Dati: 0.02MB   indice: 0.11MB   motore InnoDB
wp_e_submissions_values: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_links: Dati: 0.02MB   indice: 0.02MB   motore InnoDB
wp_options: Dati: 6.50MB   indice: 0.06MB   motore InnoDB
wp_postmeta: Dati: 3.52MB   indice: 0.31MB   motore InnoDB
wp_posts: Dati: 0.42MB   indice: 0.06MB   motore InnoDB
wp_termmeta: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_terms: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_term_relationships: Dati: 0.02MB   indice: 0.02MB   motore InnoDB
wp_term_taxonomy: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_usermeta: Dati: 0.22MB   indice: 0.23MB   motore InnoDB
wp_users: Dati: 0.02MB   indice: 0.05MB   motore InnoDB
wp_wc_admin_notes: Dati: 0.06MB   indice: 0.00MB   motore InnoDB
wp_wc_admin_note_actions: Dati: 0.02MB   indice: 0.02MB   motore InnoDB
wp_wc_category_lookup: Dati: 0.02MB   indice: 0.00MB   motore InnoDB
wp_wc_customer_lookup: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_wc_download_log: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_wc_order_coupon_lookup: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_wc_order_product_lookup: Dati: 0.02MB   indice: 0.06MB   motore InnoDB
wp_wc_order_stats: Dati: 0.02MB   indice: 0.05MB   motore InnoDB
wp_wc_order_tax_lookup: Dati: 0.02MB   indice: 0.03MB   motore InnoDB
wp_wc_product_meta_lookup: Dati: 0.02MB   indice: 0.09MB   motore InnoDB
wp_wc_reserved_stock: Dati: 0.02MB   indice: 0.00MB   motore InnoDB
wp_wc_tax_rate_classes: Dati: 0.02MB   indice: 0.02MB   motore InnoDB
wp_wc_webhooks: Dati: 0.02MB   indice: 0.02MB   motore InnoDB

### Post Type Counts ###

attachment: 78
elementor_library: 6
nav_menu_item: 8
page: 14
post: 2
product: 57
product_variation: 2
revision: 147
shop_order: 6

### Security ###

Secure connection (HTTPS): ✔
Hide errors from visitors: ✔

### Active Plugins (9) ###

Starter Templates: by Brainstorm Force – 2.7.0
Elementor Pro: by Elementor.com – 3.4.1
Elementor: by Elementor.com – 3.4.4
SSL Certificate Manager: by Akeysite.com – 1.0.0
Sticky Header Effects for Elementor: by Rwattner – 1.4.7
Themify - WooCommerce Product Filter: by Themify – 1.3.5
WooCommerce PayPal Payments: by WooCommerce – 1.6.1
WooCommerce: by Automattic – 5.9.0
WP Reset: by WebFactory Ltd – 1.93

### Inactive Plugins (2) ###

Akismet Anti-Spam: by Automattic – 4.1.12
Hello Dolly: by Matt Mullenweg – 1.7.2

### Settings ###

API Enabled: –
Force SSL: –
Currency: EUR (€)
Currency Position: right_space
Thousand Separator: .
Decimal Separator: ,
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)

Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)

Connected to WooCommerce.com: –

### WC Pages ###

Shop base: #7 - /?page_id=7
Carrello: #8 - /?page_id=8
Pagamento: #9 - /?page_id=9
Il mio account: #10 - /?page_id=10
Termini e condizioni: #231 - /?page_id=231

### Theme ###

Name: Astra
Version: 3.7.3 (aggiornamento alla versione 3.7.5 disponibile)
Author URL: https://wpastra.com/about/
Child Theme: ❌ – Se stai modificando WooCommerce o un tema genitore che non hai costruito personalmente
ti consigliamo di utilizzare un tema child. Vedi: Come creare un tema child

WooCommerce Support: ✔

### Templates ###

Overrides: –

### WooCommerce PayPal Payments ###

Onboarded: Yes
Shop country code: IT
PayPal card processing available in country: Yes
Pay Later messaging available in country: No
Vault enabled: Yes

### Action Scheduler ###

Completato: 144
Oldest: 2021-10-20 12:41:26  0200
Newest: 2021-11-19 15:45:54  0100


### Status report information ###

Generated at: 2021-11-19 16:26:35  01:00``

Some common tests/solutions i have already tried:

  • Change theme to test conflicts
  • Update all the elements that compose my site (wordpress,woocommerce,elementor)
  • Try to make a payment with a logged or a "not yet registered" user
  • Try to make a payment in a local server and a web server with https

Please can someone point me in the right direction? I can't find a solution.

CodePudding user response:

https://www.demosite.com/?wc-ajax=ppc-create-order is returning an HTML 404 error page (which begins with <, because HTML), instead of a valid JSON string containing an order ID (which must not begin with < but rather ', as JSON strings do)

You'll need to debug the reason for the 404 within WooCommerce, at the PHP level of the code that serves that location.

CodePudding user response:

You could ditch PayPal and look at saving money with a Level 3 Gateway plugin to Woocommerece. Depending on what you are selling, Transafe has some powerful options.
https://wordpress.org/plugins/transafe-payments-for-woocommerce/

  • Related