Skip to content

Plugin installation

Yashua edited this page Apr 12, 2018 · 5 revisions

Requirements

  • Hosting server with PHP 5.6.0+ (recommended latest stable version of PHP)
  • WordPress 4.8 or newer
  • WooCommerce 3.0 or newer
  • A FastSpring account

Plugin installation

Once you’ve obtained the zip file containing the plugin navigate to your WordPress admin dashboard » Plugins » Add New and use the “Upload Plugin” button to upload your plugin. Once done you can activate the plugin.

The settings for the plugin can be found under WooCommerce » Settings » Checkout - look for the FastSpring link under the list of payment methods.

The plugin has a number of fields to fill which will require some setting up of things on the FastSpring side of things so let’s address that right now. As we will be collecting information necessary for the plugin it will be easier for you to keep the WP plugin setting page open while you load your FastSpring dashboard in another tab.

Determining your storefront path

FastSpring offers the ability to use either A) the Popup Storefront method where users stay on your site and are presented with a popup allowing them to pay or B) the Web Storefront method where users are redirected to the FastSpring site to complete their payment.

The method you use is up to you and FastSpring support can assist you in making this decision. Once you’ve decided you’ll be able create your storefront by going to the FastSpring Dashboard » Storefronts » Web/Popup Storefront and clicking the “CREATE WEB/POPUP STOREFRONT” link near the top right

You’ll now need determine your correct storefront path.

If you’ve selected the Web Storefront method then navigate to the FastSpring Dashboard » Storefronts » Web Storefronts page and make note of the path to your store (ex: mystore.onfastspring.com)

If, on the other hand, you’ve opted for the Popup Storefront method then go to the FastSpring Dashboard » Storefronts » Popup Storefronts page and click the “PLACE ON YOUR WEBSITE” link. Look for the code section and make note of the path given for the data-storefront value (ex: mystore.onfastspring.com/popup-mystore).

Once you have the correct path (ensure there are no quotes or spaces) then paste that into the Storefront field of the plugin settings.

Whitelisting your domain

If you have opted to use the Popup Storefront method you will need to contact FastSpring support and ask them to whitelist your store domain.

Creating encryption keys

In order to ensure that the information sent to FastSpring remains secure we will need to create a secure SSL certificate. The method you use will depend on your operating system.

Creating keys on OSX/Linux

Open your terminal app (Found under Applications » Utilities in OSX). The first thing we will do is navigate to a folder of our choice - in this example we will use the OSX Desktop:

cd ~/Desktop

The next step will create our private key:

openssl genrsa -out privatekey.pem 2048

You should now have a privatekey.pem file in your selected folder. Keep this file private and do not share it with anyone.

In the following step we will create our public key:

openssl req -new -key privatekey.pem -x509 -days 3650 -out publiccert.pem

It will prompt you for a few questions regarding your locality and contact. Since we are using this privately between FastSpring and your store it’s not really important what you put here.

Creating keys on Windows

Creating keys on windows requires downloading an application. Please refer to this blog post for instructions.

Setting up your keys

After you are done you will now have 2 files - publiccert.pem and privatekey.pem.

Now navigate to the FastSpring Dashboard » Integrations » Store Builder Library page and, using the “File Upload” option, upload your public certificate (publiccert.pem). Remaining on the same page, copy the Access Key entry.

Returning to the plugin settings page, paste the access key into the Access Key field.

Using some kind of editor (TextEdit which is built in to OSX for example) open the private key file (privatekey.pem) and copy the content (-----BEGIN RSA PRIVATE KEY——…) and paste it into the Private Key field.

Receiving order notifications via webhooks or API

In order for your WP store to receive order information from FastSpring we will need to setup either a webhook and/or API keys. When using the popup storefront method only the webhook method is required and when using the web storefront then only the API is required. However, for the smoothest experience, it is recommended to setup both methods so that is what we will address here.

Setting up the webhook

A webhook is a way for FastSpring to call your store with information about each new order. Navigate to the FastSpring Dashboard » Integrations » Webhooks page and click on the “ADD WEBHOOK” link near the top right.

Enter whatever you want in the Title field and leave the rest as default and hit save.

Now, in the newly created box, click the ”ADD WEBHOOK URL” link. Back in your WordPress plugins settings page look for the Webhook Method Instructions field and copy the provided URL (ex: https://example.org/?wc-api=wc_gateway_fastspring) and paste that in the URL field of the box you just opened on the FastSpring side.

In the HMAC SHA256 Secret write a random selection of characters - say 10-20ish letter and numbers (ex: 8xfhqw8qaasd8qqasdas3). This is an additional level of security between FastSpring and your site.

Copy this generated string and paste it in the WordPress plugin:

Back in the FastSpring side of things select the following entries from the Events field:

  • order.completed
  • order.canceled
  • order.failed
  • subscription.activated
  • subscription.deactivated
  • subscription.canceled
  • subscription.updated

You can now click the “ADD” button to save your webhook.

Setting up API keys

We will now create our credentials for the plugin to access the FastSpring API. Navigate to the FastSpring Dashboard » Integrations » API Credentials page and click the “CREATE” button to generate a Username and Password.

Copy and paste each of these into the relevant fields in the WordPress plugin settings page:

Wrapping it up

We’ve now done all the hard part! All that is left is to fill in the remaining fields on the WordPress plugin settings page and save it. Most of these should be self explanatory.

Testing your store

FastSpring provides test credentials that can be used to test your installation. To find these, navigate to the FastSpring Dashboard » Storefronts » Web/Popup Storefront page and click the “TEST” link in the storefront box.

When using test credentials ensure that the checkbox for **Test mode” is selected in your WordPress plugin settings page.

You can now run some test order. If all goes well you should see your orders marked as completed upon successful checkout.

It’s useful to leave the Logging checkbox checked until you know your store is running smoothly.

Any error encountered by the plugin will be reflected in the logs which can be found under WooCommerce » Status » Logs and select the “woocomerce-gateway-fastspring…” entry from the drop down before click the “View” button. Logs can be cryptic but are invaluable in troubleshooting any issues.