millipay. Product¶
A product instance holds the payment process state, and the actions to payment process events for one item.
Check the API Cheatsheet for an overview.
Constructor¶
-
class
millipay.Product(token[, GUI])¶ Arguments: - token (string) – a JSON Web Token JWT specifying the product Pay Instruction Data.
- GUI (Object) – a payment GUI implementation replacing the default GUI.
Methods¶
-
product.registerStartPaymentClick(selector[, GUI])¶ Arguments: - selector (JQuerySelector) –
- GUI (GUI) –
Check the JQuerySelector to understand the power and implications. In essence this method executes
$(jquerySelector).click(function(){this.paymentStart()})If no GUI is provided the standard GUI is used.
-
product.tryAccessOnPageLoad()¶ Registers a special entry point for a payment process that it triggered on page load to re-access already bought content. It calls
startPaymentin a$(document).ready(...)block instantiated with a headless GUI that never triggers a standard pay, sign in, or topup GUI feedback. There are two main use cases for this function. First, you can automatically display already bought content, when the user revisits the page at a later time. Second, you can let the user buy content on an index page, then navigate to a detail page and automatically show the, initially protected, paid content on the page.
-
product.startPayment([GUI])¶ Arguments: - GUI (GUI) –
Starts the payment process.
If no GUI is provided the standard GUI is used.
Events¶
-
product."start"¶ Immediately fired after the start pay dialog sequence is initialized. A callback method can get access to the Promise of the ongoing pay sequence.
-
product."userAbort"¶ Triggered by a user interaction such as closing a pay dialog or hitting the back link on a pay dialog.
-
product."error"¶ The error event may occur in any payment process state transition.
-
product."accessAuthorization"¶ The happy case of a successfully finished transaction.
Attributes¶
-
product.onAccessAuthorization¶ A millipay. EventReactionCollector for the accessAuthorization event
-
product.onStart¶ A millipay. EventReactionCollector for the start event
-
product.onUserAbort¶ A millipay. EventReactionCollector for the userAbort event
-
product.onError¶ A millipay. EventReactionCollector for the error event