PayPal:创建付款时出现内部服务器错误

问题描述 投票:0回答:1

我正在使用 .NET 的 Paypal API 来创建付款。

我在控制台应用程序中的确切代码:

// Get a reference to the config
var config = ConfigManager.Instance.GetProperties();

// Use OAuthTokenCredential to request an access token from PayPal
var accessToken = new OAuthTokenCredential(config).GetAccessToken();

var apiContext = new APIContext(accessToken);

var p = new Payment();
p.intent = "sale";

p.payer = new Payer();
p.payer.payment_method = "credit_card"; //paypal or credit_card

var t = new Transaction();
t.amount = new Amount();
t.amount.currency = "GBP";
t.amount.total = "10.00";

t.amount.details = new Details();
t.amount.details.subtotal = "6.00";
t.amount.details.tax = "2.00";
t.amount.details.shipping = "2.00";

t.item_list = new ItemList();
t.item_list.items = new List<Item>();

var i1 = new Item();

i1.quantity = "1";
i1.name = "OBJETO TESTE";
i1.price = "6.00";
i1.currency = "GBP";

i1.sku = "TESTE";

t.item_list.items.Add(i1);

var a = new ShippingAddress();
a.recipient_name = "ADDRESS";
a.line1 = "LINE1";
a.line2 = "LINE2";
a.city = "LONDOM";
a.country_code = "GB";
a.postal_code = "NW19EA";

t.item_list.shipping_address = a;

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

p.redirect_urls = new RedirectUrls();
p.redirect_urls.cancel_url = string.Format("{0}{1}", "http://localhost:3161/", "Order/CancelPayment");
p.redirect_urls.return_url = string.Format("{0}{1}", "http://localhost:3161/", "Order/CompletePayment");

var payment = Payment.Create(apiContext, p);

如果我将付款方式更改为 Paypal,则可以使用。如果我发送

credit_card
,我会收到错误 500。

调试 ID:30e0f1bb08d3f

配置:实时

c# .net paypal
1个回答
0
投票

来自英国的商家无法使用 REST API 进行直接(信用卡)付款。 您需要将您的帐户升级到 PRO 才能使用直接卡付款。 只有美国商家可以在没有 PRO 账户的情况下通过 REST API 进行直接卡支付。

© www.soinside.com 2019 - 2024. All rights reserved.