我用简单的代码在主题中创建了一个自定义模板: 已有ID为2636的订单
<?php
get_header();
$paypal_order_init = new WC_Gateway_Paypal();
$paypal_order_init -> process_payment(2636);
get_footer();
一旦有人转到此页面,他必须使用付款表格(带有传递的订单数据)重定向到Paypal网站。我无法重定向到贝宝付款表单的主要问题。我检查了日志并获得了以下信息:
2018-09-30T13:13:15+00:00 INFO Generating payment form for order 2636. Notify URL: https://html/wc-api/WC_Gateway_Paypal/
2018-09-30T13:13:15+00:00 INFO PayPal Request Args for order 2636: cmd=_cart&business=bobby%40gmail.com&no_note=1¤cy_code=USD&charset=utf-8&rm=2&upload=1&return=https%3A%2F%2Fhtml%2Fcheckout%2Forder-received%2F2636%2F%3Fkey%3Dwc_order_5bb09a45b8877%26utm_nooverride%3D1&cancel_return=https%3A%2F%2Fhtml%2Fcart%2F%3Fcancel_order%3Dtrue%26order%3Dwc_order_5bb09a45b8877%26order_id%3D2636%26redirect%26_wpnonce%3D4bc13cc1a5&page_style=&image_url=&paymentaction=sale&bn=WooThemes_Cart&invoice=WC-2636&custom=%7B%22order_id%22%3A2636%2C%22order_key%22%3A%22wc_order_5bb09a45b8877%22%7D¬ify_url=https%3A%2F%2Fhtml%2Fwc-api%2FWC_Gateway_Paypal%2F&first_name=John+B&last_name=Johnson&address1=1184+Langtown+Road&address2=&city=Ridgeway&state=IN&zip=52165&country=US&email=JohnBJohnson%40rhyta.com&night_phone_a=563&night_phone_b=737&night_phone_c=0222&no_shipping=1&tax_cart=0.00&item_name_1=dsdfsdsdfsd&quantity_1=1&amount_1=200&item_number_1=