Examples

Prerequisites

Add the CSS & JS Includes to your HEAD section as a prerequisite.

The product instance with the Pay Instruction Data is the basic element to start a payment. The payInstruction is a JWT, and abbreviated for readability throughout the examples.

1
2
var payInstruction = "eyJ0eXAxxxJ9.eyJwYXlxxxxx3MzR9.bl2xxKn1g";
var product = new millipay.Product(payInstruction);

The examples given are using the simple integration approach, where the content is already included in the page source, but not displayed. If the payment is successful, the clientside JavaScript unhides the content.

On this page you’ll find short summaries of the examples with a link leading to the implementation.

Pay for “Read More”

This example shows how you can create a simple webpage with a read more (EUR 0.10) button which triggers a payment via milliPay and unhides the hidden content on the same page after successful payment.

Check the example Pay for Read More on Read the Docs, the online editor js.do or the hosted example

Pay & Navigate To Detail

This example shows how you can create a paybutton on an overview page and forward users to a detail page after successful payment. On the detail page the content is only accessible if the content was paid beforehand. Otherwise, the content remains hidden and can be paid for via a paybutton. Thus the detail-page-link can not be used to circumvent the paywall.

See the JavaScript API code in Pay and Navigate To Detail or the hosted example

VideoJS Player Plugin

This example shows how you can create a plugin for a video player to monetize individual videos. The video will only start playing after the user has payed for it.

Check the example Pay to watch video on Read the Docs, the online editor js.do or the hosted example

Ticker Widget triggers payment

This example features a stock widget which refreshes every minute, and a business model letting the user pay for ticker updates for an hour’s time.

Check the example Ticker Widget triggers payment