Quantcast
Channel: Active questions tagged paypal - Stack Overflow
Viewing all articles
Browse latest Browse all 516

PayPal: Internal Server Error on Create Payment

$
0
0

I am using Paypal API for .NET to create payments.

My exact code in Console Application:

// Get a reference to the configvar config = ConfigManager.Instance.GetProperties();// Use OAuthTokenCredential to request an access token from PayPalvar 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_cardvar 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.

debug_id: 30e0f1bb08d3f

configuration: live


Viewing all articles
Browse latest Browse all 516

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>