Paypal subscriptions using client side js only - javascript

Is it possible to create PayPal subscriptions using only a client side javascript (and Firebase if needed)?
I'm a bit confused with PayPal; there are so many frameworks/options to do same thing that I don't know where to look exactly.
https://developer.paypal.com/demo/checkout/#/pattern/client
This seems similar what I'm looking for except it's only for payments, and I need subscriptions.

Just an update on this ticket. Paypal do now have a javascript client-side API that works very well. Here is the link: https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/

You can use PayPal WPS Subscription Buttons
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#recurring-payment-variables
This is a button integration so you can use JS and HTML to create a plan and redirect buyers to paypal.com. You can specify your subscription terms and PayPal will take care of making recurring payments. You can also maintain inventory, profile & loss tracking.
For any API integration its highly risky to use client side JS.

Related

How can I secure transactions made with client-side PayPal Smart Checkout buttons?

I'm trying to make a Smart Checkout button in my website which is currently running 100% in client-side.
I pass an amount to the createOrder function, based on the contents of the shopping cart, which is client-side. Now, I know that the amount can perfectly be tampered with, and PayPal would have no way of knowing that the customer is underpaying.
We are a small group of people and expect a low volume of sales, so we wouldn't have a problem detecting these underpayments and canceling the transaction (refunding the paid amount to the customer, and not shipping the item).
However, we would still have to pay PayPal fees, so this can be easily abused into making us (the seller) lose money.
Is there any way to make client-side PayPal Smart Checkout buttons, while also protecting myself from this kind of exploits?
Is there any way to make client-side PayPal Smart Checkout buttons, while also protecting myself from this kind of exploits?
This is why server-side verification is a must. It is very easy to exploit these kind of things client-side and you cannot secure it client side either. PayPal have documentation on server side implementations for verifying payments. They have many SDK's too to suit your needs. e.g. NodeJS, PHP, Python...
PayPal Checkout Server-Side SDK

linking 3rd party payees to paypal

I am trying to create a website that will allow people to post items for sale and then receive a payment through paypal once the item is purchased. Ideally I would have them link their paypal account to my website, before they post any items, and user would checkout via paypal. This would be a very similar setup to what ebay has with paypal. Can someone point me to what type of integration this is? Also could someone point me to the proper docs? I don't think i'm using the correct terminology so I'm not finding anything. I am a developer so i'm not afraid to code this up. Thanks
If you want to create this kind of integration you will need to make a few user experience decisions first. The flow of Ebay allows a person to link a payment method to their system and upon purchase directs them to an Ebay paypal checkout page that acts as a payment using stored credentials to do a transaction with the Ebay paypal account. Internally Ebay then performs other transactions from their account with other user's registered payment information to mediate the exchange. It is not directly user-to-user. The first question you as a developer need to answer is : Do you want to use the pre-built paypal experience or design your own with paypal integration?
The simplest pre-built experience causes your users to be directed away from your website to paypal where they handle their transactions and then are returned to your site along with a REST payload that informs your site whether a transaction was successful or not.
Another service offered by paypal is called Paypal Payment Advance which allows them to provide you with a template integration on your website which performs the transactions on your domain. To learn more about that, see here.
The custom experience requires you to learn the Paypal developer API and how Paypal operates and stores credentials which can be found here. This option is only if you really want to have complete control of everything and are willing to put in the work. It is also the most difficult option, but gives you the greatest control over the end experience.

Static site form to email eloquent solution?

I have a static site that uses a contact form to get users in touch w me.
When it comes to posting the form data I want it to arrive in my email.
I'm looking for a clean eloquent solution here. I don't want to use any services that cost money such as fromspree and fromkeep.
I've looked into using Nodemailer and Express but since my site is a static site it really doesn't make sense to go set up these tools just for a contact form. I know PHP is the usual way to go about this type of request and I found this tutorial here.
If I where to use this tutorial any ideas on how I would modify it to use
the PHP lib that SendGrid developed to work with my simple form?
There is another approach to dealing with static site contact forms via hacking google forms through google apps script.
Any suggestions here? Or best known methods you for me to use?
You asked for services that do not cost money and you mention 'sendgrid' so I presume you don't have too many subscribers.
You can use SendGrid by using only client side JavaScript but you will have to put your password\api for anyone to see, that's a bad idea.
For static site I think you can use MailChimp. Just open a free account and you can use their integrated form to submit the forms to yourself.
If you don't want any third party, or SendGrid specifically, you should have to go with server side code. (NodeJS recommended, php also an option)
Update: sendgrid no longer provides a free account. You can go for mailjet instead.
Update: Today sendgrid support Signup forms too

How to monitor user actions without server side?

Our app is a widget based, for the client-side used mostly JavaScript. For the evaluation purpose information about user behaviour should be gathered. Is it possible to gather information about user click events without accessing server side code?
Your tag has the answer. You can use Google Analytics for tracking client side events.
Have a look at: https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
If I remember correctly, you can't create "funnels" on analitycs, so maybe a tool as mixpanel fits better (https://mixpanel.com/).

Is stripe.js is full alternative to the server code (gem stripe)?

Can I use https://stripe.com/docs/stripe.js a full alternative of the server side code, for example, gem stripe in Ruby? I figure I can do something in stripe.js but it will only get me so far. In particular, I can't create and manage Subscriptions, Invoice, InvoiceItems in stripe.js, can I?
Stripe.js will only permit you a secure but easy way of gathering payment information from your users.
You will still need some server-side or backend code to process the information and finalize the payment, or to manage anything else like subscriptions or invoice items with an API library for the programming language of your choice.

Categories