VoD Ticket management

These functions allow creating tickets for video-on-demand, which will grant access to media content for a limited period of time, and bill the customer if needed. The following types of tickets can be created:

  • Pay-per-view ticket: grants access to a specific media content for playback, billing the client for the requested price.

  • View ticket: grants access to a specific media content for playback. Can be used for free media content (trailers for example), or paid content and a parent ticket exists (either a Subscription ticket, or a Pack ticket).

  • Pack ticket: creates a ticket and bills the user for the requested amount. The ticket ID can be used as a reference offer ID when creating a View ticket for a specific media content.

  • Subscription ticket: allows the editor to bill the client on a recurrent basis. The created ticket ID can be used as a reference offer ID when creating a View ticket for a specific media content.

A ticket has a limited validity time. When the ticket expires, the media content that was referenced by this ticket will be made unavailable for playback immediatly. In effect, this means:

  • For a Pay-per-view ticket, the media content referenced by the ticket is only available for the duration of the ticket validity.

  • For a Pack ticket, the media content referenced by the children View tickets will only be accessible for the duration of the pack ticket validity. The view tickets duration is automatically capped to disallow playback after the parent ticket has expired.

Ticket creation

The different ticket types can be created using the following methods. A Deferred.Deferred() is returned. On resolve, a ticket object is returned. On error, a popup window is displayed to warn the user about the error.

The following parameters are common between all those methods:

  • portalId: unique ID for this VoD service, communicated to the editor by Free.

  • editorId: unique ID for the VoD editor, communicated to the editor by Free.

For paid content or offers, a popup will be displayed by the system for confirmation by the user. The popup will display the media description and its price, and requires the user to enter the purchase code before confirmation. After confirmation, the client is billed for the specified price.

Ticket.mediaBuy(portalId, editorId, mediaId, description, duration, price)
Arguments
  • portalId (string()) – ID of the VoD portal

  • editorId (string()) – ID of the VoD editor

  • mediaId (string()) – ID of the media content

  • description (string()) – description for the media content

  • duration (int()) – duration of the ticket validity, in seconds

  • price (int()) – price of the item, in euro cents

Returns

A Deferred.Deferred()

Creates a Pay-per-view ticket, granting access to the specified media content for playback, for the specified duration.

Ticket.mediaView(portalId, editorId, mediaId, duration, offerTicketId)
Arguments
  • portalId (string()) – ID of the VoD portal

  • editorId (string()) – ID of the VoD editor

  • mediaId (string()) – ID of the media content

  • duration (int()) – duration of the ticket validity, in seconds

  • offerTicketId (string()) – optional ID of the parent offer ticket

Returns

A Deferred.Deferred()

Creates a View Ticket, granting access to the specified media content for playback, for the specified duration. The reference offer ticket ID is needed when creating a ticket for paid content.

Ticket.packPurchase(portalId, editorId, offerId, description, duration, price)
Arguments
  • portalId (string()) – ID of the VoD portal

  • editorId (string()) – ID of the VoD editor

  • offerId (int()) – ID of the offer

  • description (string()) – description for the media content

  • duration (int()) – duration of the ticket validity, in seconds

  • price (int()) – price of the item, in euro cents

Returns

A Deferred.Deferred()

Creates a Pack ticket, that can be used to create children View tickets. The offerId parameter is a unique ID allocated by the editor.

Ticket.subscribe(portalId, editorId, offerId, description, price)
Arguments
  • portalId (string()) – ID of the VoD portal

  • editorId (string()) – ID of the VoD editor

  • offerId (int()) – ID of the offer

  • description (string()) – description for the media content

  • price (int()) – price of the item, in euro cents

Returns

A Deferred.Deferred()

Creates a Subscription ticket, that can be used to create children View tickets. The offerId parameter is a unique ID allocated by the editor.

Ticket.unsubscribe(portalId, editorId, ticketId)
Arguments
  • portalId (string()) – ID of the VoD portal

  • editorId (string()) – ID of the VoD editor

  • ticketId (int()) – ticketId returned at the subscription call

Returns

A Deferred.Deferred()

Unsubscribe from an offer that was previously subscribed to. The subscription state is changed to indicate unsubscribe is pending. The subscription state will changed to unsubscribed at the end of the current period.

Ticket.getSubscriptions(portalId, editorId, ticketId)
Arguments
  • portalId (string()) – ID of the VoD portal

  • editorId (string()) – ID of the VoD editor

  • ticketId (int()) – optional argument, to only retrieve the status of the subscription corresponding to the ticket ID.

Returns

A Deferred.Deferred()

Returns an array of subscriptions object containing the list of active subscriptions.

Ticket object

A ticket object, that can be created using the methods documented above, has the following attributes:

ticket.ticketId

String containing the ticket ID.

For a subscription or a pack ticket, the ID must be saved by the caller for later reuse. The ID will be necessary to create a view ticket, allowing access to a specific media from the pack or subscription.

ticket.clientId

String containing the client ID.

Contains the ID of the client that requested the ticket. This will always match the fbx.account.UserInfo.iff property.

ticket.duration

Duration of the validity of the ticket, in seconds.

This duration might not match the duration requested on ticket creation. In particular, the duration might be capped for certain ticket types: 172800 (48 hours) for pay-per-view tickets, and 86400 (24 hours) for view tickets.

ticket.price

Price in cents that the client was billed for. 0 for view or subscription tickets.

ticket.offerId

String containing the reference offer ID.

This will contain the ID of the reference offer ID passed on ticket creation.

Subscription object

subscription.ticketId

String containing the ticket ID.

subscription.offerId

String containing the reference offer ID.

This will contain the ID of the reference offer ID passed on ticket creation.

subscription.creationTimestamp

Subscription creation date, as a timestamp (number of seconds since epoch).

subscription.stateTimestamp

Date when the subscription state changed last, as a timestamp (number of seconds since epoch).

subscription.state
Subscription state, the following values are possible:
  • subscribed Subscription is active

  • unsubscribe_pending Subscription is active but will be revoked at the end of the period

  • unsubscribed Subscription is not active