2

I am adding a subscription offer to my existing in-app purchase. So I get the encoded signature, nonce, timestamp and key identifier from our server. I create a SKPaymentDiscount object and setting this to paymentDiscount of SKMutablePayment object.

It showed me the expected offer price and actual price screen with password field. After I confirmed the subscription with password it takes me to the popup "Unable to purchase contact the development for more information." with an Ok button. Next after I tap the button it shows another alert Failed Cannot connect to iTunes Store.

I got the signature from following this tutorial using python. Generating a Signature for Subscription Offers - Xcode - Swift

- (void)buyProduct:(SKProduct*)product offer:(SKPaymentDiscount*)promotionalOffer
{
    SKMutablePayment* payment = [ SKMutablePayment paymentWithProduct:product ];
    payment.paymentDiscount = promotionalOffer;

    [ [ SKPaymentQueue defaultQueue ] addPayment:payment ];
}

I want the subscription to be purchased successfully.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Jafar Mohammed
  • 103
  • 1
  • 12

1 Answers1

0

I'm doing the same thing right now. So I'm not sure either, but your code snippet is missing the code below.

payment.applicationUsername = self.appUsernameHash

Apple is talking about ʻapplicationUsername` in Official Documentation.

Munok Kim
  • 70
  • 1
  • 5