如何在ionic 3中为视频等动态内容实现应用内购买?

问题描述

我开发了一个包含付费培训视频的应用程序。因此,我集成了用于支付的条带。但是谷歌被暂停了。在他们的开发者政策中:

以下是Google Play应用内结算当前不支持的一些产品示例:

零售商品,例如杂货,服装,家庭用品和电子产品。

服务费,包括出租车和运输服务,清洁服务,送餐,机票和活动门票。

一次性会员费或经常性会费,包括健身房会员资格,会员计划或提供配件,衣服或其他实物产品的俱乐部。

一次性付款,包括点对点付款,在线拍卖和捐赠。

电子账单支付,包括信用卡账单,公用事业以及电缆或电信服务。

因此,请尝试将应用内购买集成到我的应用中。但是在该插件中,我们每次创建视频时都需要输入产品密钥,这对我不利。管理员可以随时创建视频,而无需每次都重建。

目标是:

管理员可以在Google Play控制台中创建产品,并使用该产品密钥在管理面板中上传视频。

这是我的代码:

getVideosWithProductId(){
    this.http.post('http://localhost/api/training/get_training_videos').map(res=>res.json()).subscribe((data)=>{
        if(data.data){
          this.playlist=data.data;
          this.playlist.forEach((v) => {
            if(v.product_id && v.product_id != null && v.product_id != ''){
              this.productIds = v.product_id;
             //register products here
              this.store.register({
                id: v.product_id,type: this.store.NON_CONSUMABLE,alias:'',});
              }
          });
          this.store.refresh();
  
          
        }
        else{
          this.message=data.message;
        }
        this.loading.dismiss();
      });
  }

  purchase(video){
    this.store.order(video).then(p => {
          // Purchase in progress!
          alert(JSON.stringify(p))
        },e => {
          alert(JSON.stringify(e))
          // this.presentAlert('Failed',`Failed to purchase: ${e}`);
        }).catch((e)=>{
          alert(JSON.stringify(e))
        });
}

<div  *ngFor="let video of playlist" (click)="purchase(video)">
<div>
 <span class="price">{{video.currency}}{{video.video_price}}</span>
 <img [src]="video.banner_image_filepath" class="video_banner">
</div>
<div>
    <p class="video_title">{{video.video_title}} <span class="uploaded_date">{{video.created_date | amDateFormat:'LL'}}</span></p>
    <p class="short-desc">{{video.video_short_description}}</p>
</div>
</div>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...