Giter Site home page Giter Site logo

legokit / legostorekit Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 172 KB

Apple purchase components support to obtain product information, purchase and resume purchase 苹果内购组件 ,支持获取商品信息,购买、恢复购买

License: MIT License

Objective-C 90.32% Ruby 9.68%

legostorekit's Introduction

LEGOStoreKit

CI Status Version License Platform

Example

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

Requirements

Installation

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

pod 'LEGOStoreKit'

Usage

#import <StoreKit/StoreKit.h>

@protocol LEGOAppPurchaseStateDelegate <NSObject>

/**
 *  Online request for available products succeeded 在线请求可购买商品成功
 *
 *  @param products goods 商品数组
 */
- (void)legoGotProducts:(NSMutableArray *)products;

/**
 *  Online request for available product failed 在线请求可购买商品失败
 *
 *  @param error 失败原因
 */
- (void)legoGotProductsFailure:(NSError *)error;

/**
 *  sucess 购买成功
 *
 *  @param productID 购买成功的商品ID
 */
- (void)legoBuyProductSuccessed:(SKPaymentTransaction *)transaction;

/**
 *  fail 购买失败
 *
 *  @param productID 商品ID
 */
- (void)legoBuyProductFailure:(NSString *)productID error:(NSError *)error;

/**
 *  恢复了已购买的商品
 *
 *  @param transactions 事务列表
 */
- (void)legoRestoreTransactionsSuccessed:(NSArray <SKPaymentTransaction *> *)transactions;

/**
 *  恢复了购买失败
 *  @param 失败的原因 error.debugDescription
 */
- (void)legoRestoreTransactionsFailure:(NSError *)error;

@end

@interface LEGOStoreManager : NSObject

/**
 *  购买完后是否在iOS端向苹果官方服务器验证一次,默认为NO
 */
@property (nonatomic, assign) BOOL isCheckByiTunesStore;

@property (nonatomic, weak) id <LEGOAppPurchaseStateDelegate> delegate;

+ (instancetype)defaultStore;

/**
 *  询问苹果的服务器能够销售哪些商品,并存于内存当中
 *
 *  @param products 商品ID的数组
 */
- (void)requestProductsWithProductArray:(NSArray <NSString *> *)products;

/**
 *  用户购买商品
 *
 *  @param productID 商品ID
 */
- (void)buyProduct:(NSString *)productID;

/**
 *  恢复用户商品
 */
- (void)restorePurchase;


@end


Author

[email protected], [email protected]

License

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

legostorekit's People

Contributors

yangqingren avatar errnull avatar yangqingren001 avatar

Stargazers

 avatar Fan Yang avatar

Watchers

James Cloos avatar lijialiang avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.