paypal Payments Pro Hosted Solution Integration repeat payment - button

I am using paypal express checkout where i can create take payment for an order with multiple recurring payment profiles in it. e.g. initial payment £5, item A £3 every month, item B £5 every year.
I am asked to implement this using website payments pro hosted solution using iframe API now.
But i can't figure out how to pass this order to it.
According to Integration guide I need to use Button Manager API and create a template= templateD button type, but that button type only accept one profile.
https://www.paypalobjects.com/webstatic/en_GB/developer/docs/pdf/hostedsolution_uk.pdf

you cannot create a recurring profile through the Hosted Payments endpoint by passing "Payments Standards" variables.
The PayPal system will automatically do a 302 redirect to the webscr endpoint (if the browser were to load the page outside of the iframe, with X-Frame-Options set, it refuses to load at all).
You cannot create recurring payments profiles through HSS (hosted sole solution). This product will merely take credit card payments from your site.

Related

Recurring and non-recurring items in single PayPal checkout flow

I'm currently migrating a website from WooCommerce to Shopware 6, which needs to support recurring payments for a membership subscription.
WooCommerce is still using PayPal Standard, which allows you to mix non-recurring line items with a recurring subscription, in a single checkout flow.
Shopware 6 uses the REST API, which doesn't appear to support this ability and the only solution appears to be using the Javascript SDK:
User clicks Pay with PayPal.
Subscription is created via actions.subscription.create
Dialog is displayed requesting approval.
Customer approves.
Submit original checkout.
Redirect to PayPal.
Complete payment.
Redirect back to website with confirmation.
A potential solution I'm looking into now is changing the return URL of the initial order creation to redirect to a billing agreement approval URL and have the return URL's of that redirect back to the original return url.
Overly complicated and the worse UX I've ever seen.
Before I tear what's left of my hair out, does anyone have any suggestions?
UPDATE
Although it isn't the solution I was hoping for, I ended up removing the Shopware 6 PayPal plugin and implementing my own payment method using the NVP API.
From the user perspective, there is only one approval process. In the backend, once the user has approved the transaction (that has been marked as needing a billing agreement) the transaction is verified and then a recurring profile is created.
There's no way to combine Subscriptions and one-time payments in a single checkout. Such items even require different parameters on the PayPal SDK line, if using the PayPal buttons to show an in-context experience.
The in-context experience is best, since it involves no redirects away from your site to PayPal and back. Here is the flow for one-time payments:
Make two routes on your server, one for 'Create Order' and one for 'Capture Order', documented here. These routes should return only JSON data (no HTML or text). The latter one should (on success) store the payment details in your database before it does the return (particularly purchase_units[0].payments.captures[0].id, the PayPal transaction ID)
Pair those two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server
A similar (separate) flow can be used for PayPal Subscriptions. Only one subscription can be approved at a time.

Google Forms PayPal Express Integration

I am doing work for a non profit with 0 budget for IT. They need to allow users to enter information on a Google Form and then collect payment. I have done a lot of research on the topic and currently appears you can only add a hyperlink on the Google Forms to link to PayPal. However, I was wondering if there was some way to link the PayPal Express Checkout javascript(https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/add-paypal-button/) into the Google Form so it calls back with a transaction id and status. Then I would be able to somehow insert those values into the Google Form. Any thoughts on how to integrate would be helpful. I am a developer but not familiar with Google Forms.
I recently wrestled with this exact question and ended up building a G Suite addon to make this easier for others. Coincidentally I also do volunteer IT for a small nonprofit and we wanted to use PayPal with our signup form (there's pricing for the addon but just ping me if you're a small nonprofit).
Here's what I learned while building it:
There's no way for Apps Script to modify the form once it's shown to the user, or to use Apps Script to respond to user input
There's no way to redirect the user automatically to PayPal after a form is submitted
That means if you want to send someone to PayPal, you've got to use an ordinary link. You can do this within the form by adding the URL to a question description, or you can add the URL to the text shown once someone has submitted the form. For PayPal, you've got two options for this kind of link:
PayPal buttons
Express checkout
PayPal buttons are a static link managed by PayPal. They don't require any coding - just go here and create a button. Then you need to get the raw text link for the button, which PayPal calls the "email" version. You can insert that into your form directly and tell users to access it. The one problem is there's no real way to get the transaction ID. You could try correlating the form submit time with the payment time, or the payer email with the form submit email. It's possible that neither of them will match up and you'll have to do it manually.
Express checkout requires you to dynamically create a new link for each payment by calling the PayPal API. That means your link needs to open a page that then generates an express checkout URL and redirects the user to it. You can do this using a web app in Google Apps Script using a doGet() trigger, or you can create your backend on your server in any language.
If you can run your own server somewhere, I recommend that (plenty of PaaS services have a free tier). It's much easier to test and debug things when you aren't using Apps Script. I used the PayPal Node SDK which works great despite being unmaintained. (Express checkout is "deprecated" by PayPal, but I'll bet it's not going away anytime soon). Their example will get you most of the way there. When the user arrives, generate a payment link and redirect them. When they finish they'll return to your server, and you can display whatever you want. For example, you can ask them to copy the transaction ID and paste it into your form.
Finally, when your form is submitted an onSubmit() trigger can be set up. There are actually two kinds of onSubmit() triggers for forms - one for the form itself, and a second for the spreadsheet linked to the form. You can register a trigger to do extra processing (e.g. look up the transaction ID), but you can't modify the response in the trigger. You can however modify the spreadsheet where the trigger gets sent, which for most cases is equivalent. For example, you could add a column to the spreadsheet with a link to the PayPal transaction based on the transaction code.

Pass dynamic querystring to paypal continue page

My website is in Asp.Net C#.
I am using paypal for my website. i have multiple products like logo design, brochure design etc. I am using different BuyNow button for each service.
After successful payment i am sending user back to my continue.aspx page.
But I am just confused about 1 thing that are we able to receive OrderId to my continue.aspx page anyhow? I have to fetch details of that particular order on the continue.aspx page to add more design descriptions like company name, requirements etc.
Is there any way to receive my orderId as a query string on my continue.aspx after successful payment?
Are you using Website Payments Standard or Express Checkout? It sounds like you are using Express Checkout, but if your using standard you may want to switch over to Express Checkout as you will have more control over the checkout flow. With Express Checkout when the buyer is sent back to your site after they have agreed to the payment your site will perform a GetExpressCheckoutDetails API call. You will get the buyers information with this API call. From there you can then present the buyer with the additional options and etc before performing the DoExpressCheckoutPayment API call which is the API call that actually charges the buyer.

PayPal Integration - what options are recommended

We have an ASP.NET web site containing a product catalogue. We have now been asked to add on shopping cart and payment functionality. However, as this is a trial, it needs to be cost free (as far as reasonable) and there is no SSL certificate installed.
So we've turned to PayPal as a solution, but before we digest the manuals, is this a good approach?
Can a collection of items in a basket (in ASP.NET) be pushed into PayPal's own hosted payment pages? This would be easiest for us as we can easily create the basket and contents within the ASP.NET site
Is there a way (using API or whatever) to 'Add to Basket' without redirecting the shopper to PayPal and then back to our site again?
Is there a better way all round that we've missed?!?
All advice will be up-voted - this a fact-finding journey for us before we start any work.
there is no SSL certificate installed
You will have to get an SSL certificate to do anything with payment gateways.
Can a collection of items in a basket (in ASP.NET) be pushed into
PayPal's own hosted payment pages?
Yes they can.
This would be easiest for us as we can easily create the basket and
contents within the ASP.NET site
You'll still need to arrange the data in a PayPal-friendly way.
Is there a way (using API or whatever) to 'Add to Basket' without
redirecting the shopper to PayPal and then back to our site again?
Yes there is but this costs more and the integration will be slightly more involved.
Is there a better way all round that we've missed?!?
Depends on what's needed. A simple or semi-professional shop can redirect to PayPal but a large or professional shop should have integrated payment as well as a PayPal option. The integrated payment option doesn't need to be PayPal.
Think about currencies, refunds, cancellations, documentation and customer-service-quality when choosing your payment gateway.

paypal buy it now button process flow

Im adding paypal payments to my site via a buy it now button, which as i understand it posts a form to paypal then the user completes payment on paypal's site.
To process the order after payment is confirmed im using an IPN listener, but id like to do some processing on our server at the time of ordering too. Is it possible to have the buy it now button submit to our own server first so i can record the order, before redirecting to paypal for payment details?
You have two options here.
First option that is more simple but can fail if the user did not have javascript, is to make a post to your server with what data you like, with ajax, and only after the return you let the user continue the submit.
Second option is to post your data to your server on code behind, there you prepare a simple page with auto submit to paypal - actually you make a redirect with post. Here you can find source code and one example on how to make it:
http://www.codeproject.com/Articles/37539/Redirect-and-POST-in-ASP-NET
Actually, you have many options.
As you said, the buy now button is nothing more than a form post to PayPal. You can build your own form using any of their standard variables rather than be limited to these buttons. They call this the cart upload method.
With this method you can do whatever you need to do whatever local processing you need to do prior to ever sending the user over to PayPal. It's a good practice to create an order record of some kind in your own system which you can then include with your PayPal payment info. That same value will come back in IPN so you can process it post-payment as well.
Another option that would you open you up even more is to use the Express Checkout APIs. This gives you complete control of your checkout system and has more features than standard payments. I recommend this if you're familiar with web service APIs.
Of course, IPN works with Express Checkout, too, so you can still use that for whatever you want/need as well.

Resources