Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone, I have to make a in-app purchase feature that allow the user to buy an account upgrade in .NET Winforms, so this is what I comes up with:

private void _setupPayment(String TypeOf,String Pricing) {
         string url = "";

         string business = "mybusinessemail@gmail.com";
         string country = "MY";
         string currency = "MYR";

         url += "https://www.paypal.com/cgi-bin/webscr/" +
             "?cmd=" + "_xclick" +
             "&amount=" + Pricing +
             "&business=" + business +
             "&item_name=" + TypeOf;



         System.Diagnostics.Process.Start(url);
     }


The code above will direct the user to a payment page on browser so everything is fine but I'm struggling with verifying whether if the user make a payment or not, say if the user successfully made a payment then I want the example code below to be execute and display it on the Winform application:

MessageBox.Show("Account Upgraded\nThanks for purchasing");


I've read about IPN but I don't catch a thing whether if it will be useful in my case or not.

What I have tried:

bool paymentSuccess = false;
private void _setupPayment(String TypeOf,String Pricing) {
         string url = "";

         string business = "mybusinessemail@gmail.com";
         string country = "MY";
         string currency = "MYR";

         url += "https://www.paypal.com/cgi-bin/webscr/" +
             "?cmd=" + "_xclick" +
             "&amount=" + Pricing +
             "&business=" + business +
             "&item_name=" + TypeOf;

         System.Diagnostics.Process.Start(url);
         paymentSuccess = true;
         MessageBox.Show("Payment has made?");
         
     }
Posted
Updated 1-Jan-23 6:27am

1 solution

Never, ever, accept code from a insecure website to handle anything to do with real money.
You do not know who is giving you the code, you do not know what it does, you do not know that it places the monies correctly into the appropriate account, without passing the details to any third parties.

Only get such code from paypal themselves - the scope for fraud otherwise is far too large. And remember, you personally could be liable for any monies lost if your action is seen to be negligent - which getting your code from a public forum would most certainly be!

Contact them: they have an API, a sandbox, and a support team who really want you to get it working properly - remember, they don't get their commission until you get paid!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900