gpt4 book ai didi

c# - 在 PayPal SandBox、MVC 中创建付款时出现 INTERNAL_SERVICE_ERROR

转载 作者:太空宇宙 更新时间:2023-11-03 16:28:26 29 4
gpt4 key购买 nike

我的想法已经用完了,类似问题的答案都没有帮助,因此我现在很绝望。我正在尝试将 Paypal 付款整合到我的应用程序中。我已在我的沙盒帐户中将负面测试设置为关闭。我正在使用 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);
}

现在每次我尝试创建付款时,我都会收到以下信息:

"{\"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 的沙盒环境中发生了很多次,并且(大部分时间)与过度使用信用卡号码有关。最好的尝试是通过开发人员仪表板创建一个新的 Sandbox 测试帐户,并在那里生成一个新的信用卡号。

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

编辑:

除了创建新的沙盒测试帐户以获取新的信用卡号进行测试之外,您还可以尝试使用 PayPal 技术支持网站上以下常见问题解答中提供的信用卡号生成器:

Sandbox - Generate an Additional Credit Card Number for a Sandbox account.

向下滚动到该页面上的第 4 步,找到生成器。

关于c# - 在 PayPal SandBox、MVC 中创建付款时出现 INTERNAL_SERVICE_ERROR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28481834/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com