iap - GStones/moke-kit GitHub Wiki

本文档介绍了moke-kit提供的IAP组件的使用方法。

go-iap verifies the purchase receipt via AppStore, GooglePlayStore or Amazon AppStore.

如何使用?

  1. Main 中初始化 IAPModule

      fxmain.Main(   
     	        ...,
          module.IAPModule,
      )
  2. 设置相关环境变量参数

  3. 在需要的ParamsObject 中注入ClientsParams ,就可以使用下面的接口。

        var MyService = fx.Provide(
         func(
             ...,
             iapParams iapfx.ClientsParams,
         ) (out sfx.GrpcServiceResult, err error) {
             if iapParams.AppleClient == nil {
                 err = fmt.Errorf("apple client not found")
             }
             if iapParams.GoogleClient == nil {
                 err = fmt.Errorf("google client not found")
             }
         })
⚠️ **GitHub.com Fallback** ⚠️