PayPal payment simple example in c# - c#

I'm creating a PayPal payment method for my ASP.Net website. I'm looking at PayPal API docs but I feel lost in it.
I have a simple cart and I want to implement the simplest way to send to PayPal payment information and retrieve payment status.
Can you point me to a simple example, documentation or steps to achieve this?

This might be of help:
http://indiandotnet.wordpress.com/2009/04/14/simplest-paypal-integration-with-aspnet-in-5-steps/
Here's the reference to the name value pair api with examples:
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_NVPAPIOverview

I can also recommend encores paypal sdk if you want to get started quickly. It's not free but I've been using it for a year now and am extremly happy. (No I'm not affiliated..:-))
http://www.encoresystems.net/

Related

Require Paypal Subscription to Create an Account - ASP.Net / MVC4 / C# / Razor

I am new to Entity Framework, MVC and Razor but am almost finished with my first project using it.
The final piece of the puzzle is to tweak the "canned" Log-in / Registration piece that comes by default when setting up an MVC project. I need to integrate with Paypal in order to create a monthly subscription. If payment is up-to-date then their account will then allow them to access all the benefits my site has to (hopefully) offer.
I signed up with developer.paypal.com and think I have a good start as far as creating test accounts. I just need to get the code in place.
Is there any sample code that already tackles this? I read through the API doc but
Is there any best practices that relate to what I want to accomplish? For example, should someone pay first, then create an account or vice versa? Should I have to implement managing their subscription cancellation or do they have to do it within their account? etc...
How can I tell if a user is current with their subscription and they didn't cancel.
How can I tie a user to their Paypal transaction?
Any help would be much appreciated. Thanks in advance!
PayPal has Standard Subscriptions and then they have the Recurring Payments API, or what can sometimes be seen as Recurring Billing. I would definitely recommend going with the API's as it will give you much more freedom to do everything you're wanting.
If you're talking about PayPal payments (where people sign in to pay) I'd go with Express Checkout, which consists if SetExpressCheckout, GetExpressCheckoutDetails, and then DoExpressCheckoutPayment and/or CreateRecurringPaymentsProfile depending on what you're doing. In your case it sounds like you'll be doing CRPP because you're working with subscriptions.
That will return a profile ID which you can save locally in your user table(s). Then, when people login you can make a call to GetRecurringPaymentsProfileDetails to lookup the current status of the profile, and then redirect the user to different places depending on the status.
PayPal's .NET SDK should make all of those calls easy on you, but it's really just a matter of building NVP requests and sending them to PayPal via HTTP POST.
If you want to do all of that with credit cards directly then the process is the same, but there are different API calls involved, and depending on the version of PayPal account you have the calls would be different.
If you're using Website Payments Pro 3.0 then you would use the DoDirectPayment platform, which in the case of recurring payments you would just make a single call to CreateRecurringPaymentsProfile and include the credit card details in that request.
If you're on Payments Pro 2.0 that would use the PayFlow API, and that's where it's called Recurring Billing, so you'd just have to setup a PayFlow request accordingly.

Paypal C# class for returning all transactions from Paypal

Is there a way by which i can fetch the transaction history of my Paypal account into my application without having to log in to Paypal and checking it manually?
You can probably accomplish what you want using the TransactionSearch method in the PayPal Merchant API, but it's probably not going to be a trivial undertaking.
Check out https://devtools-paypal.com/apiexplorer/PayPalAPIs and click on the "Merchant" tab to view the Merchant API methods. TransactionSearch is the fifth item on the list. They have an environment right on that page that you can play around with.
More info on TransactionSearch is available at: https://www.paypalobjects.com/IntegrationCenter/ic_transaction-search-and-details.html.
Then of course, you'll have to write the code to make the API calls and organize and display the data on your end.
Hope this helps!

Programmatically purchase from a website in C# or javascript

Hey guys, I'm trying to create a website that can help a user purchase items from other websites. What would be the best way to go about doing this?
I know most of the sites I'm using are sending their information using FORM:POST, but I'm having trouble finding the exact POST packet in fiddler (I'm assuming it's encrypted?), and know that a lot of the sites are using login credentials, so that complicates things a bit.
Is there any way I could use webkit or something to handle all the http stuff, and just pass javascript to fill in the forms? Or is there an even simpler way to create proper POST packets and use a WebRequest?
Thank you!
1) get permission
2) use their published API
If the sites do not have an API and allow you to use their server process, copy their forms to your site and use post. You can post from your server with credentials using for example CURL
Usually shopping cart and credit-card transaction use SSL and you have to login in the site. So I think it's not so simple to bridge with a javascript or a simple webrequest.
There's not a statndard-simple-way way to do this!
You're heading for a world of hurt.
First, you should check if what you're trying to do is legal. Does the web site allow "proxy orders"? Or are they forbidden by their EULA?
Second, you'll have to handle the user's confidential data (username, password, credit card number), and especially credit card numbers are calling for troubles.
Third, how are you planning to implement payment methods like PayPal? You're going to collect the user's PayPal credentials in order to make payments on their behalf? (See point number two if answer is yes.)
Fourth, since you have to fake HTTP requests, as soon as the web site changes a single field, your tool will break, how are you planning to handle this?
Or you're trying to automate only the first steps of the orders and not the payment?

Credit card payment method

I'm creating a online webshop using ASP .net and C#. The website is supposed to receive payment by master card, visa, paypal, and e-transfer. Any reference how can I do that, esp for master card and visa. Is it done via web service? Do i hv to use a payment gateway? Is it possible to connect directly to MC and visa? I totally have no clue on this. Thanks!
Yes you have to use a payment gateway. Banks provide such services. Also Paypal.
I suggest that you use a 3rd party API to handle payments :)
Paypal would be a good choice :)
Take a look at the Paypal SDK here
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_download_sdks
And you might be interested in the Direct Payment API Paypal
https://www.paypal.com/cgi-bin/webscr?cmd=_dcc_hub-outside
As others have said you need to use payment gateway such as WorldPay or PayPal.
I personally chose Paypal due to the wealth of information out there regarding how to implement the payment system into web sites using PHP, JSP, ASP.NET etc...
Plus Paypal offers a good range of packages to suit your needs - you'll also be able to take advantage of their 'IPN' option (Instant Payment Notification).
The Paypal IPN service will make a call to a special asp.net file that you specify on your server everytime a payment is made from your web site... within this call the IPN will send over a bunch of data such as the order number, payee name etc.... you can these use this data to update your database tables such as 'Payment Status', its a great feature!

How can i Integrate PayPal with ASP.NET?

How can i integrate PayPal with ASP.NET, do you have any sites that can get me started or links to any tutorials?
Read paypal integration in asp.net from Rick Strahl
Update: There is PayPal Helper for web matrix that could be easily integrated to asp.net mvc or asp.net web forms.
You'll have to use Paypal IPN for that. My site runs with Perl, but the way it basically works is as follows:
Customer fills out an order form at my site with their name, address, email.
Customer is being redirected to Paypal
Upon successful payment via Paypal, Paypal calls my IPN-compliant script
My script sends me an e-mail notifying me about the completed order
If the customer does not pay within 30 minutes or so, my database also sends him a reminder with a Paypal payment link for the respective order.
Download the ASP.NET E-Commerce Start Kit, which is now "DashCommerce". It has PayPal implemented. http://dashcommerce.org/
You can give this Paypal NVP API example in C# (asp.net) a try: http://brad.w3portals.com/2008/02/paypal-nvp-api-example-in-c-aspnet.html
Tries to give a simple example to get you up and running quick. The paypal SDK example are not that great. Cheers.
Michael987 put together posts from different forums to come up with a solution that worked well for him.
NathanRidley integrated the codes from the link above and released an open source library on Github

Categories

Resources