Shangchih Huang
Shangchih Huang

Reputation: 319

How to use the requestData in the SKMutablePayment?

I am using the Apple IAP. I want to add some addtional paprameters like the user id, the server id, and the money of a product when requesting a payment using the StoreKit:

NSDictionary* requestDataDic = @{ @"userId": userId, @"serverId": serverId, @"money": money };

NSData* requestData = [NSJSONSerialization dataWithJSONObject:requestDataDic
                                                      options:NSJSONWritingPrettyPrinted
                                                        error:nil];

SKMutablePayment *payment = [SKMutablePayment paymentWithProduct:productIdentifier];
payment.requestData = requestData;

if ([SKPaymentQueue defaultQueue]) {
    [[SKPaymentQueue defaultQueue] addPayment:payment];
}

However, after my server side has validate the receipt, it doesn't receive the information which was sended to the Apple Server in the requestData. Did I misunderstand the usage of the requestData?

Upvotes: 1

Views: 598

Answers (1)

kubrick G
kubrick G

Reputation: 876

According to Apple's doc, this property is reserved for future use and if you use it, your payment will be rejected by apple.

The default value is nil. If requestData is not nil, your payment will be rejected by the Apple App Store.

Upvotes: 1

Related Questions