Logo: Alternative Billing

Alternative Billing

Organisatioun
RevenueCat
alternative-billing

Use this skill when implementing Google Play's alternative billing programs, external offers and billing choice (PBL 5.2 through 9.1). Covers user choice billing, alternative billing only, billing choice, external transaction reporting, and the regional program eligibility.

Iwwersiicht

EditeurRevenueCat
Repositoryplay-billing-skills
Skill-Nummalternative-billing
Stären
58
Forks
0
Matgeliwwert Dateien
Nëmmen Instruktiounen
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    RevenueCat huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Alternative Billing an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/alternative-billing
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/RevenueCat/play-billing-skills.git /tmp/play-billing-skills
mkdir -p .claude/skills
cp -r /tmp/play-billing-skills/google-play/alternative-billing .claude/skills/alternative-billing
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Alternative Billing an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Alternative Billing automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Alternative Billing net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Alternative Billing and External Offers

Google Play exposes several programs that let you present payment paths outside Google Play billing. This skill walks you through picking the right program for your region, wiring the PBL APIs, and reporting transactions to the externaltransactions API within 24 hours.

Phase 1: Discovery

Confirm program eligibility before you touch any code. Eligibility is driven by region, product type, and Play Console enrollment.

Check enrollment

  1. Open Play Console and confirm you accepted the program terms for each program you plan to use.
  2. Register external URLs, subscription management links, and countries per program.
  3. Record the PBL version in your build.gradle. Features map to PBL versions:
ProgramMinimum PBL
User choice billing5.2 (6.1 renamed APIs)
Alternative billing only6.1
External offers (unified API)8.2.1
External content links8.2.1
External payment links (legacy, Japan, closed to new enrollment)8.3.0
Billing choice9.1.0

Map regions to programs

RegionAvailable programs
South KoreaUser choice billing
IndiaUser choice billing
EEAUser choice billing, alternative billing only, billing choice (in app alternative billing, PBL 9.1+), external offers (links)
United StatesUser choice billing, alternative billing (instead of or alongside Google Play Billing), external content links
JapanUser choice billing, billing choice (PBL 9.1+), external payments (legacy, closed to new enrollment September 30, 2026, ends after March 31, 2027)
United Kingdom, AustraliaUser choice billing, billing choice (PBL 9.1+)
Brazil, Indonesia, South AfricaUser choice billing

Several programs (user choice billing pilot, external offers, external payments) require a developer account registered as a business.

Check runtime availability

Do not hard code country lists. The PBL surfaces eligibility.

kotlin
billingClient.isBillingProgramAvailableAsync(
    BillingProgram.EXTERNAL_OFFER,
    listener
)

For alternative billing only, use isAlternativeBillingOnlyAvailableAsync(). A BILLING_UNAVAILABLE result means the user or account is ineligible.

Discovery questions to answer

  • Which program(s) does your app need per region?
  • Do you serve subscriptions, one time products, or both?
  • Is PBL at a version that supports the target program?
  • Does your backend have a job that can report transactions within 24 hours?

Phase 2: Plan

Pick the program variant that matches your goals and region coverage.

Program comparison

ProgramFlowBillingClient setupToken source
User choice billingGoogle renders a choice screenenableUserChoiceBilling(listener)UserChoiceDetails.externalTransactionToken
Alternative billing onlyNo Google Play billing at all, info dialog requiredenableAlternativeBillingOnly()createAlternativeBillingOnlyReportingDetailsAsync()
External offersLink out to a website for dealsenableBillingProgram(EXTERNAL_OFFER)createBillingProgramReportingDetailsAsync()
External content linksLink out for digital content (US)enableBillingProgram(EXTERNAL_CONTENT_LINK)createBillingProgramReportingDetailsAsync()
External payment links (legacy, Japan, closed to new enrollment)Choice screen with developer optionenableBillingProgram(EnableBillingProgramParams) with EXTERNAL_PAYMENTS and setDeveloperProvidedBillingListener()createBillingProgramReportingDetailsAsync()
Billing choiceChoice screen rendered by Google or by you; pay in app or by external web linkenableBillingProgram(EnableBillingProgramParams) with BillingProgram.BILLING_CHOICEDeveloperProvidedBillingDetails.externalTransactionToken (Google rendered, payment in app) or createBillingProgramReportingDetailsAsync() with setDeveloperBillingType() (developer rendered, or any external web link)

Programs do not stack freely. Apps in external offers (EEA) may use only alternative billing without user choice for in app purchases, not Google Play Billing or user choice billing. Apps in external payments cannot offer user choice billing at the same time. Where a region has several user choice programs, an app can be enrolled in only one per region. BillingClient.Builder.build() rejects a client that sets both a UserChoiceBillingListener and a DeveloperProvidedBillingListener.

Token versus ID

  • externalTransactionToken: generated by the PBL, tied to one user and device context, attached to the initial report only. Generate a fresh token for each alternative billing flow or link out (external offers: purchases from one link out may share its token).
  • externalTransactionId: string you generate, uniquely identifies the transaction in your system. Each renewal uses a new ID referencing the first via initialExternalTransactionId. Do not put PII in the ID.

Backend plan

Before you write client code, plan these backend pieces:

  1. Endpoint that receives the token from the app and starts payment in your processor.
  2. Worker that calls POST /androidpublisher/v3/applications/{packageName}/externalTransactions within 24 hours of charge.
  3. Renewal reporter that reuses initialExternalTransactionId without the token.
  4. Refund reporter that calls :refund on the externalTransactionId of the exact transaction being refunded (for a subscription, the specific renewal, not the initial transaction).
  5. Quota planning: createexternaltransaction and refundexternaltransaction share 1,200 QPM. Stagger migrations.

User choice billing flow plan

  1. User taps buy.
  2. You call launchBillingFlow().
  3. Google renders the choice screen for eligible users.
  4. Google Play path: standard PurchasesUpdatedListener fires.
  5. Your billing path: UserChoiceBillingListener fires with token and products.
  6. You run your payment flow, then report through externaltransactions.

Alternative billing only flow plan

  1. Call isAlternativeBillingOnlyAvailableAsync().
  2. Call showAlternativeBillingOnlyInformationDialog(). On USER_CANCELED, retry next attempt.
  3. Call createAlternativeBillingOnlyReportingDetailsAsync() to get a fresh token.
  4. Send token plus product data to your backend.
  5. Complete payment in your processor.
  6. Report the transaction within 24 hours.

Phase 3: Execute

User choice billing client

kotlin
val userChoiceListener = UserChoiceBillingListener { details ->
    backend.startExternalPurchase(
        details.externalTransactionToken,
        details.products
    )
}

val billingClient = BillingClient.newBuilder(context)
    .setListener(purchasesUpdatedListener)
    .enablePendingPurchases(
        PendingPurchasesParams.newBuilder().enableOneTimeProducts().build()
    )
    .enableUserChoiceBilling(userChoiceListener)
    .build()

For subscription upgrades that stay in your billing system, set setOriginalExternalTransactionId() on SubscriptionUpdateParams to skip the choice screen.

Alternative billing only token

kotlin
billingClient.createAlternativeBillingOnlyReportingDetailsAsync(
    object : AlternativeBillingOnlyReportingDetailsListener {
        override fun onAlternativeBillingOnlyTokenResponse(
            result: BillingResult,
            details: AlternativeBillingOnlyReportingDetails?
        ) {
            if (result.responseCode != BillingResponseCode.OK) return
            backend.send(details?.externalTransactionToken)
        }
    }
)

External offers or content links (PBL 8.2.1+)

kotlin
val params = BillingProgramReportingDetailsParams.newBuilder()
    .setBillingProgram(BillingProgram.EXTERNAL_OFFER)
    .build()

billingClient.createBillingProgramReportingDetailsAsync(
    params,
    reportingListener
)

Launch the link after you persist the token:

kotlin
val linkParams = LaunchExternalLinkParams.newBuilder()
    .setBillingProgram(BillingProgram.EXTERNAL_OFFER) // EXTERNAL_CONTENT_LINK for US content links
    .setLinkUri(Uri.parse("https://myapp.com/offer"))
    .setLinkType(LaunchExternalLinkParams.LinkType.LINK_TO_DIGITAL_CONTENT_OFFER) // required
    .setLaunchMode(
        LaunchExternalLinkParams.LaunchMode
            .LAUNCH_IN_EXTERNAL_BROWSER_OR_APP
    )
    .build()
billingClient.launchExternalLink(activity, linkParams, listener)

Use the same program constant in BillingProgramReportingDetailsParams. App downloads use LINK_TO_APP_DOWNLOAD and must use LAUNCH_IN_EXTERNAL_BROWSER_OR_APP.

External payment links (PBL 8.3+)

Japan only, legacy: the external payments program closed to new enrollments on September 30, 2026 and ends after March 31, 2027. New integrations use billing choice (PBL 9.1+, below). Keep this code only for apps already enrolled, and migrate them to billing choice before March 31, 2027.

kotlin
val devBillingListener = DeveloperProvidedBillingListener { details ->
    backend.handleExternalPayment(details)
}

val billingClient = BillingClient.newBuilder(context)
    .setListener(purchasesUpdatedListener)
    .enablePendingPurchases(
        PendingPurchasesParams.newBuilder().enableOneTimeProducts().build()
    )
    .enableBillingProgram(
        EnableBillingProgramParams.newBuilder()
            .setBillingProgram(BillingProgram.EXTERNAL_PAYMENTS)
            .setDeveloperProvidedBillingListener(devBillingListener)
            .build()
    )
    .build()

Pass DeveloperBillingOptionParams (billing program, link URI, launch mode) to BillingFlowParams.Builder.enableDeveloperBillingOption() when you call launchBillingFlow(). The choice screen renders only when the user is in a supported country, the program is enabled on the client, and you passed a developer option.

PBL 9 change: DeveloperProvidedBillingDetails.getLinkUri() is now @Nullable. The external payment link may not be resolved at selection time, so guard against both null and empty string before parsing it as a Uri:

kotlin
val linkUri = details.linkUri
if (!linkUri.isNullOrEmpty()) {
    startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(linkUri)))
} else {
    showExternalPaymentUnavailableState()
}

Billing choice (PBL 9.1+)

Billing choice is the current program for in app alternative billing (EEA) and for in app or external web link alternative billing (Japan, United Kingdom, Australia); it is also the replacement for external payment links in Japan. Google or you can render the choice screen, and payment can happen in your app or through an external web link.

kotlin
// Google rendered choice screen, payment in your app (scenario 1A)
val devBillingListener = DeveloperProvidedBillingListener { details ->
    backend.startAlternativePurchase(details.externalTransactionToken, details.products)
}

val billingClient = BillingClient.newBuilder(context)
    .setListener(purchasesUpdatedListener) // required with billing choice
    .enablePendingPurchases(
        PendingPurchasesParams.newBuilder().enableOneTimeProducts().build()
    )
    .enableBillingProgram(
        EnableBillingProgramParams.newBuilder()
            .setBillingProgram(BillingProgram.BILLING_CHOICE)
            .setDeveloperProvidedBillingListener(devBillingListener)
            .build()
    )
    .build()

After connecting, confirm availability and read the choice screen type:

kotlin
billingClient.isBillingProgramAvailableAsync(BillingProgram.BILLING_CHOICE) { result, details ->
    val choice = details.billingChoiceAvailabilityDetails
    if (result.responseCode == BillingResponseCode.OK && choice != null) {
        val googleRendered = choice.choiceScreenType == ChoiceScreenType.GOOGLE_RENDERED
        val hasExternalLink = choice.isExternalLinkAvailable
    }
}

Attach the program to BillingFlowParams when you call launchBillingFlow():

kotlin
val flowParams = BillingFlowParams.newBuilder()
    .setProductDetailsParamsList(productDetailsParamsList)
    .enableDeveloperBillingOption(
        DeveloperBillingOptionParams.newBuilder()
            .setBillingProgram(BillingProgram.BILLING_CHOICE)
            .build()
    )
    .build()

If the user picks Google Play, the standard PurchasesUpdatedListener fires. If they pick your billing, DeveloperProvidedBillingListener fires with externalTransactionToken.

Developer rendered screen: enable the program without a DeveloperProvidedBillingListener, call getBillingChoiceInfoAsync() for the Play Billing image and loyalty text, and create the token with createBillingProgramReportingDetailsAsync() and setDeveloperBillingType() (required for BILLING_CHOICE). Payment in your app (DeveloperBillingType.IN_APP): when the user taps Buy, call showBillingProgramInformationDialog() with that token and show your choice screen only if it returns OK. External web link (DeveloperBillingType.EXTERNAL_LINK): show your choice screen, and if the user picks your option call launchExternalLink() with the token and LinkType.LINK_TO_DIGITAL_CONTENT_OFFER; it shows the link out and parental control screens. If the user picks Google Play, call launchBillingFlow() as usual.

Google rendered screen with an external web link: when the user shows intent to buy, create the token with createBillingProgramReportingDetailsAsync() (BILLING_CHOICE, DeveloperBillingType.EXTERNAL_LINK), then pass DeveloperBillingOptionParams with setBillingProgram(BillingProgram.BILLING_CHOICE), setLinkUri(...), setExternalTransactionToken(token), and setLaunchMode(...). DeveloperProvidedBillingListener returns the same token if the user picks your link. A token is required whenever a link is used.

For subscription replacement the choice screen is not shown again. If the original purchase went through Google Play Billing, use the standard plan change flow (plan-changes). If it went through your billing, set setOriginalExternalTransactionId() on SubscriptionUpdateParams with the original external transaction ID; the exact flow differs by scenario (see Google's billing choice integration guide).

Report the initial transaction

http
POST /androidpublisher/v3/applications/{packageName}/externalTransactions?externalTransactionId=txn-1
json
{
  "originalPreTaxAmount": { "priceMicros": "4990000", "currency": "USD" },
  "originalTaxAmount": { "priceMicros": "449100", "currency": "USD" },
  "transactionTime": "2026-01-15T10:30:00Z",
  "recurringTransaction": {
    "externalTransactionToken": "token_from_pbl",
    "externalSubscription": { "subscriptionType": "RECURRING" }
  },
  "userTaxAddress": { "regionCode": "US" }
}

Amounts use priceMicros. Multiply by 1,000,000. For India, include administrativeArea in userTaxAddress because tax rates vary by state.

Program details: for external offers (EEA), add "externalOfferDetails": { "linkType": "LINK_TO_DIGITAL_CONTENT_OFFER" } to one time and first recurring transactions (app downloads: LINK_TO_APP_DOWNLOAD plus installedAppPackage and installedAppCategory; purchases inside an app installed through an offer reuse the download's token and set appDownloadEventExternalTransactionId). For external content links (US), add "externalContentLinkDetails": { "linkType": "LINK_TO_DIGITAL_CONTENT_OFFER" } (app installs also need installedAppPackage and externalAppCategory). Set only the object for the transaction's own program.

Report renewals

Drop the token, add initialExternalTransactionId:

json
{
  "recurringTransaction": {
    "initialExternalTransactionId": "txn-1",
    "externalSubscription": { "subscriptionType": "RECURRING" }
  }
}

Report refunds

http
POST /androidpublisher/v3/applications/{packageName}/externalTransactions/{externalTransactionId}:refund

Body: refundTime plus either "fullRefund": {} or "partialRefund": { "refundId": "...", "refundPreTaxAmount": { "priceMicros": "...", "currency": "..." } }.

Verification checklist

  • Report every transaction within 24 hours of the charge.
  • Generate a new token immediately before each link out or alternative billing flow; never cache tokens across link outs. (External offers: purchases from one link out may share its token, and purchases in an app installed through an offer reuse the download's token.)
  • Confirm PBL 8.2.1 or later if you use createBillingProgramReportingDetailsAsync(). 8.2.0 has a bug.
  • Strip PII from externalTransactionId and from any external link Uri.
  • Payment method image meets the 192dp x 20dp spec before you upload to Play Console.
  • Persist the token and finish any in app work before launching an external link. Users may not return to your app.

References

Heefeg gestallte Froen

Wat mécht de KI-Skill Alternative Billing?

Use this skill when implementing Google Play's alternative billing programs, external offers and billing choice (PBL 5.2 through 9.1). Covers user choice billing, alternative billing only, billing choice, external transaction reporting, and the regional program eligibility.

Firwat Alternative Billing op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Alternative Billing besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Alternative Billing an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/alternative-billing an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Alternative Billing benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Alternative Billing benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Alternative Billing domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Alternative Billing gratis?

Jo. RevenueCat huet de Skill ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇