This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[in_app_purchase]retrieve receipt #1303
Merged
Merged
Changes from all commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
3d21006
draft
73caea7
second draft
9420db0
finish transaction
62a9974
adding more comments
2ec9c58
more comments
e75411a
let dart intercept the payment from store
824eee8
create payment method
98f8d03
rearrange method order
e1176e5
formatting
6878875
draft
8feddbf
draft 2
2ccfe7e
Merge branch 'master' of github.com:flutter/plugins into iap_make_pay…
0e8de06
Merge branch 'iap_make_payment_objc' into iap_payment_queue_dart_ios
ec177e3
add payment
ab75985
typo fix
5edec3f
Merge branch 'iap_make_payment_objc' into iap_payment_queue_dart_ios
ed11706
more comments
564d13b
remove unused code
330dc3d
Merge branch 'iap_make_payment_objc' into iap_payment_queue_dart_ios
b11e3c5
update to weakself
7f9e5a9
review fixes
0187f9a
formatting
ec1f0bb
merge the objective-c branch
6b2d7ea
rename callback methods
e7da33a
nit fix
b756e70
rearrange payment object handling code
4dd5b14
fix unit test, remove nil check for callback blocks
f3cdb83
formatting
7ddbc6c
merge and resolve conflicts
18f1e82
observer update
a37123e
assert transaction observer is set
7d57282
finish transaction method
da19308
merge master
ad2f3ee
Merge branch 'master' into iap_payment_queue_dart_ios
c0eabdd
reslove conflicts
f11949e
formatting
bd746bf
fixes
06f8495
local test
541c573
add assert message
a3fe929
fix price precision
61c66d1
more local test code
8762cfc
review fixes
736838e
revert sku_details_wrapper.g
114b5ce
update price to string to avoid precision lost
343a976
remove unnecessary print statement
372fad7
Merge branch 'get_product_list_fix' into local_test
f845b61
fixes
36d9d25
test case fixes
055a88f
Merge branch 'get_product_list_fix' into iap_payment_queue_dart_ios
087d954
Merge branch 'local_test' into iap_payment_queue_dart_ios
324d7a9
revert main.dart
17af41a
Merge branch 'master' into iap_payment_queue_dart_ios
80fcac1
remove unnecessary method
670bc84
Merge branch 'master' into iap_payment_queue_dart_ios
5c8b3c5
remove unnessary addpayment logic
d7df3be
restore transactions
8132c22
formatting and renaming
de3a84b
store notifications if observer is not set
4c7624b
merge payment queue branch
ffaf35c
fix transform map to transactions and downloads
6989936
refresh serializer
693ed90
formatting
7a8f005
Merge branch 'iap_payment_queue_dart_ios' into iap_restore_purchase
43acaf4
merge master
69cd34c
formatting
31ef630
update doc
c0e6eeb
add retrive receipt method in objc
2729eee
retrive receipt data on dart
d8b788d
retrive receipt method can be static
4b328c8
merge master
c0c45c1
receipt manager
ced1bce
only get receipt data
5621c04
formating
0afd8a9
remove testing code
b3e61d5
adding refresh receipt method
88a49c6
formatting
b2d4394
typo fix
47d5886
comments
df7e6f2
license header
94022cb
export receipt manager
37334e1
remove unnecessary parameter
a92652d
dartdoc typo fix
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Copyright 2019 The Chromium Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| NS_ASSUME_NONNULL_BEGIN | ||
|
|
||
| @class FlutterError; | ||
|
|
||
| @interface FIAPReceiptManager : NSObject | ||
|
|
||
| - (NSString *)retrieveReceiptWithError:(FlutterError **)error; | ||
|
|
||
| @end | ||
|
|
||
| NS_ASSUME_NONNULL_END |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // | ||
| // FIAPReceiptManager.m | ||
| // in_app_purchase | ||
| // | ||
| // Created by Chris Yang on 3/2/19. | ||
| // | ||
|
|
||
| #import "FIAPReceiptManager.h" | ||
| #import <Flutter/Flutter.h> | ||
|
|
||
| @implementation FIAPReceiptManager | ||
|
|
||
| - (NSString *)retrieveReceiptWithError:(FlutterError **)error { | ||
| NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL]; | ||
| NSData *receipt = [self getReceiptData:receiptURL]; | ||
| if (!receipt) { | ||
| *error = [FlutterError errorWithCode:@"storekit_no_receipt" | ||
| message:@"Cannot find receipt for the current main bundle." | ||
| details:nil]; | ||
| return nil; | ||
| } | ||
| return [receipt base64EncodedStringWithOptions:kNilOptions]; | ||
| } | ||
|
|
||
| - (NSData *)getReceiptData:(NSURL *)url { | ||
| return [NSData dataWithContentsOfURL:url]; | ||
| } | ||
|
|
||
| @end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/in_app_purchase/lib/src/store_kit_wrappers/sk_receipt_manager.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Copyright 2019 The Chromium Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'dart:async'; | ||
| import 'package:in_app_purchase/src/channel.dart'; | ||
|
|
||
| ///This class contains static methods to manage StoreKit receipts. | ||
| class SKReceiptManager { | ||
| /// Retrieve the receipt data from your application's main bundle. | ||
| /// | ||
| /// The receipt data will be based64 encoded. The structure of the payload is defined using ASN.1. | ||
| /// You can use the receipt data retrieved by this method to validate users' purchases. | ||
| /// There are 2 ways to do so. Either validate locally or validate with App Store. | ||
| /// For more details on how to validate the receipt data, you can refer to Apple's document about [`About Receipt Validation`](https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Introduction.html#//apple_ref/doc/uid/TP40010573-CH105-SW1). | ||
| /// If the receipt is invalid or missing, you can use [SKRequestMaker.startRefreshReceiptRequest] to request a new receipt. | ||
| Future<String> retrieveReceiptData() { | ||
| return channel | ||
| .invokeMethod('-[InAppPurchasePlugin retrieveReceiptData:result:]'); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.