Skip to content

Get paywall

/paywall/

Target audience: Developers

Release version: T.B.A

Get Paywall

Introduction

This endpoint returns an active paywall for the given title. If an account id is supplied we will based on given information, configuration and user history calculate a tailored offer to the user.

URI

Environment URI
Stage https://payway-api.stage.adeprimo.se/external/api/v1/paywall/
Production https://backend.worldoftulo.com/external/api/v1/paywall/

Requirements

Feature needs to be enabled by Adeprimo. Please contact support to enable.

Identity Scope
No /external/paywall/r

Parameters

Name Required Type Description
title_code Yes String Title code a title.
Size range: 1..15 Allowed values: "/^[a-zA-Z-_0-9]+$/"
account_id Optional String The id of the account to evaluate an offer for.
Size range: ..24
Allowed values: "/^[a-f\d]{24}$/i"
account_origin Optional String The origin of the account. E.g. the newspaper title.
Size range: ..1024
merchant_reference Optional String The merchant reference for the order
traffic_source Optional String The source of the purchase. E.g. facebook, web. Traffic sources need to be setup in PAP
Size range: ..128
return_url Optional String When a user has purchased a subscription this link will be used to take the user back to the website, for example to the article the user wants to read. Is displayed on the purchase confirmation page.
back_url Optional String Can be used as an alternative link back to the website from Tulo Shop, not to be mistaken for the returnUrl.
utm Optional Object GA Support. Supply this if your paywall offer is of type sales link.
source
Required String GA Support variable
medium
Optional String GA Support variable
campaign
Optional String GA Support variable
content
Optional String GA Support variable
content
Optional String GA Support variable
engage_tracking Optional Object Engage tracking. Supply this if you intend to use the pw markup and built in engage tracking.
article_id
Optional String If the paywall is initiated from an article add the articleId to this parameter.
sections
Optional Array Sections e.g. ["sec 1", "sec 2"]
categories
Optional Array Categories e.g. ["cat 1", "cat 2"]

Curl Example

curl --request POST \
  --url https://payway-api.stage.adeprimo.se/external/api/v1/paywall/ \
  --header 'accept: application/json' \
  --header 'authorization: Bearer <token-with-identity>' \
  --header 'content-type: application/json' \
  --data '{
              "title_code": "ADE",
              "account_id": "63cfafea09c04c30c9e17c21",
              "account_origin": "ADE",
              "merchant_reference": "MERCHANT-1",
              "traffic_source": "facebook",
              "return_url": "https://site.domain.com/article/123",
              "back_url": "https://site.domain.com/article/123",              
              "utm": {
                "source": "google",
                "medium": "cpc",
                "campaign": "spring_sale",
                "content": ""              
              },
              "engage_tracking": {
                "article_id": "123",
                "sections": ["sec1", "sec2"],
                "categories": ["cat1", "cat2"]
              }
          }'

Response

HTTP 200
{
  "item": {
    "title": "TITLE_CODE",
    "offer": "campaign_code",
    "variables": {
      "[INTRO_TITLE]": "intro_title",
      "[MAIN_TITLE]": "main_title",
      "[LAST_TITLE]": "last_title",
      "[PURCHASE_BUTTON_TEXT]": "purchase_button_text",
      "[OFFER_INCLUDES_TITLE]": "offer_includes_title",
      "[OFFER_INCLUDES]": [
        "Access to the Adeprimo rag all day and every day!",
        "Non-stop fun time, all the time"
      ],
      "[SALES_PITCH]": "sales_pitch",
      "[PURCHASE_BUTTON_LINK]": "https://shop-url.com?account_origin=TITLE_CODE&merchant_reference=REF-1&traffic_source=paywall&return_url=https%3A%2F%2Freturn_url.com&back_url=https%3A%2F%2Fback_url.com&article_id=%2Fdet-senaste-nytt-1234567890&utm_source=google&utm_medium=cpc&utm_campaign=spring_sale&utm_content=",
      "[TITLE_NAME]": "TITLE",
      "[PRICE]": "210",
      "[DISCOUNT_PRICE]": null,
      "[DISCOUNT_PERCENTAGE]": null,
      "[CURRENCY]": "kr"
    },
    "markup": "<div class=\"paywall__wrapper\">\n    <div class=\"paywall__inner-container\">\n        <div class=\"paywall__header-container\">\n            <h6>intro_title</h6>\n            <h1>main_title</h1>\n            <h2>last_title</h2>\n        </div>\n\n        <div class=\"paywall__price-container\">\n            <div class=\"paywall__price-container-left\">\n                <h6>TITLE - <br/>sales_pitch</h6>\n            </div>\n\n            <div class=\"paywall__price-container-right\">\n                <h2>210 kr</h2>\n                <small><span class=\"paywall__price-container-percentage\"></span> <s></s></small>\n            </div>\n        </div>\n        <div class=\"paywall__price-container-clear\"></div>\n\n        <a href=\"https://shop-url.com?account_origin=TITLE_CODE&merchant_reference=REF-1&traffic_source=paywall&return_url=https%3A%2F%2Freturn_url.com&back_url=https%3A%2F%2Fback_url.com&article_id=%2Fdet-senaste-nytt-1234567890&utm_source=google&utm_medium=cpc&utm_campaign=spring_sale&utm_content=\">\n            <button type=\"button\">purchase_button_text</button>\n        </a>\n\n        <div class=\"paywall__offers-container\">\n            <div id=\"paywall__toggle-offers-btn\">\n                <p><i id=\"paywall__toggle-offers-icon\" class=\"gg-chevron-down-o\"></i> &nbsp; offer_includes_title</p>\n            </div>\n\n            <div id=\"paywall__toggle-offers-section\">\n                <ul><li>Access to the Adeprimo rag all day and every day!</li><li>Non-stop fun time, all the time</li></ul>\n            </div>\n        </div>\n    </div>\n</div>\n\n<script type=\"text/payway-paywall-js\">\n    function slideUp(el) {\n        el.style.transition = \"all 300ms ease-in-out\";\n        el.style.height = \"0px\";\n\n        let arrow = el.parentElement.querySelector(\"#paywall__toggle-offers-icon\");\n        arrow.classList.add(\"gg-chevron-down-o\");\n        arrow.classList.remove(\"gg-chevron-up-o\");\n    }\n\n    function slideDown(el) {\n        el.style.transition = \"all 300ms ease-in-out\";\n        el.style.height = \"100px\";\n\n        let arrow = el.parentElement.querySelector(\"#paywall__toggle-offers-icon\");\n        arrow.classList.remove(\"gg-chevron-down-o\");\n        arrow.classList.add(\"gg-chevron-up-o\");\n    }\n\n    let toggleOffersBtn = document.getElementById(\"paywall__toggle-offers-btn\");\n    toggleOffersBtn.addEventListener(\"click\", function () {\n        let toggleOffersSection = document.getElementById(\"paywall__toggle-offers-section\");\n        if (toggleOffersSection.style.height === \"0px\" || toggleOffersSection.style.height === \"\") {\n            slideDown(toggleOffersSection);\n        } else {\n            slideUp(toggleOffersSection);\n        }\n    });\n</script>"
  }
}

Errors

This API uses the common error conventions of the Payway API

See common error responses