简体   繁体   English

切换到直播时未经授权401

[英]401 Unauthorised When Switching To Live

I am trying to use PayPal to authorise web payments. 我正在尝试使用PayPal授权网络支付。 I have successfully upgraded my account to Web Payments Pro, and have built a solution which worked fine in sandbox to handle credit card payments. 我已成功将帐户升级到Web Payments Pro,并建立了一个在沙箱中可以很好地处理信用卡付款的解决方案。

However, now that I am trying to switch to live mode, I am receiving error 401 Unauthorised. 但是,既然我试图切换到实时模式,我将收到错误401未经授权。

What am I doing wrong? 我究竟做错了什么?

I am using OAuth as follows: 我正在使用OAuth,如下所示:

private OAuthTokenCredential ApiAccessToken
    {
        get
        {
            if (this._authToken != null)
            {
                return this._authToken;
            }

            var clientId = ConfigurationManager.AppSettings["clientId"];
            var secretToken = ConfigurationManager.AppSettings["secretToken"];
            var config = new Dictionary<string, string> { { "mode", ConfigurationManager.AppSettings["PayPalMode"] } };

            this._authToken = new OAuthTokenCredential(clientId, secretToken, config);

            return this._authToken;
        }
    }

I have switched mode to "live", and verified the clientId and secret tokens. 我已将模式切换为“实时”,并验证了clientId和秘密令牌。 I have even deleted the app and re-created it. 我什至删除了该应用并重新创建了它。 Still the error 仍然是错误

Typically, that error means there is something wrong with your client id and secret, or you may be setting the environment to sandbox in your apiContext. 通常,该错误表示您的客户端ID和密码有问题,或者您可能在apiContext中将环境设置为沙箱。 You also need to be approved for REST API direct credit card payments. 您还需要获得REST API直接信用卡付款的批准。 You can do this in sandbox without approval, but switching to live you do need to be approved. 您可以在沙箱中执行此操作,而无需批准,但切换到实时状态确实需要获得批准。

Log in to developer.paypal.com > Dashboard > My account and check under the "Live" column. 登录到developer.paypal.com>信息中心>我的帐户,然后在“实时”列下进行检查。 If you see the "Enable" link, click it and it will submit your application for approval. 如果看到“启用”链接,请单击它,它将提交您的申请以供批准。

To take your application live: 启用您的应用程序:

  1. Ensure your application adheres to the PayPal Application Policies and Guidelines. 确保您的应用程序遵守贝宝应用程序政策和准则。
  2. Update the Sandbox API credentials in your PayPal calls to those assigned to a live PayPal account. 将您的PayPal调用中的Sandbox API凭据更新为分配给真实PayPal帐户的凭据。
  3. Update your PayPal endpoints from the Sandbox to the PayPal production servers 将您的PayPal端点从沙盒更新到PayPal生产服务器
  4. Register your application with PayPal. 向PayPal注册您的应用程序。
  5. If your application makes use of Adaptive operations, obtain a live AppID. 如果您的应用程序使用自适应操作,请获取实时AppID。
  6. Go Live ! 上线!

More details about it, check Paypal https://developer.paypal.com/docs/classic/lifecycle/goingLive/ 有关它的更多详细信息,请查看Paypal https://developer.paypal.com/docs/classic/lifecycle/goingLive/

i was facing same issue i solved it by changing 我面临着同样的问题,我通过改变来解决了

name="mode" value="sandbox"

to

name="mode" value="live"

in web.config in .net mvc 在.net mvc中的web.config中

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

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