0

This has been asked a couple of times but I still haven't figured out how to make it work on the .NET SDK https://github.com/paypal/PayPal-NET-SDK:

After calling

payment.Create(apiContext)

I sucessfully get back response with a populated createdTime,PayID,links,etc.

Now when I log into paypal sandbox with the buyer/seller test accounts. I'm not able to see the transaction

This popular question points to calling DoExpressCheckoutPayment to resolve this issue. After doing some research in how I could call DoExpressCheckoutPayment this with .NET SDK, the only way I found was using a previous version of the SDK (https://github.com/paypal/merchant-sdk-dotnet) which is marked as deprecated

I'm kind of lost trying to figure out something that shouldn't be so difficult I followed the example here and I belive that it should work without any additional thing

Community
  • 1
  • 1
Alejandro Lozdziejski
  • 1,063
  • 4
  • 12
  • 30

2 Answers2

1

The SDK you are referring to is for the (relatively) new REST API.

Assuming You are referring to a paypal payment (not credit_card) so you have to execute it - which I would map to DoExpressCheckoutPayment in the Classic API

The SDK has a sample for it: PaymentWithPayPal.aspx.cs wherein In the sample you referenced, you'll see the execute call in line 155

A sample for credit_card with intent='sale' (which means auth and capture in one step, or "immediate capture") is in PaymentWithCreditCard.aspx.cs

Hth...


Update:

The paymentExecution was missing

Actually it's all there in lines 146 - 155:

 var paymentExecution = new PaymentExecution() { payer_id = payerId };
 var payment = new Payment() { id = paymentId };

 // ^ Ignore workflow code segment
 #region Track Workflow
 this.flow.AddNewRequest("Execute PayPal payment", payment);
 #endregion

 // Execute the payment.
 var executedPayment = payment.Execute(apiContext, paymentExecution);

Hth..

EdSF
  • 11,753
  • 6
  • 42
  • 83
0

You are right. The paymentExecution was missing It such a shame that the SDK samples are incomplete. I'll try to reach the author as I wouldn't like anybody else to get stuck as I did.

I made it work after Checking the paypal REST API doc I'd recommend going through this doc instead of the .NET SDK examples

Alejandro Lozdziejski
  • 1,063
  • 4
  • 12
  • 30
  • That's ok but the sample includes the `execute` call and `paymentExecution`. The relevant [**lines are from 146-155**](https://github.com/paypal/PayPal-NET-SDK/blob/master/Samples/Source/PaymentWithPayPal.aspx.cs#L146-L155) – EdSF Mar 08 '15 at 15:41
  • 1
    This is Jason with PayPal. If you know of an improvement that can be made to the .NET SDK samples, I'd love to hear them. The samples were constructed so you can see the flow and includes the payment execution step. I do agree the documentation included with them should definitely be improved. Also, I recently updated the SDK with a wiki that includes a [FAQ answer concerning this question](https://github.com/paypal/PayPal-NET-SDK/wiki/Frequently-Asked-Questions#I_created_a_PayPal_payment_What_do_I_do_now). Again, Iet me know what should be elaborated and I'd be happy to make the update. – Jason Z Mar 09 '15 at 15:55
  • Thanks Jason, I'm having another problem with the redirection. Could you please advise? Please check http://stackoverflow.com/questions/28952584/why-paypal-redirect-is-executed-after-page-load – Alejandro Lozdziejski Mar 09 '15 at 22:10