OpenTV Video Platform's Purchase Service enables the user to purchase products from the client app.
Request
To initiate a purchase, send a POST request to:
https://<host>:<port>/purchase_service/v1/user/product/actions/purchase
If PIN checking has been set up for purchases in your deployment, use version 2 of this request instead, which also takes the PIN that the user entered. See Making a purchase with a PIN.
Headers
-
Authorization– the client's access token, as a bearer token (Bearer <access token>). This is theaccess_tokenthat the client gets when it signs in – see Authentication token. This header is mandatory. -
Content-Type: application/json
Mandatory arguments
-
productId– the ID of the product to be purchased
Other arguments
None
Example
A POST request with this payload initiates the purchase of the product with the specified ID:
{
"productId": "1234DFG5sd"
}
Response
A successful request returns an HTTP 201 status.
A bad request returns an HTTP 400 status.
An unauthorised request returns an HTTP 401 status.
A forbidden request returns an HTTP 403 status.
If the specified product does not exist, the request returns an HTTP 401 status ("errorCode": "3080").
See the Purchase Service API documentation for the specific error codes that are returned for the HTTP 4xx statuses.
Example
{
"productId": "1234DFG5sd",
"purchaseAuthRequestReference": "CRM_PARTNER_AUTH_REQUEST_REFERENCE/X-CORRELATION-ID"
}
See also
-
Making a purchase with a PIN (version 2, with a server-side PIN check)
-
See Managing purchases for an explanation of how to integrate a CRM with the Purchase Service.
-
For full details of this API, see the Purchase Service API documentation.