Issue setting up WebApi (CSharp) with Paypal

Hello!

First I want to thank the developers and supporters of this great service. It has saved me a ton of work and the documentation is excellent!

I am just having a small issue getting paypal to work using the payments example. The issue is that payments are completed and the purchaser is returned to the thank you page (pay-thankyou.aspx), and informed that a license key will be sent to them. But the license keys are not being sent. In fact, when testing locally, it would appear as if the paychecker script is never being invoked.

I have a suspicion that the problem may be that I have a Standard Paypal account which means that payments are redirected to Paypal, and the actual transaction is not hosted inside my site. When the transaction completes it correctly navigates back to the thank you page on my site, but it appears to have bypassed the paychecker script entirely. So I'm wondering maybe I need to upgrade to Paypal 'Advanced' which according to paypal, gives: "the extra advantage of allowing your customers to check out directly on your site". Can anyone verify that an advanced paypal account is needed for this WebAPI payment example to work properly or am I likely doing something else wrong?

I have set my API key and version number in PaymentSettings.cs.

I have also set the URLs:

public const string CheckScript = "http://localhost:2103/paychecker.aspx";

// Where the user can buy your products public const string BuyPage = "http://localhost:2103/payment.aspx";

// Thank you page (once payment is made, user is sent to this page) public const string ThankYouPage = "http://localhost:2103/pay-thankyou.aspx";

Note this is how I use it when testing locally. When I test my published services I use 'https' and replace 'localhost:2103' with my domain name (and yes I have obtained and activated my ssl certificate on my host server)

I have also tested both in sandbox mode and without, but no luck.

Please advise! Thank you!

Forgot to mention, I set my paypal email string as well. The paypal payments are definitely being processed (Email confirmation and receipts are sent). So they payment itself appears fine, its just that license keys are not generated.

Thanks!

Here's your mistake:

public const string CheckScript = "http://localhost:2103/paychecker.aspx";

Remember what's happening. The customer checks out and all of the information you supply here is forwarded to PayPal. So if you tell PayPal to look for "localhost" it won't know it contact you (because its localhost is different from your localhost). Does that make sense?

So either use a publicly accessibly IP address (not 127.0.0.1 -- that has the same problem) or a domain name.

And do that for all the URLs in PaymentSettings.php

Tell me if that helps.

Thanks for your response, Wyatt

I think you missed the following remark in my original post:

"Note this is how I use it when testing locally. When I test my published services I use 'https' and replace 'localhost:2103' with my domain name (and yes I have obtained and activated my ssl certificate on my host server)"

So to be explicit, I am using: "https://www.gearifysoftware.com/paychecker.aspx" and this does not solve my problem.

Thanks!

Ok, sorry I missed that bit.

I have a suspicion that the problem may be that I have a Standard Paypal account which means that payments are redirected to Paypal, and the actual transaction is not hosted inside my site.

Yes, I believe that's the problem. From the PayPal Instant Payment Notification (IPN) documentation:

How to get started

1. Check your account status. Login to PayPal. Go to your PayPal Profile and click My settings. Confirm that your Account type is either Premier or Business, or upgrade your account.

I checked my settings and it looks like I currently have a business account. That's the base line, free business grade account.

I may try upgrading just to see if it fixes things but it takes like 2 business days for an account to be approved apparently.

Any other ideas?

I believe that's it. Make sure no exceptions are being thrown in your paychecker.aspx script. Also, make sure the url is accessible by the world.

Issue resolved!

I did upgrade my Paypal account but I'm pretty sure this wasn't the cause of the problem. It looks like I needed to set my SMTP email settings in web.config. I feel silly for not guessing this, obviously email information needs to be supplied somewhere, but maybe it would help other users if "add smtp mail settings to web.config" was added as a 'TO DO' item in the payment.aspx page or somewhere else more obvious than in the comments in SendPKeys function in PaymentSettings.cs.

Lastly, for some reason I had to set "defaultCredentials="false" rather than true, in my smtp settings in web.config. For some reason it gave me a "no such user" error otherwise.

Hopefully this post will be useful should anyone else have a similar issue.

Issue resolved!

Great, I'm glad you found the problem.

but maybe it would help other users if "add smtp mail settings to web.config" was added as a 'TO DO' item in the payment.aspx page or somewhere else more obvious than in the comments in SendPKeys function in PaymentSettings.cs.

You're right, in the next version there will be a note about it at the top of the PaymentSettings file.