Woocommerce Paypal 错误“wc-ajax=ppc-create-order 上的 404”和“意外令牌”

Posted

技术标签:

【中文标题】Woocommerce Paypal 错误“wc-ajax=ppc-create-order 上的 404”和“意外令牌”【英文标题】:Woocommerce Paypal errors "404 on wc-ajax=ppc-create-order" And "unexpected token" 【发布时间】:2021-12-30 10:13:27 【问题描述】:

当我尝试使用贝宝付款时,我的 wordpress 网站出现了问题。 支付模式在屏幕上“闪烁”一会儿,然后我可以看到错误消息:“出现问题。请重试或选择其他支付来源。”

在浏览器的控制台中我可能会出现一些错误:

1- 此 ajax 网址返回 404:https://www.demosite.com/?wc-ajax=ppc-create-order2- 在 404 之后,可能与 404 相关,我看到另一个错误 create_order_error:“SyntaxError: Unexpected token ” p>

我正在尝试使用 paypal 沙盒来测试付款。 这是我的系统详细信息:

``### 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``

我已经尝试过的一些常见测试/解决方案:

更改主题以测试冲突 更新构成我网站的所有元素(wordpress、woocommerce、elementor) 尝试使用已登录或“尚未注册”的用户付款 尝试在本地服务器和使用 https 的 Web 服务器进行支付

请有人指出我正确的方向吗?我找不到解决办法。

【问题讨论】:

【参考方案1】:

https://www.demosite.com/?wc-ajax=ppc-create-order 正在返回 html 404 错误页面(以 < 开头,因为 HTML),而不是包含订单 ID 的有效 JSON 字符串(不能以 < 开头,而是以 ' 开头,就像 JSON 字符串一样)

您需要在 WooCommerce 中调试 404 的原因,在服务于该位置的代码的 PHP 级别。

【讨论】:

以上是关于Woocommerce Paypal 错误“wc-ajax=ppc-create-order 上的 404”和“意外令牌”的主要内容,如果未能解决你的问题,请参考以下文章

Paypal IPN 不适用于 woocommerce

Woocommerce + Payment (PayPal) - 安全更新订单状态 + 获取交易 ID

WooCommerce 中的“验证错误:PayPal 货币不匹配”

Paypal / Woocommerce -“检测到错误您的购物车是空的。”

WooCommerce 以错误的方式向 PayPal 发送商品

woocommerce paypal 高级身份验证错误