paypal:如何获取订单ID并传递到交易详细信息页面

问题描述 投票:1回答:1

我是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以获取交易的详细信息,并想在另一页上向客户显示交易的详细信息。以下是...

javascript paypal-sandbox
1个回答
0
投票

使用下面的代码行,我能够检索交易的详细信息。 -

© www.soinside.com 2019 - 2024. All rights reserved.