File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -192,6 +192,35 @@ - (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
192
192
callback (@[@(canMakePayments)]);
193
193
}
194
194
195
+ RCT_EXPORT_METHOD (refreshReceipt:(BOOL )testExpired
196
+ testRevoked:(BOOL )testRevoked
197
+ callback:(RCTResponseSenderBlock)callback)
198
+ {
199
+ SKReceiptRefreshRequest *refreshRequest;
200
+ if (testExpired || testRevoked) {
201
+ NSDictionary *properties = @{
202
+ SKReceiptPropertyIsExpired:@(testExpired),
203
+ SKReceiptPropertyIsRevoked:@(testRevoked)
204
+ };
205
+ refreshRequest = [[SKReceiptRefreshRequest alloc ] initWithReceiptProperties: properties];
206
+ } else {
207
+ refreshRequest = [[SKReceiptRefreshRequest alloc ] init ];
208
+ }
209
+ refreshRequest.delegate = self;
210
+ _callbacks[RCTKeyForInstance (refreshRequest)] = callback;
211
+ [refreshRequest start ];
212
+ }
213
+
214
+ - (void )requestDidFinish : (SKRequest *)request
215
+ {
216
+ NSString *key = RCTKeyForInstance (request);
217
+ RCTResponseSenderBlock callback = _callbacks[key];
218
+ if (callback) {
219
+ callback (@[[NSNull null ], @" finished" ]);
220
+ [_callbacks removeObjectForKey: key];
221
+ }
222
+ }
223
+
195
224
RCT_EXPORT_METHOD (receiptData:(RCTResponseSenderBlock)callback)
196
225
{
197
226
NSString *receipt = [self grandUnifiedReceipt ];
You can’t perform that action at this time.
0 commit comments