Create Paywall

This endpoint is used to initiate a paywall transaction for fiat currency

Method

POST https://api.ninjapay.me/webextension/api/v1/fiat/paywall

Parameters

  • price: (number, required) - Price of the content.

  • title: (string, required) - Title of the content.

  • content: (string, required) - URL of the content.

  • content_type: string - Type of content, here it's a URL.

  • hide_url: boolean - Indicates if the URL should be hidden.

  • extra: object - Additional data, currently empty.

Request Body

Body (application/json)
{
    "price": 99.00,      //REQUIRED     // The price of the item, represented as a floating-point number.
    "title": "27 July Trailer", //REQUIRED     // The title of the content or item, represented as a string.
    "content": "https://www.youtube.com/watch?v=gqiHUSZJJpg", // REQUIRED The URL or content link, represented as a string.
    "content_type": "URL",    // The type of content, represented as a string (e.g., "URL", "text", "image").
    "hide_url": false,        // A boolean flag indicating whether to hide the URL or not.
    "extra": {}              // An additional field for any extra data, represented as an object.
}

Response

{
    "status": true,
    "data": {},
    "message": "Paywall created successfully"
}

Code Example


const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'API_KEY' //Invoice key required
  },
  body: {
    "price": 99.00,           // The price of the item, represented as a floating-point number.
    "title": "27 July Trailer",      // The title of the content or item, represented as a string.
    "content": "https://www.youtube.com/watch?v=gqiHUSZJJpg", // The URL or content link, represented as a string.
    "contentType": "URL",    // The type of content, represented as a string (e.g., "URL", "text", "image").
    "hideUrl": false,        // A boolean flag indicating whether to hide the URL or not.
    "extra": {}              // An additional field for any extra data, represented as an object.
}
};

fetch('https://api.ninjapay.me/webextension/api/v1/fiat/paywall', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
  

Last updated