在MVC的PayPal SandBox中创建支付时出现INTERNAL_SERVICE_ERROR



我已经没有什么想法了,类似问题的答案都没有帮助,所以我现在很绝望。我正在尝试将贝宝支付集成到我的应用程序中。我已经在我的沙箱帐户中设置了阴性测试。我使用的是visualstudio2013,这里是我的示例代码:

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);
        }

现在,每次我试图创建付款,我都会得到以下信息:

"{"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都会更改。任何帮助都将不胜感激。

尝试将您使用的信用卡号更改为其他号码。最近几周,PayPal的沙盒环境中经常发生这种错误,(大多数时候)与过度使用信用卡号有关。最好的办法是通过开发者面板创建一个新的沙盒测试帐户,并在那里生成一个新信用卡号。

PayPal支付团队目前正在研究沙盒解决方案,以便在发生这种情况时返回更有意义的错误。

编辑:

作为创建新的沙盒测试帐户以获得新的信用卡号进行测试的替代方案,您也可以尝试PayPal技术支持网站上以下常见问题解答中提供的信用卡号生成器:

沙盒-为沙盒帐户生成额外的信用卡号。

向下滚动至该页面上的步骤4以查找生成器。

相关内容

最新更新