How to test SKPaymentTransactionStateDeferred?

Maciek Czarnik picture Maciek Czarnik · Aug 26, 2014 · Viewed 12.1k times · Source

iOS 8 will be rolling out soon. We have Xcode beta 6 atm, but still cannot find any docs on how to properly test Family Sharing (or did I miss something?). My question is how to properly setup Sandbox with parent/child? I tried to make it work in beta 1 without joy.

Any hints guys?

Update:

Two related stories on Apple Developer Forum:

  1. How to create a children sandbox account on iTunes Connect?(https://devforums.apple.com/message/1030357#1030357)
  2. Testing "Ask to Buy" in sandbox (https://devforums.apple.com/message/1005569#1005569)

Answer

Chris Prince picture Chris Prince · Dec 8, 2014

I've made a little headway on this topic, so thought I'd report in. Plus, I've found an apparent bug, which I've reported to Apple.

What I've done is the following:

1) Create a parent test (sandbox) account in iTunes Connect, and create a child test account. These are really just two test accounts in iTunes Connect. Call them P and C for parent and child.

2) With both accounts, go to https://appleid.apple.com and change their year for their age. iTunes Connect doesn't let you do this. For some reason, the process with family sharing doesn't work unless ages do have a year. I've found that you have to do the selection twice on the year list at https://appleid.apple.com. Odd. I set my P as older (some adult age) and my C as younger.

3) On one apple device (my iPhone, running iOS8), I setup family sharing under Settings > iCloud for the P account. I'm signed into iTunes on this device with my real iTunes Apple Id (which has my payment info).

4) I then invite my C apple id to be part of my family, under Settings > iCloud.

5) I accept the invitation from P (on my iPad, also running iOS8), which involves signing into the iCloud on that other device as C.

6) On my iPhone, I turn on "Ask To Buy" for the C family member.

Now, I'm ready to try a test purchase as C on my sandboxed app. After I go through the regular process in my app's store I get the following alert:

enter image description here

when I tap on "Ask", I get the next alert:

enter image description here

Now, I've tried two options, with separate purchases. I've tried the "OK" option, which should send a notification to the P account. I have yet to receive such a notification on my P account (still signed into iCloud as that on my iPad).

I've also tried the "Approve in Person" option on the "child"s iPad. I use the P account, and I enter in that if on the next alert:

enter image description here

I get no error after that, so it would seem the Approve In Person worked, but I have yet to have that purchase convert to SKPaymentTransactionStatePurchased state. All of the deferred purchases are still in the payment queue of the app, each with the state SKPaymentTransactionStateDeferred. When I restart the app, the state of each purchase, still in the queue, is deferred.

Next, I wondered if there was some problem with the particular test iTunes account for C, so I made a second child account, call that C2, and tried to establish it as a child under P on my iPhone. However, I run into a further problem there. I get the alert (on the iPad), when I try to accept the invitation to be a family member under P for C2:

enter image description here

To me, this limitation on iCloud account shouldn't apply to test accounts. This is the apparent bug I've reported to Apple.

So, in summary, I'm not yet 100% convinced that my SKPaymentTransactionStateDeferred implementation is working. We shall see if Apple gets back to me.