AppStore Subscriptions

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ace16vitamine
Posts: 130
Joined: Fri Apr 13, 2018 1:53 pm

AppStore Subscriptions

Post by ace16vitamine » Fri Nov 10, 2023 10:28 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7320
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: AppStore Subscriptions

Post by jacque » Sat Nov 11, 2023 6:31 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

ace16vitamine
Posts: 130
Joined: Fri Apr 13, 2018 1:53 pm

Re: AppStore Subscriptions

Post by ace16vitamine » Sat Nov 11, 2023 10:48 pm

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?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7320
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: AppStore Subscriptions

Post by jacque » Sun Nov 12, 2023 2:09 am

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

ace16vitamine
Posts: 130
Joined: Fri Apr 13, 2018 1:53 pm

Re: AppStore Subscriptions

Post by ace16vitamine » Sun Nov 12, 2023 2:44 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7320
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: AppStore Subscriptions

Post by jacque » Mon Nov 13, 2023 6:12 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

ace16vitamine
Posts: 130
Joined: Fri Apr 13, 2018 1:53 pm

Re: AppStore Subscriptions

Post by ace16vitamine » Mon Nov 13, 2023 7:51 pm

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.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7320
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: AppStore Subscriptions

Post by jacque » Tue Nov 14, 2023 2:43 am

I think at this point you should submit a bug report along with a sample stack. I'm afraid I'm out of ideas.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 849
Joined: Fri Feb 06, 2015 4:03 pm

Re: AppStore Subscriptions

Post by LiveCode_Panos » Tue Nov 14, 2023 8:25 am

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
--

ace16vitamine
Posts: 130
Joined: Fri Apr 13, 2018 1:53 pm

Re: AppStore Subscriptions

Post by ace16vitamine » Tue Nov 14, 2023 7:51 pm

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"

Post Reply

Return to “iOS Deployment”