paypal / PayPal-NET-SDK

.NET SDK for PayPal's RESTful APIs
https://developer.paypal.com
Other
536 stars 462 forks source link

PaymentExecuteRequest Not Executing #398

Closed chuksgpfr closed 4 years ago

chuksgpfr commented 5 years ago

This is my execution mwthod :

`private async void ExecutePayment(string PayerId, string paymentId) { PaymentExecuteRequest request = new PaymentExecuteRequest(paymentId); request.RequestBody(new PaymentExecution() { PayerId = PayerId }); }

It doesn't execute ... help needed. .NET core 2.0`

poursh commented 5 years ago

Hi, there is no any environment definition in your code, you have to define paypal client with (sandbox or production) environment and execute your request with it.

private async void ExecutePayment(string PayerId, string paymentId)
{
   PaymentExecuteRequest request = new PaymentExecuteRequest(paymentId);
   request.RequestBody(new PaymentExecution()
   {
      PayerId = PayerId
   });
   var response = await PayPalClient.Execute(request);
   var result = response.Result<Payment>();
}
prakash-gangadharan commented 4 years ago

Hi @chuksgpfr, to Process PayPal Payments / create a PayPal payment below are the steps.

Let us know if you are facing any challenges.