Namespace: paywall

PaywallHttpRequest.paywall

Paywall section containing paywall extensions to standard XMLHttpRequest methods.
Source:

Members

(static) getState

Method to retrieve current state of payment flow, will return one of PaywallState enums. State EXPIRED will be returned both if invoice or settlement have expired. If state is EXPIRED and settlement is null, then it's the invoice that have expired.
Source:

Methods

(static) addEventListener(name, type, callback)

Method to add a listener, if listener already exists with given name it will be updated. Multiple listeners for the same type is supported.
Parameters:
Name Type Description
name string the unique name of the listener within this payment flow.
type PaywallEventType the type of event to listen to, or special ALL that receives all events.
callback function method that should be called on given event. The function should have two parameters one PaywallEventType and one object containing the object data. Type of object differs for each event.
Source:

(static) getInvoice() → {Object}

Method to retrieve invoice if exists in related payment flow.
Source:
Returns:
related invoice if generated in payment flow, otherwise undefined.
Type
Object

(static) getInvoiceAmount() → {PaywallAmount}

Help method to construct to retrieve a PaywallAmount object of invoice amount that is easy converted by a specified unit.
Source:
See:
Throws:
error if no invoice currently exists in payment flow.
Returns:
if invoice exist
Type
PaywallAmount

(static) getInvoiceExpiration() → {PaywallTime}

Help method to construct a PaywallTime object of invoice expiration date, used to simply output remaining hours, minutes, etc of invoice.
Source:
Throws:
error if no invoice currently exists in payment flow.
Returns:
if invoice exist
Type
PaywallTime

(static) getPaywallError() → {Object}

Method to retrieve error object containing error information if paywall related error occurred during payment flow.
Source:
Returns:
related error if generated in payment flow, otherwise undefined.
Type
Object

(static) getSettlement() → {Object}

Method to retrieve settlement if exists in related payment flow.
Source:
Returns:
related settlement if generated in payment flow, otherwise undefined.
Type
Object

(static) getSettlementExpiration() → {PaywallTime}

Help method to construct a PaywallTime object of settlement expiration date, used to simply output remaining hours, minutes, etc of settlement validity.
Source:
Throws:
error if no settlement currently exists in payment flow. It is best to check this before calling method.
Returns:
if settlement exist
Type
PaywallTime

(static) getSettlementValidFrom() → {PaywallTime}

Help method to construct a PaywallTime object of settlement valid from date, used to simply output remaining hours, minutes, etc until settlement validity. If no validFrom field is set in settlement is current date returned.
Source:
Throws:
error if no settlement currently exists in payment flow. It is best to check this before calling method.
Returns:
if settlement exist
Type
PaywallTime

(static) hasInvoice() → {boolean}

Returns true if invoice exists in related payment flow.
Source:
Returns:
true if invoice exist
Type
boolean

(static) hasSettlement() → {boolean}

Returns true if settlement exists in related payment flow.
Source:
Returns:
true if settlement exist
Type
boolean

(static) removeEventListener(name)

Method to remove listener with given name if exists.
Parameters:
Name Type Description
name string the name of listener to remove.
Source: