Do you build things with AMP? Fill out the new AMP Developer Survey!
AMP
  • websites

amp-access-laterpay

Introduction

amp-access-laterpay allows publishers to easily integrate with the payment infrastructure platform LaterPay. It is based on, and requires AMP Access.

Setup

Import the amp-access component in the header.

<script async custom-element="amp-access" src="https://cdn.ampproject.org/v0/amp-access-0.1.js"></script>

amp-access requires amp-analytics to be imported as well.

<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>

And of course the amp-access-laterpay component.

<script async custom-element="amp-access-laterpay" src="https://cdn.ampproject.org/v0/amp-access-laterpay-0.2.js"></script>

Add the configuration which specifies the vendor, and vendor specific configuration for amp-access

<script id="amp-access" type="application/json">
{
  "vendor": "laterpay",
  "laterpay": {
    "articleTitleSelector": ".preview > h3",
    "sandbox": true
  }
}
</script>

Controlling visibility

This section is visible to all users. No special markup is needed in this case.

The Article

This is a preview of the article.

<section class="preview">
  <h3>The Article</h3>
  <p>
    This is a preview of the article.
  </p>
</section>

This section is only shown if the value of the access and error attributes on the response for the authorization requests both evaluate to FALSE The LaterPay dialog with the different purchase options will be rendered here

<section amp-access="NOT error AND NOT access"
  amp-access-hide>

The id and class shown here are both predefined and should be kept as such You can then use these as references to style the dialog to your needs.

<div id="amp-access-laterpay-dialog"
  class="amp-access-laterpay"></div>

This section is shown if an error attribute exists when getting the the authorization request

Oops... Something broke.
<section amp-access="error"
  amp-access-hide>
  Oops... Something broke.
</section>

Use the amp-access attribute to control the visibility of each component. The expression must evaluate to a boolean value. If it evaluates to TRUE, the section will be shown.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ullamcorper turpis vel commodo scelerisque. Phasellus luctus nunc ut elit cursus, et imperdiet diam vehicula. Duis et nisi sed urna blandit bibendum et sit amet erat. Suspendisse potenti. Curabitur consequat volutpat arcu nec elementum. Etiam a turpis ac libero varius condimentum. Maecenas sollicitudin felis aliquam tortor vulputate, ac posuere velit semper.
<div amp-access="access"
  amp-access-hide>
  Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  Curabitur ullamcorper turpis vel commodo scelerisque. Phasellus
  luctus nunc ut elit cursus, et imperdiet diam vehicula.
  Duis et nisi sed urna blandit bibendum et sit amet erat.
  Suspendisse potenti. Curabitur consequat volutpat arcu nec
  elementum. Etiam a turpis ac libero varius condimentum.
  Maecenas sollicitudin felis aliquam tortor vulputate,
  ac posuere velit semper.
</div>
자세한 설명이 필요하신가요?

이 페이지의 설명만으로 궁금한 점이 모두 해결되지 않는다면 다른 AMP 사용자에게 문의하여 구체적인 활용 사례를 논의해 보세요.

Stack Overflow로 이동
설명이 부족한 기능을 발견하셨나요?

AMP 프로젝트는 여러분의 참여와 기여를 적극 환영합니다! 오픈 소스 커뮤니티를 통해 지속적으로 활동해 주셔도 좋지만 관심 있는 주제에 한 번만 기여하셔도 큰 도움이 됩니다.

GitHub에서 샘플 수정하기