使用REST API的PayPal订单摘要 - - cURL或PHP

bbu*_*lis 7 php rest curl paypal

我正在使用PayPal RESTful API. https://developer.paypal.com/webapps/developer/docs/api/

如何将我的消费者订单商品和购买说明传递给PayPal,因此当我的用户被重定向到PayPal以通过登录批准订单时,他们的订单摘要将显示在左侧..

.

关于左翼的订购概要 贝宝空订单摘要

我试图传递transactions.item_list.items,但该信息仍未显示在订单摘要中.

有关如何使用PayPal RESTful API获取订单摘要以显示在paypal审批页面上的任何帮助?

我对他们的文档并不满意,因为它缺少一些信息,还有一些错误,这些错误浪费了我相当多的时间进行调试.

//
// prepare paypal data
$payment = array(
            'intent' => 'sale',
            'redirect_urls' => array(
                'return_url' => $url_success,
                'cancel_url' => $url_cancel,
                ),
            'payer' => array(
                'payment_method' => 'paypal'
                )
          );

//
// prepare basic payment details
$payment['transactions'][0] = array(
                            'amount' => array(
                                'total' => '0.03',
                                'currency' => 'USD',
                                'details' => array(
                                    'subtotal' => '0.02',
                                    'tax' => '0.00',
                                    'shipping' => '0.01'
                                    )
                                ),
                            'description' => 'This is the payment transaction description 1.'
                           );

//
// prepare individual items
$payment['transactions'][0]['item_list']['items'][] = array(
                                        'quantity' => '1',
                                        'name' => 'Womens Large',
                                        'price' => '0.01',
                                        'currency' => 'USD',
                                        'sku' => '31Wf'
                                       );
$payment['transactions'][0]['item_list']['items'][] = array(
                                        'quantity' => '1',
                                        'name' => 'Womens Medium',
                                        'price' => '0.01',
                                        'currency' => 'USD',
                                        'sku' => '31WfW'
                                       );

//
//format payment array to pass to cURL
$CURL_POST = json_encode($payment);
Run Code Online (Sandbox Code Playgroud)

Den*_*nis 1

你的代码很好。这实际上是一个错误,很快就会修复。关于文档,您能分享一下我们如何才能做得更好吗?我想确保您的反馈被传递给我们的文档团队。