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

本文关键字:内部 服务器 错误 创建 付款 PayPal | 更新日期: 2023-09-27 18:25:55

我正在使用paypal API for.NET创建付款。

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

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

如果我把付款方式改为贝宝,那就行了。如果我发送credit_card,我会得到错误500。

debug_id:30e0f1bb08d3f

配置:实时

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

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