How to call Paypal API URI using C#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am integrating Paypal API using ASP.Net C#,
I am able get Access Token using API URI
using (var client = new HttpClient())
{
var byteArray = Encoding.UTF8.GetBytes(ClientId + ":" + ClientSecret);
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
var url = new Uri("https://api.sandbox.paypal.com/v1/oauth2/token", UriKind.Absolute);
client.DefaultRequestHeaders.IfModifiedSince = DateTime.UtcNow;
var requestParams = new List<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("grant_type", "client_credentials")
};
var content = new FormUrlEncodedContent(requestParams);
var webresponse = await client.PostAsync(url, content);
var resp = await webresponse.Content.ReadAsStringAsync();
AuthResult acc = JsonConvert.DeserializeObject<AuthResult>(resp);
but Same thing I want to create Payment URI
like
string strURL = "https://api.sandbox.paypal.com/v1/payments/payment/";
Payment payment = new Payment();
payment.transactions = translist; //Translist is Transaction all details I have done
using (var client = new HttpClient())
{
//I am unable to call here please help me
}
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- How to receive payment when the payee does not have a PayPal account. in PayPal Payments Standard
- Paypal express checkout, payment they error "Sorry, something went wrong. Please try again." in PayPal Payments Standard
- Need help to integrate PayPal Checkout (PPCP) with OpenCart? in PayPal Upgrade Community
- PayPal Buttons not visible in Sandbox Environment
- Add Others data in SDKs