Building a pay per view Membership site in Facebook - YourMembers/yourmembers GitHub Wiki

Facebook is the dominant social media network, and with over 750m users worldwide it has become its own ecosystem within the web. With the introduction of apps and games a few years ago many of its users had no need for the rest of the web. For them Facebook is a safe walled garden.

Recently the BBC launched their first money making attempts on Facebook via BBC Worldwide in the form of paying for streamed episodes of Dr Who. Dr Who in Facebook The concept is simple; log into Facebook, enable the app, pay with Facebook credits for 48 hours worth of a Dr Who episode. Now imitation is the sincerest form of flattery so here is how to do exactly that using a copy of Your Members Pro.

What will you need?

In addition to your normal WordPress blog on your site, you will also need Amazon Credentials as we will be using Amazon S3 and its Cloudfront service. In addition for this tutorial you will need at the Pro version of Your Members which includes both Facebook and Secure Stream.

Installation

Assuming you haven’t already, you will need to upload Your Members core, secure stream and Facebook plugins to your plugins folder and via the admin interface and activate the core plugin. Before activating the other plugins, go to the Your Members tab, type in your email for activation and agree to the TOS once you have reached the dashboard return to the plugin page and activate Secure Stream and Facebook.

Creating Packages

As we are creating a Pay Per View system, we do not need a continual subscription, but we do wish to store users data to make purchases easier, so we will create a single free package. A package contains all the information about a subscription from the price, package type plus any unique conditions such as if they can see old content etc. To create a package within the Your Members Admin area you will need to navigate to:

Membership -> Packages

If this is a default install of Your Members then you will already have a couple of packages for this tutorial go ahead and delete them. Once deleted select “Add new Pack”, and “Basic” Choose: Price “0” Account Type (Package Type) “Free” Duration “5 years”

Click “Submit” and a new package will be created

Secure Video

Once your package is set up the next step is to setup secure storage for video files using Amazon S3 and Cloudfront. Amazon s3 provides a storage area, while Cloudfront allows real video streaming over traditional progressive download.

Before you begin you will need to have amazon credentials which can be found (https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key) on Amazon web site. where to get your keys Within Your Members navigate to Secure Stream -> Settings from the amazon credentials page you will need to copy:

  • user key
  • secret key
  • Key pair ID

In addition you will need to download your private key PEM file. Open this in a text editor like notepad and copy the entire contents to the Key Pair Private Key box.

Click save.

Next navigate to Amazon S3 interface (https://console.aws.amazon.com/s3/home) and create a new bucket, give it a unique name and click create. Within the bucket, upload the cross site XML document (http://yourmembers.co.uk/wp-content/uploads/crossdomain.xml). This will allow files to be played by remote clients. You can also upload your videos now, or can do so later, but upload the video in the same way. There are several clients available to Amazon S3 bucket for windows and mac, which may be less clumsy than the web interface.

Finally within Your Members navigate to Secure Stream -> Cloud Front

Select: Distribution type -> Streaming OAI -> New Amazon bucket to deploy -> the one you just created

Hit submit. Your Cloud Front distribution is now being created by Amazon. Please note it can take up to 15 minutes. Time for a coffee break then and if you haven’t already done so upload your videos.

For more detailed instructions on accessing the keys and setting up Secure Stream with Cloud front please see (http://www.yourmembers.co.uk/the-support/guides-tutorials/your-secure-stream-s3-cloudfront/) Cloud Front installation.

JW Player

Secure Stream will work with most web based video players via the custom player option however it has quick setup options for both JW player and Flow Player. For this tutorial we will use J.W Player within Your Members navigate Secure Stream -> Settings and from supported players select Install for JW Player. Depending on your permission settings this should perform an automatic installation of the office WordPress player and activate it for you. If your security permissions prevent this then the download link will be made available, and you will need to manually install the plugin.

Creating the Individual Purchases For each video you upload you will need to create an individual WordPress page, give each page the title of the video a short description in the body and also in the body the following: [private] [yss_player id=] [/private] Note the empty id, we will insert the IDs in a moment. On the right hand side set the Your Members panel to show the Pay Per Post information with the following details: Is this post available to purchase -> yes Post cost -> 10 Buyer access period -> 2

This will make this post available to purchase at the cost of “10” (in this case it will be Facebook Credits) for the period of 2 days.

Next navigate to -> Secure Stream -> Content and select Add new Video From the drop down select the video you wish to add (note if you don’t see it there make sure you added it to your bucket) Then tick the Restrict by post option and select the post you created. Save. When you are returned to the main screen, click the link under distribution and set to streaming, save. This will activate the file. Finally take a note of the ID of the video and return to the page you created and in the player shortcode add the ID. Repeat for each video.

Setting Your Members in Facebook

To setup Facebook you will need to create an application. Each application is unique to your site. To setup an application follow the wizard provided by Facebook (http://developers.facebook.com/setup) Once completed you should have an application ID and a Secret key. Getting your facebook secret key

Navigate to Your Members -> Facebook -> Facebook -> Application Keys and add both keys. Click save.

Facebook Application can allow multiple modes, including a mixed Facebook/ non facebook mode but for this tutorial we will only be working in Facebook so: Navigate Your Members -> Facebook -> Settings -> Access Settings and set the following: Force Facebook -> Yes Force Application Add -> yes Force Redirect -> yes

This means users will only be able to access the site in Facebook and must add the site as an application to access the material on the site.

By default Your Members provides a basic theme for Facebook however you can override this theme by placing within your theme a fb.php file and then within Your Members navigate to Facebook -> Settings -> Content Settings and enabling fb.php

Facebook data collection

By default we don't collect any information about the user, however when we turned the force application we can now access additional data, and store this on our site, allowing us to remember users sale purchase history for example. To turn this on navigate to Your Members -> Facebook -> Settings -> Registration settings and enable the following: Hidden Register with Facebook -> yes Hidden Register Subscription -> select the package we setup earlier from drop down

Hit save

Taking Payments in Facebook

The final step is to take payments over Facebook. To do this go to Memberships -> Payment gateway and disable all gateways barring Facebook Credits which if it is not active should be set to active. By default the value of Facebook credits are 0.10 USD so the pages we created earlier when Facebook is activated are sold for $10USD the user is show 100 Facebook Credits, this value can be changed on the Facebook Pricing page to give a fixed value.

Taking this further

That’s it! If you have followed this tutorial, you should (as a non Facebook admin) be able to go to your app, approve it, access the individual pages and be presented with the option to purchase for 100 Facebook Credits. Once paid the user will have access to watch the protected secure stream for 2 days after which they will no longer have access.

Beyond this guide, the next steps are to experiment with different payment types, for example offering purchases in Facebook Credits and Paypal Web Standard Payments.

⚠️ **GitHub.com Fallback** ⚠️