Having INTERNAL_SERVICE_ERROR whenever creating a payment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to create a sample project to learn about paypal APIs and What I am doing is Creating a payment that I want to capture and whenever I run the code it says Internal service error. I have viewed the API errors section and it says this error means try again some other time I have been trying it since last night but to no avail. I am attaching my sample code so that You can have a look at it as well. Any Suggestion or alternate good articles on how to get started with Paypal REST API will be appreciated.
public void Charge()
{
PayPal.Api.OAuthTokenCredential cred = new OAuthTokenCredential( System.Web.Configuration.WebConfigurationManager.AppSettings[ "paypalClientId"], System.Web.Configuration.WebConfigurationManager .AppSettings["paypalSecret"]); var token = cred.GetAccessToken(); var card = new CreditCard { cvv2 = "123", expire_month = 12, expire_year = 2024, first_name = "Jamshayd", last_name = "Kamran", number = "TEST CARD NUMBER", type = "mastercard", billing_address = new Address { city = "Johnstown", country_code = "US", line1 = "52 N Main ST", postal_code = "43210", state = "OH" } }.Create(new APIContext(token)); var payment = new Payment { intent = "authorize", payer = new Payer { payment_method = "credit_card", funding_instruments = new List<FundingInstrument>() { new FundingInstrument { credit_card_token = new CreditCardToken { credit_card_id = card.id, expire_month = card.expire_month, expire_year = card.expire_year, } } } }, transactions = new List<Transaction> { new Transaction { amount = new Amount { total = "11.00", currency = "USD", }, description = "This is payment Transaction" } } }.Create(new APIContext(token)); var authorization = payment.transactions[0].related_resources[0].authorization; if (authorization.state != "authorized") { Response.Write("Unauthorized..."); return; } var capture = new Capture { amount = new Amount { currency = "USD", total = "11.00" }, is_final_capture = true }; var response = authorization.Capture(new APIContext(token), capture); Response.Write("Response State: " + response.state);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, make sure that the account that is calling the API is a PRO account (Uk or US) as you are passing payment_method : credit_card that is only available for PRO uk or us accounts. Pass the value "paypal" instead and you will able to process account card payments correctly as the buyer will log in into his/her PayPal account that will use the card already added in it or will be offered, where available, the Guest Checkout with card.
Here some references, and also here.
"payment_method": "credit_card"
"payment_method": "paypal"
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- can we assign a unique detail to every subscription creation? in NVP/SOAP APIs
- Button in PayPal Payments Standard
- Receiving a PAYMENT.SALE.COMPLETED webhook notification - how can I trace the parent Subscription in REST APIs
- I need to create a Pay Now / Buy Now button that retrieves a price from a simple shopping cart. in PayPal Payments Standard
- User is asked for shipping address when creating a credit card order in REST APIs