Page 1 of 1

AppStore Subscriptions

Posted: Fri Nov 10, 2023 10:28 pm
by ace16vitamine
Hi all,

I have a short question regarding this sample code. What I want: a simple iOS subscription after the button is pressed.

Code: Select all

mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "com.runrev.sampleapp.nonconsumable", "subs"
mobileStoreMakePurchase "com.runrev.sampleapp.nonconsumable", "1", "This belongs to me"

Is it right to replace "com.runrev.sampleapp.nonconsumable" with the SKU of the subscription?

Thanks
Stefan

Re: AppStore Subscriptions

Posted: Sat Nov 11, 2023 6:31 pm
by jacque
The product ID is the bundle ID, the reverse-domain string you entered in standalone settings. Usually it starts with "com" or "org", etc. followed by the company name and then the app name.

Re: AppStore Subscriptions

Posted: Sat Nov 11, 2023 10:48 pm
by ace16vitamine
OK, understand. But it is not clear for me how to assign the right subscription. It is possible to add multiple subs in AppStore with different SKUs.How can I tell LC which SKU is the right one?

Re: AppStore Subscriptions

Posted: Sun Nov 12, 2023 2:09 am
by jacque
Sorry, I understand now. You can specify the product in mobileStoreMakePurchase. In the example, the product ID is "1", which you can substitute with your SKU.

Re: AppStore Subscriptions

Posted: Sun Nov 12, 2023 2:44 pm
by ace16vitamine
Hi Jacky,

does not work, the app crashes.

Code: Select all

   mobileStoreEnablePurchaseUpdates
   mobileStoreSetProductType "the_bundle_id", "subs"
   mobileStoreMakePurchase "the_bundle_id", "SKU", "This belongs to me"
if SKU = 1... Nothing happens (but no crash). If SKU = 1234567891 = Crash.

Same if I change the bundle id to a non existing id... For me it seems like a problem with the SKU

Re: AppStore Subscriptions

Posted: Mon Nov 13, 2023 6:12 pm
by jacque
I'm not sure what would cause that, but LC should never crash so it's worth a bug report. Also, do you mean a crash (the app quits suddenly) or a hang (app is unresponsive)?

The SKU needs to be the same as the entry you set up in the developer console. Does your command match that exactly? Do they contain spaces or punctuation? I'm just guessing now.

Re: AppStore Subscriptions

Posted: Mon Nov 13, 2023 7:51 pm
by ace16vitamine
Ive done this (copy/paste) from the LC Lesson and I replaced only the bundle ID & SKU.

The App crashed in iOS Simulator (quits) and also on physical devices without any answer. But only with my bundle ID & SKU not if I do this with the code from the lesson.

sure, it is the same SKU. Ive checked this with "123" -> No Problem. With "1234567890" -> quit. With my SKU (ABC123) -> Quit.

Re: AppStore Subscriptions

Posted: Tue Nov 14, 2023 2:43 am
by jacque
I think at this point you should submit a bug report along with a sample stack. I'm afraid I'm out of ideas.

Re: AppStore Subscriptions

Posted: Tue Nov 14, 2023 8:25 am
by LiveCode_Panos
Hello Stefan and Jacque,

The correct syntax is this one:

Code: Select all

mobileStoreMakePurchase <productID>, <quantity>, <developerPayload>
So in this case. in the following script, you just have to replace "com.runrev.sampleapp.nonconsumable" with the SKU of the subscription, as it appears in the AppStore Connect page. Note that the subscription SKU is a different thing from the App ID that is entered in the iOS standalone settings.

Code: Select all

mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "com.runrev.sampleapp.nonconsumable", "subs"
mobileStoreMakePurchase "com.runrev.sampleapp.nonconsumable", "1", "This belongs to me"
Kind regards,
Panos
--

Re: AppStore Subscriptions

Posted: Tue Nov 14, 2023 7:51 pm
by ace16vitamine
Hi Panos:

Code: Select all

mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "SKU001", "subs"
mobileStoreMakePurchase "SKU001", "1", "This belongs to me"
Right?
or should it be

Code: Select all

mobileStoreEnablePurchaseUpdates
mobileStoreSetProductType "my.bundle.id", "subs"
mobileStoreMakePurchase "SKU001", "1", "This belongs to me"