【发布时间】:2013-03-05 05:04:52
【问题描述】:
我正在使用 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);
【问题讨论】:
-
您能否发布一个代码示例,以便我们了解您是如何构建 API 调用的?
-
有一个简单的例子,我正在使用 cURL 来处理 PayPal 付款。其他一切工作正常,访问令牌、创建/执行付款......我只是无法使用 RESTful API 让我的购物车显示在订单摘要部分