简体   繁体   English

在PayPal SandBox,MVC中创建付款时发生INTERNAL_SERVICE_ERROR

[英]INTERNAL_SERVICE_ERROR while creating payment in PayPal SandBox, MVC

I have ran out of ideas and none of the answers for the similar question was helpful, hence I am desperate now. 我已经没有足够的想法了,类似问题的答案都没有帮助,因此我现在很绝望。 I am trying to integrate paypal payment into my app. 我正在尝试将贝宝付款集成到我的应用程序中。 I have set negative testing to off in my sandbox account. 我在沙盒帐户中设置了负面测试。 I am using visual studio 2013, here is my example code: 我正在使用Visual Studio 2013,这是我的示例代码:

Address billingAddress = new Address();
billingAddress.line1 = "52 N Main ST";
billingAddress.city = "Johnstown";
billingAddress.country_code = "US";
billingAddress.postal_code = "43210";
billingAddress.state = "OH";

CreditCard creditCard = new CreditCard();
creditCard.number = "4417119669820331";
creditCard.type = "visa";
creditCard.expire_month = 11;
creditCard.expire_year = 2018;
creditCard.cvv2 = "874";
creditCard.first_name = "Joe";
creditCard.last_name = "Shopper";
creditCard.billing_address = billingAddress;

var amountDetails = new Details();
amountDetails.subtotal = "7.41";
amountDetails.tax = "0.03";
amountDetails.shipping = "0.03";

Amount amount = new Amount();
amount.total = "7.47";
amount.currency = "USD"; 
amount.details = amountDetails;

Transaction transaction = new Transaction();
transaction.amount = amount;
transaction.description = "This is the payment transaction description.";

List<Transaction> transactions = new List<Transaction>();
transactions.Add(transaction);

FundingInstrument fundingInstrument = new FundingInstrument();
fundingInstrument.credit_card = creditCard;

List<FundingInstrument> fundingInstruments = new List<FundingInstrument>();
fundingInstruments.Add(fundingInstrument);

Payer payer = new Payer();
payer.funding_instruments = fundingInstruments;
payer.payment_method = "credit_card";

Payment payment = new Payment();
payment.intent = "sale";
payment.payer  = payer;
payment.transactions = transactions;

var config = ConfigManager.Instance.GetProperties();
var accessToken = new OAuthTokenCredential(config).GetAccessToken();

        try
        {
            var apiContext = new APIContext(accessToken);
            var createdPayment = payment.Create(apiContext);
        }
        catch (PayPal.HttpException e)
        {
            return Json(e.InnerException, JsonRequestBehavior.AllowGet);
        }

Now each time I am attempting to create the payment, I am getting the following: 现在,每次我尝试创建付款时,都会得到以下信息:

"{\"name\":\"INTERNAL_SERVICE_ERROR\",\"message\":\"An internal service error has occurred\",\"information_link\":\"https://developer.paypal.com/webapps/developer/docs/api/#INTERNAL_SERVICE_ERROR\",\"debug_id\":\"f0d2f70ac4693\"}"

debug_id changes each time i attempt. 每当我尝试debug_id都会更改。 any help would be hugely appreciated. 任何帮助将不胜感激。

Try changing the credit card number you're using to a different number. 尝试将您使用的信用卡号更改为其他号码。 This error has been happening a lot in the recent weeks on PayPal's sandbox environment and is (most of the time) related to overusing a credit card number. 最近几周,该错误在PayPal的沙盒环境中发生了很多,并且(大部分时间)与过度使用信用卡号有关。 The best thing to try would be to create a new Sandbox test account via the Developer Dashboard and generate a new credit card number there. 最好的尝试是通过开发人员控制台创建一个新的Sandbox测试帐户,并在其中生成一个新的信用卡号。

The PayPal payments team is currently working on a solution on sandbox to return a more meaningful error when this happens. PayPal付款团队目前正在沙盒上解决方案,以便在发生这种情况时返回更有意义的错误。

EDIT: 编辑:

As an alternative to creating a new Sandbox test account to get a new credit card number for testing, you can also try the credit card number generator available in the following FAQ on the PayPal Technical Support site: 除了创建新的Sandbox测试帐户以获取新的信用卡号进行测试之外,您还可以尝试使用以下PayPal技术支持网站上的常见问题解答中提供的信用卡号生成器:

Sandbox - Generate an Additional Credit Card Number for a Sandbox account . 沙箱-为沙箱帐户生成一个额外的信用卡号

Scroll down to Step 4 on that page to find the generator. 向下滚动至该页面上的步骤4 ,以查找生成器。

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

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