我正在使用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);