簡體   English   中英

Paypal .Net SDK 實現

[英]Paypal .Net SDK implementation

親愛的 StackOverflow 社區,我們已經開始在我們的項目中實現 PayPal .Net SDK。

我們使用以下代碼創建付款:

 var payment = Payment.Create(GetDefaultApiContext(), new Payment
        {
            intent = "sale",
            payer = new Payer
            {
                payment_method = "paypal"
            },
            transactions = new List<Transaction>
            {
                new Transaction
                {
                    description = "Test",
                    invoice_number = "009",
                    amount = new Amount
                    {
                        currency = "EUR",
                        total = "41.00",
                        details = new Details
                        {
                            tax = "0",
                            shipping = "0",
                            subtotal = "40",
                            handling_fee = "1"
                            
                        }
                    },
                    item_list = new ItemList
                    {
                        items = new List<Item>
                        {
                            new Item
                            {
                                name = "Room 12",
                                currency = "EUR",
                                price = "10",
                                quantity = "4",
                            }
                        }
                    }
                }
            },
            redirect_urls = new RedirectUrls
            {
                return_url = "https://google.de/",
                cancel_url = "https://google.de/"
            }
        });

還會創建付款並生成相應的鏈接。 如果我們現在用我們的測試賬戶付款,錢不會被借記,什么也沒有發生,轉發也正常工作。 但是,沒有交易報告給 PayPal。

如果有人可以幫助我們解決這個問題,那就太好了。

謝謝!

重定向回您提供的return_url ,您應該顯示一個訂單審查頁面,然后當用戶確認訂單時,您必須執行支付 Execute API 調用,這將導致 PayPal 交易。 如果不執行 Execute API 調用,則不會有事務。

不要擔心從付款人賬戶中扣款,因為付款人賬戶在沙箱中有無限資金的資金來源。


另請注意,您使用的 v1/payments SDK 已棄用,您應該升級到當前的 v2/checkout/orders Checkout-NET-SDK 並使用它在您的服務器上創建兩條路由,一條用於“創建交易”,另一條用於“捕獲交易”, 記錄在此處

與您的兩條新路線配對的最佳審批流程是https://developer.paypal.com/demo/checkout/#/pattern/server

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM