简体   繁体   English

贝宝:创建付款时发生内部服务器错误

[英]PayPal: Internal Server Error on Create Payment

I am using paypal API for .NET to create payments. 我正在使用Paypal API for .NET创建付款。

My exact code in Console Application: 我在控制台应用程序中的确切代码:

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

If I change payment method to paypal, its working. 如果我将付款方式更改为贝宝,则可以正常工作。 if I send credit_card I get error 500. 如果我发送credit_card,则会收到错误500。

debug_id: 30e0f1bb08d3f debug_id:30e0f1bb08d3f

configuration: live 配置:实时

Merchants from UK cannot make Direct(Credit Card) Payments using REST API. 来自英国的商家无法使用REST API进行直接(信用卡)付款。 You will need to upgrade your account to PRO to make use of Direct Card Payments. 您需要将您的帐户升级到PRO才能使用直接卡付款。 Only US merchants can make direct card payments in REST API without a PRO account. 只有美国商人可以在没有PRO帐户的情况下使用REST API直接进行卡付款。

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

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