亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何向用戶和商家發送詳細的 PayPal 發票?

如何向用戶和商家發送詳細的 PayPal 發票?

四季花海 2023-10-23 10:24:26
我正在開發一個包含商店的網站。用戶可以在這家商店使用 PayPal 付款,效果非常好!購物車是使用 JavaScript 進行編程的,這導致了一些問題。我最初想要一個 JS 函數,向用戶發送一封帶有購物車的電子郵件,但我可以找到任何代碼。我知道您可以使用 PayPal 獲取詳細收據,但我的系統不會向我提供這些詳細信息。我已經閱讀了 PayPal 網站的開發人員部分,但我似乎無法弄清楚!我的 PayPal 腳本如下:<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({                    purchase_units: [{                        amount: {                            value: countCartTotal()                        }                    }]                });            },            onApprove: function(data, actions) {                // This function captures the funds from the transaction.                return actions.order.capture().then(function(details) {                    // This function shows a transaction success message to your buyer.                    window.location.href = "orderConfirmed.php"                    clearCart()                });            }        }).render('#paypal-button-container');        //This function displays Smart Payment Buttons on your web page.    </script>購物車在 cart.js 中編碼,我知道我可以在 PayPal 腳本中使用此文件中的函數,因為函數“countCartTotal()”告訴 PayPal 向客戶收取的金額。在我的購物車里。在 Node.js 中,這就是我將商品添加到購物車的方式:我需要讓 Paypal 包含“${product.name}”和“${product.quantity}”
查看完整描述

1 回答

?
一只甜甜圈

TA貢獻1836條經驗 獲得超5個贊

項目進入purchase_units數組,記錄在 v2/orders 中。理解所有必需的細分參數可能很困難,這些參數必須相加,否則結帳將出錯并且無法打開 - 所以這里是一個包含兩個項目的示例:

"purchase_units": [{

? ? ? "description": "Stuff",

? ? ? "amount": {

? ? ? ? "value": "20.00",

? ? ? ? "currency_code": "USD",

? ? ? ? "breakdown": {

? ? ? ? ? "item_total": {

? ? ? ? ? ? "currency_code": "USD",

? ? ? ? ? ? "value": "20.00"

? ? ? ? ? },

? ? ? ? }

? ? ? },

? ? ? "items": [

? ? ? ? {

? ? ? ? ? "unit_amount": {

? ? ? ? ? ? "currency_code": "USD",

? ? ? ? ? ? "value": "10.00"

? ? ? ? ? },

? ? ? ? ? "quantity": "1",

? ? ? ? ? "name": "Item 1",

? ? ? ? },

? ? ? ? {

? ? ? ? ? "unit_amount": {

? ? ? ? ? ? "currency_code": "USD",

? ? ? ? ? ? "value": "10.00"

? ? ? ? ? },

? ? ? ? ? "quantity": "1",

? ? ? ? ? "name": "Item 2",

? ? ? ? },

? ? ? ],

? ? }

? ]


查看完整回答
反對 回復 2023-10-23
  • 1 回答
  • 0 關注
  • 179 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號