Powerful Image Analysis With Google Cloud Vision And Python

Powerful Image Analysis With Google Cloud Vision And Python

Powerful Image Analysis With Google Cloud Vision And Python

Bartosz Biskupski

Quite recently, I’ve built a web app to manage user’s personal expenses. Its main features are to scan shopping receipts and extract data for further processing. Google Vision API turned out to be a great tool to get a text from a photo. In this article, I will guide you through the development process with Python in a sample project.

If you’re a novice, don’t worry. You will only need a very basic knowledge of this programming language — with no other skills required.

Let’s get started, shall we?

Never Heard Of Google Cloud Vision?

It’s an API that allows developers to analyze the content of an image through extracted data. For this purpose, Google utilizes machine learning models trained on a large dataset of images. All of that is available with a single API request. The engine behind the API classifies images, detects objects, people’s faces, and recognizes printed words within images.

To give you an example, let’s bring up the well-liked Giphy. They’ve adopted the API to extract caption data from GIFs, what resulted in significant improvement in user experience. Another example is realtor.com, which uses the Vision API’s OCR to extract text from images of For Sale signs taken on a mobile app to provide more details on the property.

Machine Learning At A Glance

Let’s start with answering the question many of you have probably heard before — what is the Machine Learning?

The broad idea is to develop a programmable model that finds patterns in the data its given. The higher quality data you deliver and the better the design of the model you use, the smarter outcome will be produced. With ‘friendly machine learning’ (as Google calls their Machine Learning through API services), you can easily incorporate a chunk of Artificial Intelligence into your applications.

Recommended reading: Getting Started With Machine Learning

How To Get Started With Google Cloud

Let’s start with the registration to Google Cloud. Google requires authentication, but it’s simple and painless — you’ll only need to store a JSON file that’s including API key, which you can get directly from the Google Cloud Platform.

Download the file and add it’s path to environment variables:

export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/apikey.json

Alternatively, in development, you can support yourself with the from_serivce_account_json() method, which I’ll describe further in this article. To learn more about authentication, check out Cloud’s official documentation.

Google provides a Python package to deal with the API. Let’s add the latest version of google-cloud-vision==0.33 to your app. Time to code!

How To Combine Google Cloud Vision With Python

Firstly, let’s import classes from the library.

from google.cloud import vision
from google.cloud.vision import types

When that’s taken care of, now you’ll need an instance of a client. To do so, you’re going to use a text recognition feature.

client = vision.ImageAnnotatorClient()

If you won’t store your credentials in environment variables, at this stage you can add it directly to the client.

client = vision.ImageAnnotatorClient.from_service_account_file(
'/path/to/apikey.json'
)

Assuming that you store images to be processed in a folder ‘images’ inside your project catalog, let’s open one of them.

Image of receipt that could be processed by Google Cloud Vision
An example of a simple receipt that could be processed by Google Cloud Vision. (Large preview)
image_to_open = 'images/receipt.jpg'

with open(image_to_open, 'rb') as image_file:
    content = image_file.read()

Next step is to create a Vision object, which will allow you to send a request to proceed with text recognition.

image = vision.types.Image(content=content)

text_response = client.text_detection(image=image)

The response consists of detected words stored as description keys, their location on the image, and a language prediction. For example, let’s take a closer look at the first word:

[
...
description: "SHOPPING"
bounding_poly {
  vertices {
    x: 1327
    y: 1513
  }
  vertices {
    x: 1789
    y: 1345
  }
  vertices {
    x: 1821
    y: 1432
  }
  vertices {
    x: 1359
    y: 1600
  }
}
...
]

As you can see, to filter text only, you need to get a description “on all the elements”. Luckily, with help comes Python’s powerful list comprehension.

texts = [text.description for text in text_response.text_annotations]

['SHOPPING STORE\nREG 12-21\n03:22 PM\nCLERK 2\n618\n1 MISC\n1 STUFF\n$0.49\n$7.99\n$8.48\n$0.74\nSUBTOTAL\nTAX\nTOTAL\nCASH\n6\n$9. 22\n$10.00\nCHANGE\n$0.78\nNO REFUNDS\nNO EXCHANGES\nNO RETURNS\n', 'SHOPPING', 'STORE', 'REG', '12-21', '03:22', 'PM', 'CLERK', '2', '618', '1', 'MISC', '1', 'STUFF', '$0.49', '$7.99', '$8.48', '$0.74', 'SUBTOTAL', 'TAX', 'TOTAL', 'CASH', '6', '$9.', '22', '$10.00', 'CHANGE', '$0.78', 'NO', 'REFUNDS', 'NO', 'EXCHANGES', 'NO', 'RETURNS']

If you look carefully, you can notice that the first element of the list contains all text detected in the image stored as a string, while the others are separated words. Let’s print it out.

print(texts[0])

SHOPPING STORE
REG 12-21
03:22 PM
CLERK 2
618
1 MISC
1 STUFF
$0.49
$7.99
$8.48
$0.74
SUBTOTAL
TAX
TOTAL
CASH
6
$9. 22
$10.00
CHANGE
$0.78
NO REFUNDS
NO EXCHANGES
NO RETURNS

Pretty accurate, right? And obviously quite useful, so let’s play more.

What Can You Get From Google Cloud Vision?

As I’ve mentioned above, Google Cloud Vision it’s not only about recognizing text, but also it lets you discover faces, landmarks, image properties, and web connections. With that in mind, let’s find out what it can tell you about web associations of the image.

web_response = client.web_detection(image=image)

Okay Google, do you actually know what is shown on the image you received?

web_content = web_response.web_detection
web_content.best_guess_labels
>>> [label: "Receipt"]

Good job, Google! It’s a receipt indeed. But let’s give you a bit more exercise — can you see anything else? How about more predictions expressed in percentage?

predictions = [
(entity.description, '{:.2%}'.format(entity.score))) for entity in web_content.web_entities
]

>>> [('Receipt', '70.26%'), ('Product design', '64.24%'), ('Money', '56.54%'), ('Shopping', '55.86%'), ('Design', '54.62%'), ('Brand', '54.01%'), ('Font', '53.20%'), ('Product', '51.55%'), ('Image', '38.82%')]

Lots of valuable insights, well done, my almighty friend! Can you also find out where the image comes from and whether it has any copies?

web_content.full_matching_images
 >>> [
url: "http://www.rcapitalassociates.com/wp-content/uploads/2018/03/receipts.jpg", 
url:"https://media.istockphoto.com/photos/shopping-receipt-picture-id901964616?k=6&m=901964616&s=612x612&w=0&h=RmFpYy9uDazil1H9aXkkrAOlCb0lQ-bHaFpdpl76o9A=", 
url: "https://www.pakstat.com.au/site/assets/files/1172/shutterstock_573065707.500x500.jpg"
]

I’m impressed. Thanks, Google! But one is not enough, can you please give me three examples of similar images?

web_content.visually_similar_images[:3]
>>>[
url: "https://thumbs.dreamstime.com/z/shopping-receipt-paper-sales-isolated-white-background-85651861.jpg", 
url: "https://thumbs.dreamstime.com/b/grocery-receipt-23403878.jpg", 
url:"https://image.shutterstock.com/image-photo/closeup-grocery-shopping-receipt-260nw-95237158.jpg"
]

Sweet! Well done.

Is There Really An Artificial Intelligence In Google Cloud Vision?

As you can see in the image below, dealing with receipts can get a bit emotional.

Man screaming and looking stressed while holding a long receipt
An example of stress you can experience while getting a receipt. (Large preview)

Let’s have a look at what the Vision API can tell you about this photo.

image_to_open = 'images/face.jpg'

with open(image_to_open, 'rb') as image_file:
    content = image_file.read()
image = vision.types.Image(content=content)

face_response = client.face_detection(image=image)
face_content = face_response.face_annotations

face_content[0].detection_confidence
>>> 0.5153166651725769

Not too bad, the algorithm is more than 50% sure that there is a face in the picture. But can you learn anything about the emotions behind it?

face_content[0]
>>> [
...
joy_likelihood: VERY_UNLIKELY
sorrow_likelihood: VERY_UNLIKELY
anger_likelihood: UNLIKELY
surprise_likelihood: POSSIBLE
under_exposed_likelihood: VERY_UNLIKELY
blurred_likelihood: VERY_UNLIKELY
headwear_likelihood: VERY_UNLIKELY
...
]

Surprisingly, with a simple command, you can check the likeliness of some basic emotions as well as headwear or photo properties.

When it comes to the detection of faces, I need to direct your attention to some of the potential issues you may encounter. You need to remember that you’re handing a photo over to a machine and although Google’s API utilizes models trained on huge datasets, it’s possible that it will return some unexpected and misleading results. Online you can find photos showing how easily artificial intelligence can be tricked when it comes to image analysis. Some of them can be found funny, but there is a fine line between innocent and offensive mistakes, especially when a mistake concerns a human face.

With no doubt, Google Cloud Vision is a robust tool. Moreover, it’s fun to work with. API’s REST architecture and the widely available Python package make it even more accessible for everyone, regardless of how advanced you are in Python development. Just imagine how significantly you can improve your app by utilizing its capabilities!

Recommended reading: Applications Of Machine Learning For Designers

How Can You Broaden Your Knowledge On Google Cloud Vision

The scope of possibilities to apply Google Cloud Vision service is practically endless. With Python Library available, you can utilize it in any project based on the language, whether it’s a web application or a scientific project. It can certainly help you bring out deeper interest in Machine Learning technologies.

Google documentation provides some great ideas on how to apply the Vision API features in practice as well as gives you the possibility to learn more about the Machine Learning. I especially recommend to check out the guide on how to build an advanced image search app.

One could say that what you’ve seen in this article is like magic. After all, who would’ve thought that a simple and easily accessible API is backed by such a powerful, scientific tool? All that’s left to do is write a few lines of code, unwind your imagination, and experience the boundless potential of image analysis.

Smashing Editorial (rb, ra, il)

How to Design Your Algorithmic Trading Strategy

In previous articles, we have illustrated how API trading benefits traders and explained how simple it is to get started. In this article, we will discuss a key element to API trading: the trading strategy. A trading strategy is a set of rules used to execute trades, which will vary depending on the trader’s approach to the markets.

TrueLayer Expands Banking API to Germany

TrueLayer, banking API provider, has announced that it is expanding the geographic scope of its Data API to include Germany. Starting this month, January 2019, TrueLayer will add select partners to a private beta of the Germany Data API. This is TrueLayer's first major international expansion beyond the UK.

Canon Launches New SDK and API Package for Select Cameras

Canon Europe announces the release of its new camera API package, offering a range of resources to developers. The combined EOS Digital software development kit (SDK) and all-new Camera Control API (CCAPI) create unique opportunities for developers and software engineers to take advantage of select Canon cameras and lenses, launching with the PowerShot SX70 HS.

The Fragmented, But Evolving State of CSS-in-JS

TLDR: The CSS-in-JS community has converged on a consistent API.

Not so long ago, a Facebook engineer compiled a list of the available CSS-in-JS methodologies. It wasn’t short:

aphrodite, babel-plugin-css-in-js, babel-plugin-pre-style, bloody-react-styled, classy, csjs, css-constructor, css-light, css-loader, css-ns, cssobj, cssx-loader, cxs, electron-css, emotion, es-css-modules, freestyler, glamor, glamorous, hiccup-css, hyperstyles, i-css, j2c, jsxstyle, linaria, nano-css, pre-style, radium, react-css-builder, react-css-components, react-css-modules, react-cssom, react-fela, react-free-style, react-inline-css, react-inline-style, react-inline, react-jss, react-look, react-native-web, react-statics-styles, react-styl, react-style, react-styleable, react-stylematic, react-theme, react-vstyle, reactcss, restyles, scope-styles, smart-css, stile-react-media-queries, stilr, stylable, style-it, styled-components, styled-jsx, styletron-react, styling, superstyle, typestyle, uranium

Such a fragmented ecosystem was far from appealing. Which one should you pick, (if any)?

Contributing to Javascript fatigue — you need at most one. Also feel free to not learn any.

GitHub stars are one useful metric:

However, GitHub stars say nothing about a project’s trajectory — perhaps they were accumulated long ago and the repo has since fallen out of favor or is no longer maintained. Glamor has plenty of open issues, and hasn’t seen a commit in over a year. Its author advises:

...it mostly works, I'm not going to do any major changes… if you need something more modern, I'd recommend emotion, it mostly matches glamor's api, and is actively maintained.

The similarly named Glamorous was recently deprecated with its author also recommending users switch to Emotion:

At the time, Emotion had some features that Styled Components didn’t. Since then, Styled Components has made some big announcements.

Styled Components sells itself as the CSS-in-JS library for people that *like* CSS. Styled Components gained popularity by utilizing tagged template literals — allowing developers to *just write CSS* in the same syntax they already know, but inside JavaScript files. While this has proven popular, some developers prefer to [write styles as JavaScript objects. Emotion offered flexibility — developers could choose how to write their styles. Styled Components eventually followed suit.

Emotion also offers a css prop, which Styled Components didn’t have, until…

The rival CSS-in-JS libraries have stolen from each other until landing upon the same feature set and the same syntax — Emotion and Styled Components have an almost identical API. What once felt like a total mess of competing methodologies and libraries now feels somewhat stable. Even if CSS-in-JS hasn’t standardized on a dependency, it now has standardized a way of doing things — they’re just implemented differently:

Styled Components is by far the most popular CSS-in-JS library, but Emotion has seen a rapid increase in usage.

Both are used by some major companies. Styled Components are utilized by plenty of large companies, including Bloomberg, Atlassian, Reddit, Target, BBC News, The Huffington Post, Coinbase, Patreon, Vogue, Ticketmaster, Lego, InVision and Autodesk just to name a few.

Emotion boasts fewer recognizable names, but has been recently adopted by the New York Times.


While these libraries certainly do seem to be most popular amongst React users, they can be used with other frameworks. While they seem to have converged on the same features at last, it’s difficult to say whether this is the end point of CSS-in-JS, or whether we’ll see a continued evolution from here.

The post The Fragmented, But Evolving State of CSS-in-JS appeared first on CSS-Tricks.

Restoring Firefox Extensions After The Firefox 43 Update

Firefox recently updated to version 43 & with that, they automatically disabled all extensions which are not signed, even if they were previously installed by a user and used for years.

If you go to the add ons screen after the update (by typing about:addons in the address bar) you will see a screen like this

Extensions which are submitted to the Mozilla Firefox add ons directory are automatically signed when approved, but other extensions are not by default:

Only Mozilla can sign your add-on so that Firefox will install it by default. Add-ons are signed by submitting them to AMO or using the API and passing either an automated or manual code review. Note that you are not required to list or distribute your add-on through AMO. If you are distributing the add-on on your own, you can choose the Unlisted option and AMO will only serve as the way to get your package signed.

In a couple days we will do that submission to get the add ons signed, but if you recently had the extensions go away it is fairly easy to override this signing feature to get the extensions back working right away.

Step 1: go to the Firefox settings configuration section

Type about:config into the address bar & hit enter. Once that page loads click on the “I’ll be careful, I promise” button.

Step 2: edit the signing configuration

Once the configuration box loads you’ll see a bunch of different listed variables in it & a search box at the top. In that search box, enter
xpinstall.signatures.required

By default xpinstall.signatures.required is set to TRUE to force add ons to be signed. Click on it until it goes to bold, which indicates that the TRUE setting is set to FALSE.

Step 3: restart Firefox

After changing the add on signature settings, restart Firefox to apply the setting & your Firefox extensions will be restored.

Categories: 

Powered by WPeMatico

Collective #336









C336_Shoelace

Shoelace.css

Highly customizable through CSS variables, Shoelace.css is a starter kit with helpful components.

Check it out





C336_Chain

Chain

A Sketch plugin for maintaining dynamic color relations in a design.

Check it out




C336_Laravel

Laravel Web Installer

This Laravel package allows users who don’t use Composer, SSH etc. to install your application just by following the setup wizard. By Rachid Laasri.

Check it out


C336_WebGLInsights

WebGL Insights

A book that presents real-world techniques for intermediate and advanced WebGL developers. Edited by Patrick Cozzi. Now available for free.

Read it







C336_TheJSWay

The JavaScript Way

Beta stage of a book for anyone who wants to (re)discover the many facets of JavaScript. By Baptiste Pesquet.

Read it




C336_AnimatedImagePieces

From Our Blog

Animated Image Pieces

A set of experiments with an animated image pieces effect where an image gets shattered into rectangular fragments. Powered by anime.js.

Check it out

Collective #336 was written by Pedro Botelho and published on Codrops.

Making A Service Worker: A Case Study


  

There’s no shortage of boosterism or excitement about the fledgling service worker API, now shipping in some popular browsers. There are cookbooks and blog posts, code snippets and tools. But I find that when I want to learn a new web concept thoroughly, rolling up my proverbial sleeves, diving in and building something from scratch is often ideal.

Making A Service Worker: A Case Study

The bumps and bruises, gotchas and bugs I ran into this time have benefits: Now I understand service workers a lot better, and with any luck I can help you avoid some of the headaches I encountered when working with the new API.

The post Making A Service Worker: A Case Study appeared first on Smashing Magazine.

Powered by WPeMatico

Top eCommerce Payment Gateways for WordPress

Okay, so you’ve created a kickass design, your site’s running in tip-top shape, and your visitors are more than ready to convert. What more could you ask for?

But then your soon-to-be-customers get to the payment gateway and don’t see their preferred provider listed. Or there’s a security warning that’s thrown them off-guard. Or, even worse, they change their minds, want to go back to the site to add another item to their cart, but they realize they’re no longer on your site and don’t know how to get back.

So, what can you do to ensure that UX issues like the ones mentioned above don’t keep your visitors from converting? There’s really only one thing you can do: choose a payment gateway provider (or providers) that will provide a reliable and secure experience.

In this post I’m going to:

  • Explain what payment gateways are and how they work
  • Show you some popular payment gateways, how much they cost and how to use them
  • Talk about how you can integrate these payment gateways with WordPress

If you already know what a payment gateway is, feel free to skip ahead to the section on popular gateways and WordPress integration. :)

What Is a Payment Gateway?

To briefly describe what a payment gateway is, it’s a third-party tool that evaluates and processes payments from your customers. So, rather than set up a basic contact form that requires customers to fill in their information to place an order—which you would then need to manually process on your end—the payment gateway handles it on your behalf.

There are a number of benefits to using a payment gateway. The time savings is obviously one of them. There’s also the matter of PCI compliance. And there’s the flexibility in payment types you can accept by using a payment processing tool.

Of course, like with any other third-party system you bring into your WordPress site, there are a number of things that must be taken into consideration. Here is what you will need to think about:

Cost

With most third-party integrations, there’s almost always an upfront cost associated with it. However, when it comes to payment processors, you also need to take a closer look at the fine print as there are fees you’ll need to pay for each transaction processed. There are some that also charge your customers a fee in order to use the payment gateway—and nothing screams “depart this transaction immediately” more than an unexpected cost.

Payment Location

Some payment gateways enable users to add the payment gateway directly onto their site through an API. This can be a good thing as it prevents that feeling of disruption as visitors are shuttled to a different website to enter their payment information. However, there are some payment gateway providers that are so well-known and trusted (think of PayPal) where the disruption might not matter that much if customers feel more confident submitting payment information through that site instead of your own.

That’s ultimately what you need to keep in mind here: what will your customers be more comfortable with. Do they want one seamless process that occurs entirely on your site or would they be more comfortable paying through a well-known provider? You can use A/B testing to see which option leads to higher conversions or you can solicit feedback from your customers and ask them directly what they prefer.

Merchant Account

You may run into a number of payment processors who require you to have a separate merchant account into which funds are deposited, which means yet another step you have to take care of in order to get your online payment system up and running. However inconvenient that may seem right now, though, it’s important to note that payment gateways who don’t require merchant accounts and are willing to directly deposit funds into your account are more likely to charge you a higher processing fee.

Security

Obviously, this point can’t be stressed enough as security shouldn’t stop even if the purchase experience is handed over to another party. Your payment gateway should be just as secure to use, if not more, than your own website. This means they need an SSL certificate, additional encryption, and must be PCI compliant.

Countries Accepted

The first thing to do before signing with any payment processor is to check your site’s analytics. This will tell you which countries your visitors are located in, so you can include country-compatible payment methods, currencies, and translations in your payment gateway.

Taxes

If you’re collecting revenue through your site, you need an easy way to collect the appropriate amount of taxes. While there will, of course, be local taxes, you’ll also have to be aware of country or region-specific taxes, like the value-added tax (VAT) in the EU. So, if you know you’re going to sell goods out of state or country, your payment gateway should be equipped to calculate those taxes for you.

Automated Payments

For product sales, this might not be something you need to worry about. However, for those of you offering a recurring service or something that customers will purchase frequently enough, automated payments are definitely worth thinking about. One way to do this is to create an option for recurring payments. You may also want to create an auto-pay method whereby payment information from previous transactions can be saved so customers don’t have to re-enter it every time.

Plugin Compatibility

If your site is making sales, then you most definitely have an eCommerce or shopping cart plugin at your disposal. Not every payment gateway will work with your plugin of choice, so confirm compatibility before signing up.

Design

And, of course, you’ve got to think about the design of the payment gateway. Will it allow for branding personalization so that it matches your site? Is it mobile responsive? How intuitive is it in terms of layout, numbers of steps or pages, etc.? Again, this is still part of your customers’ experience and you don’t want bad design to ruin that.

Best Payment Gateways for WordPress

Alright, so now that you know what you’re looking for, let’s narrow down that search and compare the best payment gateway providers for WordPress.

  • PayPal Payments Pro

    If you need a little extra out of PayPal, their Pro option is worth consideration:

    • Cost: There’s a $30 monthly fee to use this service, in addition to the per-transaction fee assessed.
    • Payment Location: You won’t have to send customers to PayPal. They’ll see the recognizable and trusted logo on your site, but they can stay right where they are to make a payment.
    • Merchant Account: There’s no need for one with PayPal, but you do have the option if you want a quick and easy way to deposit funds into your bank account.
    • Security: PayPal provides you with options to keep transactions on your site PCI compliant.
    • Global Friendliness: PayPal accepts only six currencies from credit card providers. If customers make PayPal payments, though, they’ll take over 25 currencies from 200+ markets.
    • Payment Methods Accepted: Because this is PayPal, a good portion of the payment types available come from them, including: PayPal standard payments, PayPal credit, as well as PayPal special financing. You can also accept credit cards, bank transfers, and even phone-based credit card payments.
    • Automated Payments: I don’t believe this is an option.
    • Plugin Compatibility: PayPal Pro supports most major shopping carts.
    • Design: The UI is fully customizable. It also works across all devices, so you won’t have to worry about the mobile payment experience.

    Interested in PayPal Payments Pro?

  • Stripe

    Stripe is definitely not lacking in features:

    • Cost: There are no setup or monthly fees. Aside from the usual per-transaction charges, the only costs you have to worry about are from customer chargebacks.
    • Payment Location: You can create a totally custom checkout for your site or you can use their pre-built Checkout.
    • Merchant Account: No need for a merchant account.
    • Security: If you’re keeping customers on your site to process payments, Stripe offers developers the option to use client-side tokenization to ensure PCI compliance.
    • Global Friendliness: Strips works in over 100 countries (for your and your customers’ base of operations) and accepts over 135 currencies. There’s no change for currency conversion either.
    • Payment Methods Accepted: Stripe accepts all major credit cards, bank and debit payments, Bitcoin, and digital payments from Apple Pay and Android Pay. Their API tools also enable developers to set up alternative payment processing options like selling products from a tweet.
    • Automated Payments: Stripe is set up to help all e-commerce business types: basic stores, on-demand marketplaces, subscription services, and even crowdfunding.
    • Design: This tool was built with the developer in mind, so its capabilities can be extended with simple APIs.
  • 2CheckOut

    Here are just a few of 2CheckOut’s features:

    • Cost: In addition to the standard fees per transaction, they also charge for international transactions and currency conversion.
    • Payment Location: You can either use the API to put the checkout on your site or you can use “inline” checkout which moves the process to their site while making it still look like it’s on yours.
    • Merchant Account: You need a merchant account in order to accept payments.
    • Security: They are Level 1 PCI compliant.
    • Global Friendliness: Their payment gateway is offered in 15 languages, includes 87 currency options, and they’ll process payments in over 200 markets.
    • Payment Methods Accepted: They accept credit card, debit card, and PayPal payments, among others.
    • Automated Payments: You can create pricing plans, flexible billing schedules, automated payments, and more.
    • Plugin Compatibility: Works with WooCommerce, WP e-commerce, Zoho, Shopify, osCommerce, and more.
    • Design: You can brand the gateway to match your site. The checkout page is also mobile-friendly.
  • Authorize.net

    Authorize.net is another widely accepted gateway that might offer precisely what you need:

    • Cost: There’s an initial $49 setup fee, a $25 monthly fee, as well as per-transaction fee.
    • Payment Location: It’s up to you: this can go on your site or on Authorize.net’s.
    • Merchant Account: You’ll need a merchant bank account to collect your payments.
    • Security: You’ll have free access to Authorize.net’s fraud protection tools if you integrate gateway on your site. Otherwise, Authorize.net is PCI DSS certified.
    • Global Friendliness: While you’re free to accept payments from around the world, you must reside in the U.S., Canada, UK, Europe, or Australia in order to use this service.
    • Payment Methods Accepted: Payment types include credit card, Authorize.net e-checks, as well as digital payments like Apple Pay, PayPal, and VisaCheckout.
    • Automated Payments: There are a number of options available. You can store customer information for future transactions, set up subscriptions, or create dynamic recurring billing schedules.
    • Plugin Compatibility: Works with e-commerce and banking plugins like BigCommerce, Shopify, Magento, Moolah, QuickBooks, and Wells Fargo.
    • Design: You’re free to personalize the look of your checkout page to match your brand.

    Interested in Authorize.net?

  • Braintree

    Braintree offers another way to accept payments on your WordPress site. Check out some of its features:

    • Cost: There are no monthly fees to use Braintree, just the standard per-transaction fee. Note that the fee depends on which country you’re processing payments from.
    • Payment Location: You can use Braintree’s hosted service or you can use their drop-UI to put it directly on your site.
    • Merchant Account: Since this is a PayPal service, you don’t need a merchant account.
    • Security: Advanced fraud protection is included with this service.
    • Global Friendliness: Braintree’s service will process payments in over 130 currencies and for customers in 44 countries.
    • Payment Methods Accepted: You can accept payments from PayPal, credit cards, Apple Pay, Venmo, Masterpass, and more. In addition, you can split payments with other partners or providers.
    • Automated Payments: There are recurring billing options for repeat customers, subscription-based services, as well as donations.
    • Plugin Compatibility: This tool will integrate with a huge range of e-commerce and sales tools like Salesforce, Magento, Freshbooks, BigCommerce, and 3dcart.
    • Design: You can customize the design of the checkout or use their ready-made interface.
  • Square

    Square also lets you accept payments online easily. Check out Square’s features:

    • Cost: No monthly fee and 2.2% per transaction.
    • Payment Location: Although Square provides its own online store building platform, you can use Square’s APIs to accept payments directly on a WordPress website that you build yourself, or use plugins like a WooCommerce extension to integrate Square’s payment processing and other tools with your online store.
    • Merchant Account: You need a transactional bank account in case of refunds or disputed payments.
    • Security: They are Level 1 PCI compliant and offer layered security with fraud prevention methods.
    • Global Friendliness: At this time, WooCommerce Square is currently only available for the U.S., Canada, Australia, Japan and the UK.
    • Payment Methods Accepted: All major credit and debit cards are accepted. Payments are deposited into your linked bank account next business day with their standard schedule, or you can create a custom payment schedule to suit odd business hours.
    • Automated Payments: You can receive automated payments for single and recurring transactions.
    • Plugin Compatibility: Works with WooCommerce, WP EasyCart, Ecwid.
    • Design: You can customize the gateway to match your site. The checkout page is also mobile-friendly.

Integrating Payment Gateways with WordPress

Here’s the thing about payment gateways: you might not be responsible for designing them or developing the code that processes payments in the first place, but that doesn’t mean you can wipe your hands clean of what happens once your visitors land on them. If you’re including a payment gateway on your site, then it’s a part of your visitors’ experience and needs to be accounted for as you shape that experience for them, so it’s important to integrate your payment gateway correctly not just with WordPress, but also any plugins used to enhance or extend your site’s functionality.

For example, our Forminator plugin not only lets you add forms, quizzes, polls, and calculators to your site, but also take payments, donations, down payments, and sell merchandise with built-in Stripe and PayPal integrations. The video below shows you how to build order forms with payments for free in WordPress using the plugin’s payment integration features:

Different types of applications like Learning Management Systems (LMS), membership sites, and listing directories have built-in payment integrations with WordPress.

Below are some plugins that help to make integrating payment gateways and WordPress easier:

  • WooCommerce Square

    WooCommerce Square is a free plugin that lets you integrate the Square payment gateway on WordPress to sync inventory and product data between WooCommerce and Square POS.

    Some of the benefits and features of using this plugin for payment integration with WordPress include:

    • PCI compliant payment processing option that meets SAQ A levels of compliance.
    • Support for WooCommerce Subscriptions
    • Support for WooCommerce Pre-Orders
    • Allow customers to save payment methods and use them at checkout
    • Use an enhanced payment form with automatic formatting, mobile-friendly inputs, and retina card icons
    • Sync product data automatically between WooCommerce and Square.

    See the plugin documentation for setup instructions.

  • WP Easy Pay – Square for WordPress

    WP Easy Pay – Square for WordPress is another free plugin you can use to integrate WordPress with the Square payment gateway and accept simple payments and donations if you are not using WooCommerce or don’t need to add a shopping cart to your store.

    Some of the highlights of using this plugin for payment integration with WordPress include:

    • SCA (Strong Customer Authentication) support.
    • Sandbox support allows you to see test transactions in Square Dashboard.
    • Use a single button to collect donations and simple payments.
    • Users can enter custom amounts to make payments for donations.

    The plugin also has a premium version with additional features like support for digital wallets, email notifications, and reports.

  • WooCommerce Stripe Payment Gateway

    WooCommerce Stripe Payment Gateway is a free plugin that lets you accept Stripe payments through WooCommerce and add payment request buttons like Apple Pay and Google Pay and other payment methods on your website. It also supports recurring payments like subscriptions.

  • Stripe Payments

    The Stripe Payments plugin lets you integrate your WordPress site with the Stripe payment gateway to accept credit card payments.

    Once installed and configured, you can add ‘Buy Now’ buttons anywhere on your site using a simple shortcode and accept donations. After users purchase online with one-click payments, they are redirected to a “Checkout Result” page showing details of the transaction. Payment and order information can then be accessed from your WordPress dashboard.

  • Stripe Payments for WordPress – WP Simple Pay

    WP Simple Pay is a free standalone Stripe Checkout plugin that lets you accept credit card payments with Stripe Checkout on your WordPress site with no complex shopping cart, form builder or membership site plugin required.

    The free version comes with many built-in features, including unlimited payment forms, mobile responsive Stripe Checkout pages, product images display in Stripe Checkout page, optional verification and capture of user details, and the ability to specify payment success & failure pages. The paid version offers additional features including support for subscription payments and options.

  • WooCommerce PayPal Checkout Payment Gateway

    If you’re using WooCommerce, you can add this free plugin to integrate your site with a PayPal in-context checkout payment gateway, which remains hosted on PayPal’s servers, allowing your site to meet security requirements without affecting your theme.

    Refer to the documentation to learn how to integrate this plugin using PayPal’s easy setup method.

  • WordPress Simple PayPal Shopping Cart

    WordPress Simple PayPal Shopping Cart is a free plugin that lets you insert an ‘Add to Cart’ button on any post or page using shortcodes and display the shopping cart on your pages or sidebar. The plugin also has an option to use smart PayPal payment buttons and various additional features.

    See the plugin’s documentation section and video tutorials for setup and integration information.

  • 2Checkout Payment Gateway for WooCommerce

    If you want to process payments online using 2Checkout (2CO), this plugin integrates with your WooCommerce store to provide itemized checkout and pass all billing and shipping data to the 2CO purchase page.

Getting Paid Is The Easy Part

By this point, you should have a pretty good idea of what you want your payment gateway to do and have a few providers you’re thinking of using:

  • Square offers relatively low processing fees and lets small businesses and independent sellers accept most consumer credit cards and facilitate cashless transactions.
  • Stripe is the most developer-friendly platform, so if you really want to get into personalizing your checkout page, this is a good option to have.
  • PayPal is a great choice if you want to leverage the trusted name of a payment processor that over 184 million people already use.
  • 2Checkout seems to be the most global-friendly of the options, so if you’re hoping to cast a wider net, that may be the one you want to turn to.

Probably the easiest way to integrate payment processing gateways with WordPress is to use an eCommerce plugin that already has an extensive list of payment options built-in.  Many eCommerce plugins not only give you this option, most will even provide links, wizards, and helpful tooltips to facilitate this process, so all you have to do is sign up for an account with the merchant, enter a registration code or special key into a settings field, and boom diggity… you’ve saved a whole lot of time!

One last thing to think about when researching payment gateways is how you’re going to deliver customers their goods after collecting their money, especially if you plan to sell physical goods. That’s why we’ve written a companion piece on the top eCommerce plugins for shipping products.

If you haven’t built your eCommerce site yet, make sure to read our comprehensive guide to planning an eCommerce store with WordPress before getting started.