All Projects → MQCCoder → Xyiapkit

MQCCoder / Xyiapkit

Licence: mit
苹果内购组件,提供产品列表查询、添加购买、恢复购买、票据校验、自动续费订阅过期检测以及提供用户交易持久化等功能。

Labels

Projects that are alternatives of or similar to Xyiapkit

Patronkit
A framework to add patronage to your apps.
Stars: ✭ 370 (+52.26%)
Mutual labels:  purchase
Apphudsdk
Build, Measure and Grow iOS subscription business
Stars: ✭ 93 (-61.73%)
Mutual labels:  purchase
Autoya
thin framework for Unity.
Stars: ✭ 165 (-32.1%)
Mutual labels:  purchase
Mixerp
Open Source ERP, HRM, MRP, MPS
Stars: ✭ 472 (+94.24%)
Mutual labels:  purchase
Nativescript Purchase
💰 A NativeScript plugin for making in-app purchases!
Stars: ✭ 80 (-67.08%)
Mutual labels:  purchase
Inapppy
Python In-app purchase validator for Apple AppStore and GooglePlay.
Stars: ✭ 110 (-54.73%)
Mutual labels:  purchase
PurchaseHelper
Sample app to explain the In-App purchase implementation in Android using Play-billing library
Stars: ✭ 30 (-87.65%)
Mutual labels:  purchase
Defterp
deftERP - Jakarta EE (Java EE 7 : JSF, JPA, EJB, CDI, Bean Validation)
Stars: ✭ 207 (-14.81%)
Mutual labels:  purchase
Quickshop Reremake
QuickShop is a shop plugin, that allows players to sell items from a chest with no commands. It allows players to purchase any number of items easily. In fact, this plugin doesn't even have any commands that a player would ever need!
Stars: ✭ 82 (-66.26%)
Mutual labels:  purchase
Premiumer
Premiumer makes removing ads with a single in-app purchase on Android as easy as pie.
Stars: ✭ 153 (-37.04%)
Mutual labels:  purchase
In App Purchase
A Node.js module for in-App-Purchase for iOS, Android, Amazon and Windows.
Stars: ✭ 868 (+257.2%)
Mutual labels:  purchase
Betterlifepsi
Betterlife Intelligent PSI(Purchase, Sales and Inventory) system
Stars: ✭ 43 (-82.3%)
Mutual labels:  purchase
Redux Framework
Redux is a simple, truly extensible options framework for WordPress themes and plugins!
Stars: ✭ 1,602 (+559.26%)
Mutual labels:  purchase
Laravel Wallet
Easy work with virtual wallet
Stars: ✭ 401 (+65.02%)
Mutual labels:  purchase
Inapppurchase
A Simple and Lightweight framework for In App Purchase
Stars: ✭ 202 (-16.87%)
Mutual labels:  purchase
Tpinappreceipt
Reading and Validating In App Purchase Receipt Locally.
Stars: ✭ 305 (+25.51%)
Mutual labels:  purchase
Flutter iap
Flutter iap plugin
Stars: ✭ 101 (-58.44%)
Mutual labels:  purchase
Dolibarr
Dolibarr ERP CRM is a modern software package to manage your company or foundation's activity (contacts, suppliers, invoices, orders, stocks, agenda, accounting, ...). It is open source software (written in PHP) and designed for small and medium businesses, foundations and freelancers. You can freely install, use and distribute it as a standalon…
Stars: ✭ 2,877 (+1083.95%)
Mutual labels:  purchase
Qonversion Ios Sdk
iOS SDK for cross-platform in-app purchase and subscription infrastructure, revenue analytics, engagement automation, and integrations
Stars: ✭ 206 (-15.23%)
Mutual labels:  purchase
Iaphelper
IAPHelper simply wraps the API of Apple's In-App Purchase using Swift.
Stars: ✭ 153 (-37.04%)
Mutual labels:  purchase

XYIAPKit

CI Status Version License Platform

iOS内购编程指南

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

XYIAPKit is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'XYIAPKit'

功能

1、内购的基本功能,产品列表查询、添加购买、恢复购买

2、票据校验、自动续费订阅过期检测

3、交易记录保存

使用方法

1、查询在线商品

/**
 请求在线商品,并存储于内存中

 @param identifiers 产品id
 */
- (void)requestProducts:(NSSet*)identifiers
                success:(void (^)(NSArray *products, NSArray *invalidProductIdentifiers))successBlock
                failure:(void (^)(NSError *error))failureBlock;

#########################################################################################################

	NSSet *set = [[NSSet alloc] initWithArray:@[@"1", @"2", @"3", @"4", @"5", @"6"]];
    [[XYStore defaultStore] requestProducts:set
                                    success:^(NSArray *products, NSArray *invalidProductIdentifiers)
     {

     } failure:^(NSError *error) {

     }];

2、添加购买

    [[XYStore defaultStore] addPayment:productId
                               success:^(SKPaymentTransaction *transaction)
    {

        
    } failure:^(SKPaymentTransaction *transaction, NSError *error) {

    }];

3、恢复内购

[[XYStore defaultStore] restoreTransactionsOnSuccess:^(NSArray *transactions) {
        
        NSLog(@"restore === %@", transactions);
    } failure:^(NSError *error) {
        NSLog(@"restore error === %@", error);
    }];

4、添加票据校验

1)、外部票据校验(可以通过信任的服务器进行校验)
创建校验对象(建议创建单例对象,以便监听),遵守XYStoreReceiptVerifier协议
- (void)verifyTransaction:(SKPaymentTransaction *)transaction
                  success:(void (^)(void))successBlock
                  failure:(void (^)(NSError *))failureBlock
{
    __weak typeof(self) weakSelf = self;
    [[XYStore defaultStore] base64Receipt:^(NSString *base64Data) {
        
        [[XYStore defaultStore] fetchProduct:transaction.payment.productIdentifier
                                     success:^(SKProduct *product)
         {
         	//外部校验请求
             [weakSelf callBackApple:product
                         receiptData:base64Data
                             success:successBlock
                             failure:failureBlock];
             
         } failure:failureBlock];
        
    } failure:failureBlock];
}
在`- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions `中注册票据校验
	// 在此设置内购的票据校验,防止掉单问题的发生
    [[XYStore defaultStore] registerReceiptVerifier:[XYAppReceiptVerifier shareInstance]];
2)、APP内部校验

podfile中添加`pod 'XYIAPKit/iTunesReceiptVerify', '~> 0.8.0'`
引入票据校验的sdk

在`- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions `中注册票据校验
	// 在此设置内购的票据校验,防止掉单问题的发生
    [[XYStore defaultStore] registerReceiptVerifier:[XYStoreiTunesReceiptVerifier shareInstance]];
XYStoreiTunesReceiptVerifier中提供对自动续期产品的订阅过期的判断
	/**
 @ 适用自动续期订阅
 
 判断是否已订阅
 若果是非自动续费型商品,直接返回NO

 @param productId 自动续期订阅产品id
 @return YES:  NO:未订阅或者订阅过期
 */
- (BOOL)isSubscribedWithAutoRenewProduct:(NSString *)productId;
也提供 针对持续有效的产品,Apple返回的票据记录中会一直保留其票据信息,可以通过票据记录判断是否有效
/**
 针对持续有效的产品,Apple返回的票据记录中会一直保留其票据信息,可以通过票据记录判断是否有效
 支持:1、非续期订阅 2、非消耗型项目
 
 注:消耗型项目一旦完成,不会长期保留在票据信息中
 
 @param productId 产品id
 @return YES:消费有效 NO:无效
 */
- (BOOL)isValidWithPersistentProductId:(NSString *)productId;

5、添加交易记录存储 1)、存储在NSUserDefaults podfile中添加pod 'XYIAPKit/UserDefaultPersistence', :'~> 0.8.0'

在`- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions `中注册票据校验
	// 在此设置内购的票据校验,防止掉单问题的发生
    [[XYStore defaultStore] registerTransactionPersistor:[XYStoreUserDefaultsPersistence shareInstance]];

2)、存储于Keychain中
	podfile中添加`pod 'XYIAPKit/KeychainPersistence', '~> 0.8.0'`

在`- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions `中注册票据校验
	// 在此设置内购的票据校验,防止掉单问题的发生
    [[XYStore defaultStore] registerTransactionPersistor:[XYStoreKeychainPersistence shareInstance]];

Author

1073605877

License

XYIAPKit is available under the MIT license. See the LICENSE file for more info.

With reference to RMStore

Copyright issues, notice as soon as possible

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].