简体   繁体   English

Paypal .Net SDK 实现

[英]Paypal .Net SDK implementation

Dear StackOverflow Community, We have started to implement the PayPal .Net SDK in our project.亲爱的 StackOverflow 社区,我们已经开始在我们的项目中实现 PayPal .Net SDK。

We create a Payment with the following Code:我们使用以下代码创建付款:

 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/"
            }
        });

The payment is also created and a corresponding link is generated.还会创建付款并生成相应的链接。 If we now pay with our test account, the money is not debited and nothing more happens, the forwarding also works normally.如果我们现在用我们的测试账户付款,钱不会被借记,什么也没有发生,转发也正常工作。 However, no transaction is reported to PayPal.但是,没有交易报告给 PayPal。

It would be very nice if someone could help us with this Problem.如果有人可以帮助我们解决这个问题,那就太好了。

Thank you!谢谢!

After the redirect back to the return_url you provided, you are expected to present an order review page and then when the user confirms the order you must do a payment Execute API call, which will result in the PayPal transaction.重定向回您提供的return_url ,您应该显示一个订单审查页面,然后当用户确认订单时,您必须执行支付 Execute API 调用,这将导致 PayPal 交易。 If you do not do the Execute API call, there will be no transaction.如果不执行 Execute API 调用,则不会有事务。

Do not worry about money being debited from the payer account, since payer accounts have funding sources with infinite funds in sandbox.不要担心从付款人账户中扣款,因为付款人账户在沙箱中有无限资金的资金来源。


Note also that the v1/payments SDK you are using is deprecated, you should upgrade to the current v2/checkout/orders Checkout-NET-SDK and use it to create two routes on your server, one for 'Create Transaction' and one for 'Capture Transaction', documented here .另请注意,您使用的 v1/payments SDK 已弃用,您应该升级到当前的 v2/checkout/orders Checkout-NET-SDK 并使用它在您的服务器上创建两条路由,一条用于“创建交易”,另一条用于“捕获交易”, 记录在此处

The best approval flow to pair with your two new routes is https://developer.paypal.com/demo/checkout/#/pattern/server与您的两条新路线配对的最佳审批流程是https://developer.paypal.com/demo/checkout/#/pattern/server

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM