Make payment at PayPal before SubmitOrder - paypal

This question is based on a project done through the MvcMusicStore tutorial.
Same technologies are also implemented in my site e.g. (MVC3, Sql Server 2008 SSMS & EF Code First)
I have implemented PayPal Web Standards payment at my project. Thanks to #Arun, i have referred to his site here http://www.arunrana.net/2012/01/paypal-integration-in-mvc3-and-razor.html
Situation at MvcMusicStore:
My project is similar to the data flow of MvcMusicStore. As you can see in this link, http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-9
In this tutorial, Jon Galloway has inserted a Payment field in the AddressAndPayment.cshtml page (but for simplicity purposes he made all products to be purchased for free by typing the keyword 'Free' - which would allow the user to checkout by clicking SubmitOrder and saving the Order in database)
Situation at My Project:
My question is about the workflow that i intend to apply.
When user adds items to shopping cart and reviews items in the Cart.
I want to:
Redirect user to PayPal to make payment upon clicking Checkout
After User make payment, return the user to AddressAndPayment.cshtml page
User then enters information and submit order
Is this work flow even right to begin with?
If yes, how do i convert these variables from my project;
Product.Title
Product.Quantity
Product.UnitPrice
to match these PayPal variables?
Item_Name
Amount
Quantity

Well i figured it out myself.
My first question, "Is this work flow even right to begin with?"
I have implemented it successfully. I cant say it is 100% right way of implementing it. It depends on your own system workflow. As for MvcMusicStudio, i cannot think of any other methods than this.
As for the second question, all i did was call a foreach loop and looped the PayPal variables. You will see it in more detail on Arun's website (link provided in the question thread above).
Thank you.

Related

Google analytics and different domain tracking

I asked this question directly to the Google Analytics community with absolutely no answer.
The question is as follow:
I have a AI based site, which give a customer a specific aid to select the right product he/she want to buy. The front ed application is React/js based.
My site is usually a small icon on a merchant site, and the user, while he/she is navigating the merchant site, can decide to recall clicking on a specific icon.
Then my site opens and help the user to select the right product(s) belonging to the merchant site. The product are choosen and then clicked to be added to the merchant cart.
Of course, there is a written agreement between the merchant and I to be signed, and some changes to the merchant site to incorporate my clickable icon: I'd like to pass a piece of code to the merchant including the icon and all the code needed to implement this kind of application.
So, given that the merchant call my site passing a specific transaction related token and the customer info (if any) when the user click on my icon, how can I:
directly add one or more items into the merchant cart
track the action made by the user after he/she leave me site and return to the merchant one to conclude the journey with a payment, so I can later invoice the merchant for the right commission
track if the user remove some (or all the) item from the cart, so I have less to nothing commissions to invoice.
I tried to follow the instruction given by google, but they are a mess, and I wasn't able to reach any conclusion.
Any help will be really appreciated.
Adding items to the merchant's cart is possible using some live API that the client would extend, but the easiest way to do it would be just using the window.postMessage(). So, I would suggest having your button implemented as a simple iframe. That will make it possible for you to send messages to the parent page from that button. The parent page, however, has to be ready to listen to those messages and add to cart whatever ids you specify. So the client devs will have to do some implementation for this to work.
Well, no, this is a bit too much to ask for. You can ask the merchant to share that data with you so that you could improve your algos (tune them for the client) and, therefore, improve the merchant's conversion rates (which is a win-win scenario), but the merchant would have to actively either implement parallel tracking to your instance of analytics (install your pixel, if you're willing to develop one), or share their own data with you.
That's what a lot of very similar services do. Let's say, Facebook. Facebook sells traffic. When you buy traffic, you generally don't want to pay for irrelevant/badly converting tracking, so you're implementing so-called facebook pixel. Facebook doesn't do this implementation. Client's developers/implementation experts implement it and trigger various events through it, making it send signals to the FB endoint, indicating which client this is from, for which campaign, what the action is page load, purchase, add to cart... Just take a quick glance at FB documentation: https://www.facebook.com/business/help/402791146561655?id=1205376682832142
Facebook is just an example. There are many-many services that do similar pixels. It may be not about selling traffic, it may be about adjusting site look and feel based on AI, or generating discounts and customizing conversion funnels, or even simpler stuff like feedback chat performance and suggestions modules. All these and more exist as third parties and pretty much all of the established ones use pixels for tracking.
If you don't want to spend time at the moment to make your own tracking logic, then implementing a parallel GA tracking will be a pain for you (for your clients, actually). Instead, it would be easier to enrich their data with your products. Let's say, have them implement a product-level custom dimension that would "paint" products added to cart by you and share the data with you.
Note that a client who goes for it must be a very loyal client since analytics data is normally treated as sensitive and is not readily shared with third parties, not mentioning the implementation of a custom dimension (or the using the expensive product parameters) just for a third party to count their conversions. Yes, it has to be a good friend that allows this.
Finally, you could ask them installing your GTM instance or giving you access to theirs, but that would effectively give you the power to execute arbitrary code on any of their page. I would never give a third party that power.
Tl;Dr: I would suggest making your own very simple pixel. Even though it sounds now like a lot of work, it will worth it if the project itself has real potential to be useful for ecommerce.
Exactly the same as 2.

Why are my PayPal Checkout buttons not opening a link to the PayPal Sandbox?

I am trying for the first time to implement a PayPal Checkout solution (aka PayPal Commerce Platform for Business) in an ASP.NET Web Application, using Web Forms. I've set up a new REST API for the Sandbox and followed PayPal's Set up server-side SDK guidance to install the SDK in my .NET project. PayPal's button demo now lets me log into the Sandbox with a newly created Sandbox user name and make a test payment, which is confirmed as being successful. So far, so good.
My next step was to create a PayPalButton.aspx page containing exactly the same code as used on Paypal's button demo page. All my updated code was then uploaded to my live site. That's when I hit a problem, as the PayPal buttons don't work on my live site (the PayPal log in window just briefly flashes and then disappears). Being a total newbie to the Paypal Checkout process, it's highly likely that I have made some very basic error.
The only thing I can think of is that my problem might have something to do with the section in Set up server-side SDK that refers to modifying HTTP request headers? I didn't understand what that section was asking me to do.
What routes/paths did you implement the create order and capture order functions at? What data do they return? Update your question with this information. For the create order route, is the data a valid JSON object with a PayPal order ID in the id key?
Have you set the paths in your "PayPalButton.aspx" HTML/JS code to call the aforementioned routes? Your question does not include any specific information about what is going on, i.e. your button code and the result (Response body) of the fetch calls from the browser's developer tools 'Network' tab.
This morning, I managed to resolve the problem with my PayPalButton.aspx page just briefly flashing the PayPal login page. As previously mentioned, it contains a script copied from PayPal's button demo. I then realised that it was different from the sample script provided on the Integrate Checkout page.
I created a new PayPalButton2.aspx page containing this alternative script and, unlike PayPalButton.aspx, it worked fine. In both cases, I had substituted my own Sandbox ClientID.

What is the best solution in Kentico where only one product/service to sell with fixed price

I am trying to understand Kentico and need one help. I have one product (or service) with fixed price. This is what I want: Customer browse home page => click buy button => they will be redirected to form to fill more details (ex:personal detail like name, age, email) => redirect to payment page => Then to PayPal on click of Pay now. Once customer paid, they will be given access to browse different page.
What is best solution for Payment logic here. Do I need to consider any e-commerce feature of Kentico or ignore e-commerce and go with PayPal Buy button is the best? I am also thinking how to keep track of the payment detail if I use PayPay buy button.
PayPal is the only allowed payment type.
Please let me know if you have any inputs.
Thanks,
Sharath
IMHO you will spend more time and effort attempting to setup that checkout process that you want vs. setting yo the e-commerce solution within Kentico. You can install the Dancing Goat e-commerce site and essentially copy all of the checkout process they have there and get what you're looking for simply by configuring the solution.
It sounds like e-commerce membership is what you're after to me; it allows you to restrict access to various pieces of content on your site to paid-up 'members' only. e-products might work, but I think from your description that membership us what you're after.
There are some fairly straightforward steps to setting this up:
Create the content on your site that will be for 'members'
Create a role that will be used to control access to your content
Create a membership group
Create a new product representing your membership
As Brenden says, you can save a lot of time using the dancing goat checkout if you're new to Kentico.
Also, check out configuring PayPal in Kentico. I've not used it for a while personally, but it is built-in.

Request payment part way through course

I'd like students to be able to access the first couple of lessons in Moodle before being presented with a request for payment. I've searched for ages on Google and found nothing, and also searched for all the possible terms I could think of here, and again come up short. Apologies therefore for the lack of contributing research/evidence.
I'm using Paypal as the chosen method of payment at the moment. Moodle is version 3.2.
Is there a way to add this kind of option to the 'access restrictions' in the courses themselves?
There isn't an existing way to restrict activity access based on the users enrolment type.
Without writing some custom code, the easiest way to do this is probably to have a separate course containing the pay-walled content, with paypal enrolment set up.
Add an activity to the free course with a link to the paid course. Use access restrictions to hide it until the other activities are complete.
When a user completes the free course content, the link to the paid course will be revealed, and they can click to enrol using paypal.

Roadblocks with using PayPal Recurring Payment Subscription with ASP.Net Membership?

I'm using ASP.Net Membership Provider for logging into the premium content of this web site. The content isn't downloads, it's web pages of information and discounts, etc. That part is done. We want them to also have a PayPal Subscription annual payment to see the premium content. I would like ASP Membership and PayPal Subscription to work together as much as possible, but for the minimum I am thinking they will have to create a MemberId before they pay. Then I will send that MemberId to PayPal to associate the two.
I think I can do that like this:
Set "Auto Return" on in the interface so that it will redirect to return URL when payment is made.
Set "return URL" query string to MemberId. This requires not using the precompiled "Saved" buttons. I'll have to set it in Code Behind with Name Value Pairs, "NVP" to PayPal. I was hoping to just paste the stupid button.
But then, there were those "Advanced Variables" in the Button maker. Problem was they are compiled into the Saved button, so I can't change them for each person. But maybe that one parameter could be separate from the compiled parameters? Is this better than hacking the return URL? Are "Advanced Variables" good for anything?
All the details about the transaction will be POSTed to the return URL if I put in the right code, which might be rm=2. (Right?) Then I can record it.
This process is said to be unreliable, though, and PayPal recommends using a secondary system that they have, "IPN". PayPal sends the transaction details to me. I send them back http 200 code. Then I send it back to them in the same order I got it. Then they send me http 200. Then we all know it's good. This sounds like a few hours research to me, but if you've already done it once, it sounds like copy and paste. I hate reinventing the wheel. Is there a .Net sample of this IPN handshake/dance?
Also, if I do the IPN thing, maybe I don't need Auto Return. Maybe I add MemberId to "notify" URL instead of "return" URL. Then PayPal can handle the confirmation page, email, etc. Is that better?
Assuming we get the Subscription paid for and recorded with the MemberId, at least once per user session, after they log in, I have to check if they have paid their PayPal subscription and if it's up to date. "GetRecurringPaymentsProfileDetails" does this, but it is an API operation. That makes sense, but I was hoping to avoid learning their REST API. (Is there a "NVP" version?)
REST API OAUTH tokens expire every few minutes, but the only way it tells to get one is by using "Bash" to "cURL" some Linux commands. Again, this seems like the kind of thing that would only ever have to be written once. Does this already exist as a sample code somewhere?
(I don't want to use the API to do the Subscribe, because I don't want the Credit Card numbers to ever go to our site. Too much liability. That's why I wanted PayPal.)
Will this even work? I know PayPal has 18 ways to do everything and they all exclude each other, and I'm just getting the feeling that I'm creating a patchwork of unrelated ideas to fool myself into believing there's a light at the end of the tunnel. I've already been researching and experimenting for 10 hours or so. I really thought, going in, I'd just be pasting a stupid button.
If you want to just "copy the stupid button" then you'll have to stick to Payments Standard, and then you'll be limited with what you can do. For example, you won't be able to use GetRecurringPaymentsProfileDetails for a standard subscription.
Instead, you'll need to use Express Checkout and / or Payments Pro. There is indeed an NVP API available for these, and there is also a SOAP/XML version. Details on those can be found here: https://developer.paypal.com/docs/classic/api/
Specifically, for Express Checkout, you'll want SetExpressCheckout, GetExpressCheckoutDetails, DoExpressCheckoutPayment, and CreateRecurringPaymentsProfile. Some of those calls are optional depending on how exactly you're configuring things with the checkout flow.
For Payments Pro you'll use either DoDirectPayment / CreateRecurringPaymentsProfile or PayFlow depending on what version they put you on.
In any case, IPN is definitely the way to go for post-transaction processing.
.NET IPN Sample - https://github.com/paypal/ipn-code-samples/blob/master/paypal_ipn.asp