我是PayPal集成的新手。我需要获取订单ID以获取交易的详细信息,并想在另一页上向客户显示交易的详细信息。
以下是javascript代码。以下代码显示OrderId = 0。
<script> paypal.Buttons({ createOrder: function (data, actions) { // This function sets up the details of the transaction, including the amount and line item details. return actions.order.create({ application_context: { return_url: 'https://example.com', cancel_url: 'https://example.com' }, purchase_units: [{ amount: { currency_code: 'USD', value: '<%=bookingAmount%>' } }] }); }, onApprove: function (data, actions) { // Capture the transaction funds return actions.order.capture().then(function () { // Show a confirmation to the buyer alert('Transaction complete!' & data.orderID); }); } }).render('#paypal-button-container'); //This function displays Smart Payment Buttons on your web page. </script>
问题:上面的代码无法按要求工作。该如何解决?
我是PayPal集成的新手。我需要获取订单ID以获取交易的详细信息,并想在另一页上向客户显示交易的详细信息。以下是...
使用下面的代码行,我能够检索交易的详细信息。 -