Giter Site home page Giter Site logo

betacat-a / bliap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from beiliao-mobile/bliap

0.0 2.0 0.0 214 KB

处理了 IAP 九大坑, 并且封装了收据验证队列, 最大限度保证移动端 IAP 安全的示例代码.

Home Page: https://juejin.im/user/5941fa488d6d810058c0d4df

License: MIT License

Objective-C 99.84% Ruby 0.16%

bliap's Introduction

BLIAP

处理了 IAP 九大坑, 并且封装了收据验证队列, 最大限度保证 IAP 安全的示例代码.

模块划分如下:

运行流程如下:

使用时注意.

使用时, 可以直接将示例代码拖进项目.

注意, 示例代码并没有实现在自己的服务器上创建订单和去自己服务器上验证的相关逻辑, 使用时需要在 BLPaymentVerifyTask 类中填充以下两个方法.

- (void)sendCreateOrderRequestWithProductIdentifier:(NSString *)productIdentifier md5:(NSString *)md5; 
- (void)sendUploadCertificateRequest;

并在请求结果中将请求结果转为验证支付成功 / 失败 / 错误这三种情况, 并调用以下方法驱动整个验证流程.

- (void)handleVerifingTransactionValid;
- (void)handleVerifingTransactionInvalidWithErrorMessage:(NSString *)errorMsg;
- (void)handleUploadCertificateRequestFailed;
- (void)handleCreateOrderSuccessedWithOrderNo:(NSString *)orderNo
                               priceTagString:(NSString *)priceTagString
                                          md5:(NSString *)md5;
- (void)handleCreateOrderFailed;

关于示例代码的使用请查看 BLPaymentManager 这个类的头文件.

实现思路

这个示例代码的实现思路请参考我的文章:

第一篇:[iOS]贝聊 IAP 实战之满地是坑,这一篇是支付基础知识的讲解,主要会详细介绍 IAP,同时也会对比支付宝和微信支付,从而引出 IAP 的坑和注意点。

第二篇:[iOS]贝聊 IAP 实战之见坑填坑,这一篇是高潮性的一篇,主要针对第一篇文章中分析出的 IAP 的问题进行具体解决。

第三篇:[iOS]贝聊 IAP 实战之订单绑定,这一篇是关键性的一篇,主要讲述作者探索将自己服务器生成的订单号绑定到 IAP 上的过程。

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.