Enable third-party platform payments
JWP enables you to monetize your content through third-party platform payments.
For your videos that require registration and payment, a new user must register or an existing user must log in. Then, the user must provide payment details.
Your app makes an API call to create an account or authenticate an existing account. Then, a recurring subscription is initiated. Payment is processed. After a successful payment, the app validates the user's access and begins content playback.
info
Since this implementation uses both JWP and InPlayer technologies, API calls will use the following namespaces and domains:
- InPlayer
- inplayer.com
- jwplayer.com
#
PrerequisitesItem | Description |
---|---|
New or existing app | App connected to a JWP property |
Payment & Subscription Entitlement | Entitlement required to set up payments Contact your JWP representative for more information. |
Payment Plan | Plan that allows access to specified app content You can create basic payment plans or complex payment plans that include features such as discount codes. |
Asset ID & Client ID | IDs that enable access to content when combined:
|
#
Set up third-party payments#
New UserFollow these steps to enable third-party payments for a new user:
Create a new user account by calling
POST /accounts
.When the request succeeds, JWP creates a new user object and returns a unique user authentication token that is valid for 30 days. When the request fails, JWP returns a failure response.
Use the app store's API to create an in-app purchase. This includes displaying the subscription price and setting up a subscription:
Validate the user's purchase by calling
POST /external-payments/<platform>/validate
. After making this API call, JWP verifies the payment on the third-party platform, stores transaction and subscription details, and grants the user access to the purchased content.info
Validate the user's access by calling
GET /items/{asset-ID}/access
.If access to the asset is verified, the method returns the content in the response that you can display in your app. If access to the asset cannot be verified, your app should redirect the user to your payment page to re-enter payment details.
After you have validated the user's access, you can fetch the content by media ID and begin playback.
If you use an app config to manage your content, you can obtain the media ID from the contentId
parameter of the app config URL.
tip
You can add URL signing or digital rights management (DRM) for extra layers of content protection.
#
Existing UserFollow these steps to enable third-party payments for an existing user:
Log in an existing user account by calling
POST /v2/accounts/authenticate
.When the request succeeds, JWP creates a new user object and returns a unique user authentication token. When the request fails, JWP returns a failure response.
Use the app store's API to create an in-app purchase. This includes displaying the subscription price and setting up a subscription:
Validate the user's purchase by calling
POST /external-payments/<platform>/validate
. After making this API call, JWP verifies the payment on the third-party platform, stores transaction and subscription details, and grants the user access to the purchased content.info
Validate the user's access by calling
GET /items/{asset-ID}/access
.If access to the asset is verified, the method returns the content in the response that you can display in your app. If access to the asset cannot be verified, your app should redirect the user to your payment page to re-enter payment details.
After you have validated the user's access, you can fetch the content by media ID and begin playback.
If you use an app config to manage your content, you can obtain the media ID from the contentId
parameter of the app config URL.
tip
You can add URL signing or digital rights management (DRM) for extra layers of content protection.