Search Unity

[Solved] unity IAP - why prefix product ID with app bundle name ?

Discussion in 'Unity IAP' started by elenzil, Jun 21, 2017.

Thread Status:
Not open for further replies.
  1. elenzil

    elenzil

    Joined:
    Jan 23, 2014
    Posts:
    73
    the examples for Unity IAP show product IDs like "com.mycompany.myapp01.100Gold".

    why prefix it that way ?
    why not just "100Gold", or at most "myapp01.100Gold" ?

    tia,
    Orion
     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @elenzil

    The product ids can be any arbitrary string containing alphanumeric, underscore and period characters. Adding the bundle name to the product id is just a convention. One that Apple has recommended in the past:

    https://developer.apple.com/library/content/qa/qa1329/_index.html
     
    elenzil likes this.
  3. elenzil

    elenzil

    Joined:
    Jan 23, 2014
    Posts:
    73
    got it, thanks.
     
  4. elenzil

    elenzil

    Joined:
    Jan 23, 2014
    Posts:
    73
    ah, in Unity's docs about validating receipts there's also this:

    The application bundle identifier on the receipt is compared to the one in your application. An InvalidBundleId exception is thrown if they do not match.

    but i suspect that might only apply if you're doing local receipt validation.
     
  5. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    Yeah, that is correct.

    However, even then, the CrossPlatformValidator does not check the product id with the bundle id, so you can still make the product id whatever you want.
     
    elenzil likes this.
  6. elenzil

    elenzil

    Joined:
    Jan 23, 2014
    Posts:
    73
    I think i've found a more solid reason.
    Apple won't let you share a single ProductID in more than one app (on your developer account).
    So if you use "MyThing001" in app 1, you can not also have "MyThing001" in app 2.

    you'll get this error `The product ID you entered has already been used. Enter a unique product ID and try again.`
     
Thread Status:
Not open for further replies.