PayPal Classic API对一个呼叫进行身份验证,但对下一个呼叫则不进行身份验证 [英] PayPal Classic API Authenticates one call but not the next

查看:99
本文介绍了PayPal Classic API对一个呼叫进行身份验证,但对下一个呼叫则不进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从PayPal下载交易记录.为此,我打电话给TransactionSearch以获得日期范围内交易的基本列表.然后,我致电GetTransactionDetails以获得每笔交易的全部详细信息.

I am trying to download transaction history from PayPal. To do this I am calling TransactionSearch to get a basic list of transactions within a date range. I then call GetTransactionDetails to get the full details of each transaction.

        using (var client = new PayPalService.PayPalAPIInterfaceClient())
        {
            var credentials = new PayPalService.CustomSecurityHeaderType
            {
                Credentials = new PayPalService.UserIdPasswordType
                {
                    Username = "MyUserName",
                    Password = "MyPassword",
                    Signature = "MySignature"
                }
            };

            TransactionSearchReq request = new TransactionSearchReq();
            request.TransactionSearchRequest = new TransactionSearchRequestType();
            request.TransactionSearchRequest.StartDate = DateTime.Now.AddHours(-12);
            request.TransactionSearchRequest.EndDate = DateTime.Now;
            request.TransactionSearchRequest.Version = "117.0";

            TransactionSearchResponseType transactionSearchResponseType = client.TransactionSearch(ref credentials, request);
            foreach (PaymentTransactionSearchResultType t in transactionSearchResponseType.PaymentTransactions)
            {
                var reqType = new GetTransactionDetailsRequestType
                {
                    TransactionID = t.TransactionID,
                    Version = "117.0"
                };
                reqType.DetailLevel = new DetailLevelCodeType[1];
                reqType.DetailLevel[0] = DetailLevelCodeType.ReturnAll;

                var treq = new GetTransactionDetailsReq
                {
                    GetTransactionDetailsRequest = reqType
                };
                GetTransactionDetailsResponseType transaction = client.GetTransactionDetails(ref credentials, treq);
            }

        }

第一个呼叫TransactionSearch的方法有效,并向我返回交易列表.对GetTransactionDetails的第二次调用返回错误:

The first call to TransactionSearch works and returns me a list of transactions. The Second call to GetTransactionDetails returns an error:

Error Code: "10002"
Long Message: "You do not have permissions to make this API call"
Short Message: "Authentication/Authorization Failed"
Correlation ID: 67970b9729a82
Ack: Failure
Build: 000000
Version: "117.0"
Any: null
PropertyChanged: null

我有三次检查,确认我在通话中传递的TransactionId是我的有效交易之一.

I have triple check that the TransactionId I am passing in the call is one of my valid transactions and it is.

以前有人看过吗?

推荐答案

对于给定的变量,似乎没有在您的代码中传递凭据的某些方式.确保以下变量包含值:

It seems that some how the credentials are not being passed in your code for the given variables . Make sure below variables contain values :

Username ="MyUserName", 密码="MyPassword", Sgnature ="MySignature"

Username = "MyUserName", Password = "MyPassword", Sgnature = "MySignature"

您可以对API凭据进行硬编码,然后尝试.

You can hard code the API credentials and then try .

这篇关于PayPal Classic API对一个呼叫进行身份验证,但对下一个呼叫则不进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆