1
votes

I'm using .NET REST API for PayPal Express Checkout for direct credit card payment. When I use sandbox, I create Payment, set credit card as funding instrument, billing address and payment works fine. But when I switch to live, calling Payment.Create(apiContext) with the exactly same data throws PayPal.IdentityException with 401-Unauthorized message. However, at that time I have valid access token. Calling regular PayPal payment works fine either using live environmnet.

Thanks for any suggestions.

1

1 Answers

1
votes

I found a solution to this problem. It is necessary to determine sdkConfig in apiContext.

        var sdkConfig = new Dictionary<string, string> { { "mode", "live" } };
        string accessToken = new OAuthTokenCredential(id, secret, sdkConfig).GetAccessToken();


        var apiContext = new APIContext(accessToken);
        apiContext.Config = sdkConfig;