InPlayer API (2.0.0)

Download OpenAPI specification:Download

INTRODUCTION

Our Paywall platform enables you up to create a detailed subscription business, allowing you to build a consumer base and drive significant revenues. Our paywall supports recurring payments and billing, consumer acquisition, subscriber lifecycle management and gives you consumer retention CRM tools.

Once you have an InPlayer Merchant Account you can use our dashboard at https://dashboard.inplayer.com to publish, manage and sell premium content. However, you can always integrate with our APIs for full custom integration.

INPLAYER API

The InPlayer API has REST architecture. It has mostly resource-oriented URLs, and uses standard HTTP response codes to indicate API errors or success requests. Every InPlayer Core Resource has its own URL and each operation (GET, POST, PUT, and DELETE) has a specific meaning

All API requests should be made with Content-Type:application/x-www-form-urlencoded header.

JSON is returned by all API responses, no matter if they are success or errors.

DOCS TERMINOLOGY

In the section bellow you can find explanation about the terms that are used for the Core Resources in the InPlayer Platform. Be sure to read it before you start with custom integration.

Accounts and Account Types

Term Explanation
merchant The Merchants are those that has ownership of the premium content.
consumer The Consumers are those that can view or buy the premium content.
customer Consumer with at least one purchase.
uuid Unique identifier of the Merchant. You can find it in the InPlayer dashboard in the Account Details section as Account ID.

Items/Assets and Item Types

Term Explanation
items Items or sometimes referred as Assets are the digital assets that Merchants can protect and sell. Asset is an Item with applied pricing and access options.
item_type Is the type of the digital content that can be created in the InPlayer Platform. The only difference between the Item Types is the premium content type. Currently, only available options for Item Types are html_asset where you can store HTML code or any IFRAME code, and ooyala_asset where you can store digital asset content hosted in Ooyala.
content Content of one Item is the premium content that you can store and protect. Once the Consumer has access to the Item, he can view the content.
metadata Metadata is unlimited key-value store for describing Items.

Access Types

Term Explanation
access_type Types of access that can be used in the system.
period The time frame of the asset access that the consumer get after purchasing.

Access Fees

Term Explanation
access_fee Applied access_type and price to Item.

Items Packages

Term Explanation
package Collection of multiple Items. Packages are group of Items. You can set up Package Access Fee that will be additional pricing option for the Items that belong to a Package. Once the Consumer buys Package Access Fee he will have access to every Item that belongs to the Package.

API ENVIRONMENTS

To make the API as explorable as possible, we have 2 different environments for live or testing purposes. There is no switch for changing between modes, just use the different URLs of our API servers.

ERRORS

InPlayer uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.), and codes in the 5xx range indicate an error with InPlayer's servers.

Not all errors map cleanly onto HTTP response codes, however. When a request is valid but does not complete successfully (e.g., asset access is not found), we return a 402 error code.

List of status codes

Status code Explanation
200 OK Everything worked as expected.
201 Created The resource has been created.
202 Accepted The request has been accepted for processing, but the processing has not been completed.
204 No Content The server has fulfilled the request but does not need to return an entity-body
400 Bad Request The request was unacceptable, often due to missing a required parameter.
401 Unauthorized No valid access token provided.
402 Request Failed The parameters were valid but the request failed.
404 Not Found The requested resource doesn't exist.
409 Conflict The request conflicts with another request.
429 Too Many Requests Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.
500, 502, 503, 504 Server Errors Something went wrong on InPlayer's end.

Authentication

bearerAuth

You can create a JSON Web Token (JWT) via the authenticate endpoint. Usage format: Bearer <JWT>

Security scheme type: HTTP
HTTP Authorization Scheme bearer
Bearer format "JWT"

V1

All operations related to vouchers

Creates a voucher code

Authorizations:
Request Body schema: application/x-www-form-urlencoded
name
required
string

Voucher name

discount
required
integer [ 1 .. 100 ]

Discount amount in percentage

start_date
required
string <date-time>

Voucher is valid from this date forward

end_date
string <date-time>

Voucher validation ends on this date

code
string >= 5

Code provided by the merchant instead of generating it automatically

length
integer >= 1

Code length

prefix
string

Code prefix

suffix
string

Code suffix

usage_limit
integer

Limit the number of times for voucher usage

discount_period
string
Enum:"once" "repeating" "forever"

In case this voucher is used for a subscription, you can use a discount period for the recurrent payments

discount_duration
integer

In case the discount_period is repeating this field is required, for number of months to repeat the discount

Responses

200

Discounted price

401

Unauthorized

403

Invalid privileges

422

Cannot create resource

post /vouchers
Staging Server
https://staging-v2.inplayer.com/vouchers
Production Server
https://services.inplayer.com/vouchers

Request samples

Copy
curl -X POST https://services.inplayer.com/vouchers \
    -H 'Authorization: Bearer <token>' \
    -d name='Voucher title' \
    -d length=7 \
    -d perfix=AB17 \
    -d perfix=BA17 \
    -d discount=30 \
    -d start_date=2017-01-10 \
    -d end_date=2017-03-12 \
    -d usage_limit=50

Response samples

application/json
Copy
Expand all Collapse all
{
  • "id": 14,
  • "name": "50% discount",
  • "discount": 50,
  • "start_date": "2018-08-23T00:00:00.000Z",
  • "end_date": "2018-09-30T00:00:00.000Z",
  • "code": "F00B4R!@",
  • "length": 10,
  • "prefix": "foo-",
  • "suffix": "-bar",
  • "usage_limit": 10,
  • "discount_period": "once",
  • "discount_duration": 5
}

Get vouchers

Authorizations:
query Parameters
search
Array of string
Example: ["id:123","name:Foo"]

Search parameters

page
integer >= 1

Page

Responses

200

Voucher collection

401

Unauthorized

403

Invalid privileges

get /vouchers
Staging Server
https://staging-v2.inplayer.com/vouchers
Production Server
https://services.inplayer.com/vouchers

Request samples

Copy
curl https://services.inplayer.com/vouchers?page=1&limit=15 \
    -H 'Authorization:Bearer <token>'

Response samples

application/json
Copy
Expand all Collapse all
{
  • "collection":
    [
    ],
  • "total": 100,
  • "page": 2,
  • "offset": 15,
  • "limit": 15
}

Get voucher details

Authorizations:
path Parameters
id
required
integer

Voucher id

Responses

200

Voucher details

401

Unauthorized

403

Invalid privileges

404

Resource not found

get /vouchers/{id}
Staging Server
https://staging-v2.inplayer.com/vouchers/{id}
Production Server
https://services.inplayer.com/vouchers/{id}

Request samples

Copy
curl https://services.inplayer.com/vouchers/{id} \
    -H 'Authorization:Bearer <token>'

Response samples

application/json
Copy
Expand all Collapse all
{
  • "id": 14,
  • "name": "50% discount",
  • "discount": 50,
  • "start_date": "2018-08-23T00:00:00.000Z",
  • "end_date": "2018-09-30T00:00:00.000Z",
  • "code": "F00B4R!@",
  • "length": 10,
  • "prefix": "foo-",
  • "suffix": "-bar",
  • "usage_limit": 10,
  • "discount_period": "once",
  • "discount_duration": 5
}

Update voucher

Authorizations:
path Parameters
id
required
integer

Voucher id

Request Body schema: application/x-www-form-urlencoded
name
required
string

Voucher name

discount
required
integer [ 1 .. 100 ]

Discount amount in percentage

start_date
required
string <date-time>

Voucher is valid from this date forward

end_date
string <date-time>

Voucher validation ends on this date

code
string >= 5

Code provided by the merchant instead of generating it automatically

length
integer >= 1

Code length

prefix
string

Code prefix

suffix
string

Code suffix

usage_limit
integer

Limit the number of times for voucher usage

discount_period
string
Enum:"once" "repeating" "forever"

In case this voucher is used for a subscription, you can use a discount period for the recurrent payments

discount_duration
integer

In case the discount_period is repeating this field is required, for number of months to repeat the discount

Responses

200

Updated voucher

401

Unauthorized

403

Invalid privileges

404

Resource not found

422

Cannot create resource

put /vouchers/{id}
Staging Server
https://staging-v2.inplayer.com/vouchers/{id}
Production Server
https://services.inplayer.com/vouchers/{id}

Request samples

Copy
curl -X PUT https://services.inplayer.com/vouchers/{id} \
    -H 'Authorization: Bearer <token>' \
    -d name='Voucher title' \
    -d discount=50 \
    -d start_date=2017-01-10 \
    -d end_date=2017-05-10 \
    -d usage_limit=100

Response samples

application/json
Copy
Expand all Collapse all
{
  • "id": 14,
  • "name": "50% discount",
  • "discount": 50,
  • "start_date": "2018-08-23T00:00:00.000Z",
  • "end_date": "2018-09-30T00:00:00.000Z",
  • "code": "F00B4R!@",
  • "length": 10,
  • "prefix": "foo-",
  • "suffix": "-bar",
  • "usage_limit": 10,
  • "discount_period": "once",
  • "discount_duration": 5
}

Delete voucher

Authorizations:
path Parameters
id
required
integer

Voucher id

Responses

200

Deleted voucher successfuly

401

Unauthorized

403

Invalid privileges

404

Resource not found

delete /vouchers/{id}
Staging Server
https://staging-v2.inplayer.com/vouchers/{id}
Production Server
https://services.inplayer.com/vouchers/{id}

Request samples

Copy
curl -X DELETE https://services.inplayer.com/vouchers/{id} \
  -H 'Authorization:Bearer <token>'

Response samples

application/json
Copy
Expand all Collapse all
{
  • "code": 401,
  • "message": "Invalid auth token"
}

Voucher discount price

Authorizations:
Request Body schema: application/x-www-form-urlencoded
access_fee_id
required
integer

Access fee id

voucher_code
required
string

Voucher code

Responses

200

Created voucher

401

Unauthorized

404

Voucher Not found

post /vouchers/discount
Staging Server
https://staging-v2.inplayer.com/vouchers/discount
Production Server
https://services.inplayer.com/vouchers/discount

Request samples

Copy
curl -X POST https://services.inplayer.com/vouchers/discount \
    -H 'Authorization: Bearer Access-Token' \
    -d voucher_code=FOOrGmv60pT \
    -d access_fee_id=134

Response samples

application/json
Copy
Expand all Collapse all
{
  • "amount": 20
}