简体   繁体   English

如何在PayPal中付款后获取TransactionID

[英]How can I get the TransactionID after payment in PayPal

I'm developing a website with MVC and I'm going to manage the payment with PayPal. 我正在开发一个MVC网站,我将用PayPal管理付款。

After the payment I need the transaction ID but I don't know how can I get it. 付款后,我需要交易ID,但我不知道如何获得它。 Anyone can help me? 有人可以帮帮我吗?

payRequest.ReturnURL = url + Url.Action("PaymentPayPalOk");
            payRequest.CancelURL = url + Url.Action("PaymentKo");
            payRequest.Amount = Math.Round(model.total, 2);
            payRequest.Commento = string.Format("Ordine: {0}", OrderId);
            payRequest.ReceiverEmail = PayPal.RecipientEmail;
            var payResponse = _payPalService.ProcessPayment(payRequest, Server.MapPath("~/"));
            model.TransactionId = payResponse.PayPalKey;
            if (payResponse.IsSuccessful)
            {
                return Redirect(payResponse.RedirectURL);
            }
            else
                return RedirectToAction("Index", "Error");

I attached the image of the information that i need 我附上了我需要的信息的图像

在此输入图像描述

I'm not sure which kind of SDK you're using but normally you find the TransactionID in your REST Response at the related_resources property of each transaction element in the id value. 我不确定您使用的是哪种SDK,但通常您会在REST响应中的id值中每个事务元素的related_resources属性中找到TransactionID

示例JSON响应


I recommend you to look up the PayPal-NET-SDK on github . 我建议你在github上查找PayPal-NET-SDK It has a nice and strong community and also a fast response on your issues. 它拥有一个漂亮而强大的社区,并且对您的问题也有快速响应。

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

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