Setting up a recurring subscription service for an ASP.NET website - c#

I have an ASP.NET website that is similar to Yellow Pages in functionality and I want to offer a recurring subscription service to users that enables their business profiles to be priority listed, or brought to the top if they are subscribed. Each user has a "SubscriptionLevel" integer tied to their account on the database side and I simply need to modify that field depending on what subscription service they select. Are there any C# libraries out there I can use to set this up quick? I would prefer users to pay through PayPal.

Sure you can do this. There's lots of 'out of the box' subscription services but if you are here I'm assuming you are a developer so why not just integrate with the API. Paypal provides their recurring payment API
Keep in mind you can test this easily inside of their sandbox environment

Related

Is it a good way to only rely on PayPal Checkout when it comes to Securing a website from unintended use?

I am planning a website based on C# and ASP.NET MVC on which I want to offer a small function for a small amount of money. I dont want to use User Profiles because I dont want to do the managing part (like user/pwd) of it and save time. (I know there is a built in User-Handling in ASP.NET but I dont want a User-Login here because no one would register an account for this little function)
So a Idea comes to my mind that I could simply offer a PayPal-Button to let the User pay the money and let PayPal handle the redirect with an response key/hash (I think this is how it works) and on the redirected page on my site validate the payment through the key/hash from paypal to call the function the user paid for. Something like a paywall I think.
Is this a safe approach to secure my function and only show it to users who have paid or is this vulnerable to brute-forcing my application with a massive amount of keys to get away with not paying at all?
There are two reliable ways to confirm that a PayPal payment has been successful:
Synchronously: A server-side, API-based integration
Asynchronously: Any integration, and wait for a Webhook or IPN notification from PayPal for confirmation.
I'll cover the first way.
Integrate PayPal Checkout, documented here: https://developer.paypal.com/docs/checkout/
Here is a demo pattern of the client-side UI
The server side portion of this type of integration (particularly for the transaction set up and capture API calls) is discussed here: https://developer.paypal.com/docs/checkout/reference/server-integration/
Set up the payment
Capture the payment
If you do choose to implement a server-side integration, then -- once everything is working for the happy path -- don't neglect to implement funding failure error handling: https://developer.paypal.com/docs/checkout/integration-features/funding-failure/ ; This will allow buyers to choose a different funding instrument if e.g. their first card is declined by the capture attempt

Split a PayPal payment into multiple payments to the same receiver

I manage a nopCommerce site that uses the PayPal Express checkout plugin. Our accounting department wants the ability to split the payments based on some business rules. This differs from PayPal’s Adaptive Payments because in this case it’s multiple payments for the same receiver. Ultimately, I would need to capture the transaction IDs for each payment to process later on.
Is this possible?
What's the point of splitting a transaction into two if you're sending both transactions to the same PayPal account?
In order to do that you would need to setup a billing agreement for the buyer and then use reference transactions to process the two transactions separately.
It has a message that those APIs are being deprecated soon, but that's not really true. Indeed, they are trying to get people to move to the REST APIs instead of the Classic APIs, however, Classic is still so heavily used (and still has functionality that REST simply doesn't have) that they aren't going to be eliminating them. I still use Classic APIs primarily myself.

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.

Single sign-on toolbar for multiple projects, MVC4

I am building a set of services based on MVC 4. They should all be a part of the same authentication system. Currently I have got a separate project for all the model handling, including the Forms Authentication you get by default when making a new MVC 4 app.
Now, I would like to make a toolbar for logging in to our cloud services, and this toolbar must be made in such a way that it can be imported into our other services. Logging in with this toolbar should log you in to all our services, that are separated into different MVC apps. Thus logging in when browsing "service1" and then going to "service2", you should still be logged in with the same user.
Can anyone point me in the right direction here? Should I make a separate MVC app for this toolbar, and somehow reference it in all of my other projects? Should I export my controllers into a separate project and use them? I am not sure what the best practice is here, nor where to find the info I need on the matter.
Since you will be hosting your applications on different domains, you could implement some Single Sign On mechanism the way SO does it over the Stack Exchange network: https://meta.stackexchange.com/questions/64260/how-does-sos-new-auto-login-feature-work/64274#64274
Different domains means that you won't be able to share the Forms cookie. You should rather learn how to use one of the enterprise Single Sign-on protocols - using a recognized protocol means that you can easily integrate other applications, even if they are developed in different technologies (standarized protocols are supported by most development environments).
Possible candidates are:
the OAuth2 protocol. It is a respected protocol as Google, LiveID, Facebook, Twitter and others support it. To build an OAuth2 server you will need a framework like the DotNetOpenAuth.
WS-Federation. Got a lot of attention in .NET world as we got the Windows Identity Foundation framework which lets you create WS-Federation servers and clients.
Anyway, my advice is to invest your time now as this will pay off well in future.

What should be the impact of thread and sessions over paypal mechanism in asp.net c#

Now a days i am looking for the perfect time estimation for the asp.net 4.0 with c# integration. since workflow is while user subscribing on the site, he should pay for subscription. Well this is the normal usecase now a days. but how developers manages the sessions and threading while performing the payment transactions.
In fact i don not have much knowledge about threading and session and suddenly i have the task to build this mechanism. well, how to manage all this ? so that transaction is more secure from our side. (sure paypal has taken care. and how many ways we can integrate paypal with asp.net application ?)
You need to make a "script" that handles a url from paypal.
Ex. When user payment is confirmed paypal sends info on www.yousite.com/paypalhandler.aspx
This info contains userId etc etc. And now the script makes the necessary updates to your db.

Categories

Resources