When I started the the Classic API Samples I had to do the following operations for Visual Studio 2013:
- Open the solution by double clicking on the .sln file via Exporer (or open it directly from Visual Studio)
- Visual Studio will prompt you about one way migration, accept it and continue
- Set the .NET Framework to 4.5.2 as it suggests
When you run the application it will work to a point - I noticed that the order that the main() executes the calls is not in the right order. Also, I noticed that there was a number of items that was hardcoded.
For example, the SetExpressCheckoutSamplewas further down, and CreateRecurringPaymentsProfileSample and DoCaptureSample were ahead of it. In terms of the order of operations this doesn't really make any sense since the Customer has not authorised anything they would have clicked submit on your page.
The tokens that are used were also hardcoded, this is ok for the initial test - but Paypal really should have paid more attention to this. Since this will get Newbie (such as myself unstuck).
To resolve this, I had to store the token once SetExpressCheckoutSample.SetExpressCheckoutAPIOperation() is executed. I then had to pass the token into where ever the token was being referred to.
For example, in GetExpressCheckoutDetailsSample I overloaded the constructor to take in a string:
public string tk {get; set;}
public GetExpressCheckoutDetailsSample(string tk)
Please note that this is to try and get the samples to actually work only.
Then, I replaced GetExpressCheckoutDetailsRequestType getExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType("EC-11U13522TP7143059"); with
GetExpressCheckoutDetailsRequestType getExpressCheckoutDetailsRequest = new GetExpressCheckoutDetailsRequestType(this.token);
As you can see above the Token was hardcoded, by passing the this.token instead of the hardcoded value I could use what I had set previously in SetExpressCheckoutSample.
Unfortunately the Classic API sample is a console application, after making these changes I was expecting the PayerID to be printed. When I found that this didn't actually print out anything and debugging and checking google. I noticed that there was a comment above the Console.WriteLn stating:
"
// Unique PayPal Customer Account identification number. This
// value will be null unless you authorize the payment by
// redirecting to PayPal after `SetExpressCheckout` call.
"
Good work Paypal, why would you provide a sample without actually providing a working sample? This sample should have been a asp.net sample, with the appropriate redirection routine.
I'm positing this as I progress - however, I may need to alter posts as I learn more.
Thanks