defold / extension-iap

In-app purchase extension for Defold
MIT License
20 stars 13 forks source link

There’s no mechanism to activate developer determined subscription offers for Android. #57

Open AshHerb opened 1 year ago

AshHerb commented 1 year ago

I have some developer determined win-back offers as part of a subscription I plan to make available for lapsed subscribers. The free-trial and introductory pricing phases are straightforward but I don’t think defold has a way referring to specific offers besides the free-trial and introductory pricing when making a call to iap.buy().

Perhaps an additional member of the options table along with the subscription token to specify the particular offer that as a developer I want to give.

Also, maybe offers for a subscription are returned as part of the data in the callback for a call to iap.list().

britzl commented 1 year ago

Move to correct repository.

@AshHerb can you please also share the technical documentation for "developer determined win-back offers"? We have not looked into this and it will save us time if you can provide as much information around this as possible.

AshHerb commented 1 year ago

Move to correct repository.

@AshHerb can you please also share the technical documentation for "developer determined win-back offers"? We have not looked into this and it will save us time if you can provide as much information around this as possible.

Okay. I will.

AshHerb commented 1 year ago

In the reference for the method purchases.subscriptionsv2, one of its fields lineItems[] which contains the item level info for the subscription purchase, has as one of it's items, offerDetails, which is stated to be Offer details information related to a purchase line item.

More on offerDetails

britzl commented 1 year ago

@AshHerb the APIs you linked are for the REST API (ie used from a game backend to Google servers).

But I'm not sure what more you need in the client besides what is already returned? For a subscription you get one or more subscription offers. Example:

{
  description = "",
  subscriptions = {
    {
      pricing = {
        {
          currency_code = "SEK",
          price = 12,
          recurrence_mode = "INFINITE",
          billing_cycle_count = 0,
          price_string = "12,00 kr",
          billing_period = "P1M"
        }
      },
      token = "AUj/Yhhm6F/wEICMXas5tNTPvm6bNOF/h1Z3BNBELFLtnexoGDZmmFdHW/5ykS+Foa094I8dxDLKjFFxlx1RjEgGpP82ujxRrOLAo9cz/xxeVIiXdTvi+JxlIjMznRO3zqiG"
    }
  },
  ident = "com.defold.iap.subscription.one",
  title = "Subscription one (In-App Tester)"
}

The subscriptions field is a list of SubscriptionOfferDetails, each containing a list of pricing phases and an offer token that is used when buying the subscription.

The offer token is passed as part of the iap.buy() call, like this:

local subscription = ... -- returned product from call to iap.list()
local token = subscription.subscriptions[1].token
iap.buy("com.defold.iap.subscription.one", { token = token })
AshHerb commented 1 year ago

Oh my bad. Thanks for your clarification.