# Integration requirements

In order to implement Subscribe with Google, You generally must complete the implementation tasks
below, but Your individual circumstances (i.e. website or back-end configuration) may obviate the
need to implement certain tasks. In these Implementation Requirements, the term "**Publisher**"
has the same meaning as "You" in the Subscribe with Google Addendum to the Google Play Developer
Distribution Agreement.

1. **Google Play developer account:**

   Publisher must create a Google Play developer account, upload an application, and enable the
   application for billing. Publisher must publish the application in production, or use an
   existing production application.
2. **Publication Configuration:** Publisher must work with Google technical solutions
   representatives to set up certain points of configuration that Google requires to set up the
   integration including: URLs for required API endpoints, logo/branding assets, SKU details,
   privacy policy and Terms of Service URLs. This configuration must be done per integrated
   publication.

3. **Page markup:** Publisher must add structured data which is comprised of a publication id
   (corresponding to the id in the Publication Configuration) and an entitlement label. The
   structured data must be on all article pages, including desktop and mobile documents.

4. **swg.js client integration:** Publisher must integrate the Google javascript client into
   their publication website. Publisher must include swg.js client library on all pages where a
   paywall may be triggered, including articles that are part of a server-side paywall
   implementation, and must call the swg.js getEntitlements function and handle the response from
   that function appropriately.

   To the extent Publisher creates mobile versions of its pages and these mobile pages
   potentially trigger paywalls, the mobile pages must be configured with a mobile paywall that
   uses SwG entitlements, so that SwG user entitlements are respected.
5. **Android integration:** To the extent Publisher is selling divergent sets of SKU on
   Android versus web, or in the case that Publisher has multiple apps for the same publication,
   Publisher must update its Android applications to check for the subscription purchase and also
   call the Subscribe with Google Publication API and grant access appropriately.

6. **Sign in with Google:** Publisher must include a Sign in with Google option on all login
   pages for web and implement the relevant GIS libraries for iOS and Android Applications.

   This Sign in with Google implementation must check the Subscribe with Google Publication API
   to ensure that if the Google Account has a linked entitlement with the publisher already, the
   Google Account is associated with the user's existing account on the Publisher's site. If the
   Subscribe with Google Publication API indicates that the user has an entitlement the Publisher
   is unaware of, the Publisher will appropriately grant access for known users, however if the
   user is unknown, Publisher will launch a Deferred Account Creation Flow.

   If Publisher's web or mobile application product provides an entirely free experience and
   does not gate access with a paywall, Sign in with Google is not required. Additionally, in the
   rare case where a publisher does not maintain a user management system (i.e., the publisher
   relies completely on Subscribe with Google for managing user transactions), no Sign in with
   Google integration is necessary (or possible).
7. **Post Purchase Account Creation Handler:** Publisher must create accounts for users
   following a purchase.

   On the web, Publisher must be able to pass back swg.js subscription events and entitlement
   data to the Publisher infrastructure. For purchases made on Google surfaces or in-app,
   Publisher must handle deferred account creation and Publisher will receive account creation
   notifications via Pub/Sub or the Publication API.

   Publisher must subscribe to Play Cloud or Reader Revenue Pub/Sub events within the Publisher
   infrastructure.

   Publisher must use purchase data from subscription events to request user profile and
   subscription data from Google's Subscription Status API. After getting that data, the Account
   Management API must either:
   1. create an account with the user profile information provided by Google and associate the subscription with that account; or
   2. append the Google user profile and subscription data to an existing user account on the Publisher's site.

   In the circumstance where a publisher does not maintain a user management system (i.e. the
   publisher relies completely on Subscribe with Google for managing user transactions), no
   post-purchase account creation is necessary (or possible).
8. **iOS Integration:** If Publisher has paywalled content associated with a Subscribe with
   Google SKU in an iOS app, following the use of Google Sign-in, Publisher must check their
   backend for entitlements, and if none are found, call the Subscribe with Google Publication
   API to check for entitlements and grant access if any are found.

9. **Subscription Linking:** At the end of any purchase flows *not* processed with
   Subscribe with Google, Publisher must integrate Subscription Linking functionality to provide
   users the option to link their Google account. Publishers will need to create a Google Cloud
   project to implement subscription linking.

10. **Requirements for Publishers based in Germany:** Publishers based in Germany must
    implement the following:

    1. Surface a clearly and legibly labeled cancellation button that is always present on your website for German subscribers with the text "Cancel contracts here" \["*Verträge hier kündigen*"\] or an equivalent, unambiguous wording.
    2. Direct German users who have subscribed to your publication through Subscribe with Google and click on your cancellation button to <https://support.google.com/googleplay/contact/cancel_sub_request> to request cancellation of their subscriptions.
    3. Respond to subscribers who incorrectly attempt to cancel a subscription purchased through Subscribe with Google directly with you with a clear and unambiguous statement informing the subscriber that they should visit <https://support.google.com/googleplay/contact/cancel_sub_request> to request to cancel a contract that was purchased through Subscribe with Google.