3.2 获取支付产品本地信息接口

功能说明:

研发方可以直接调用该接口来获取苹果iTunes Connect开发者管理后台上配置的支付产品详细信息。在获取的产品详细信息中,产品的描述以及产品的价格和对应的货币单位等信息将随着当前玩家的苹果账户所处的地区不同而不同。

接口形式:

-(void)getLocalDetailsOfProductWithIDs:(NSArray*)productIDs onCompletionHandler:(RNRequestProductsCompletionHandler)handler;

接口参数:

productIDs:包含需要查询的支付产品的ID数组(必须)

handler:接口回调(必须)

接口示例:

[[RNAppleIapHelper sharedInstance]getLocalDetailsOfProductWithIDs:
     @[@“XXX.001”,@“XXX.002”] onCompletionHandler:^(BOOL  isSuccess, NSArray  *appleProducts) {
         if (isSuccess && appleProducts && [appleProducts count]>0) {
             //objects in the array are the instance of the class RNAppleProduct
             for ( RNAppleProduct*p in appleProducts) {
                 //产品 id
                 NSString* productId = p.productIdentifier;
                 //产品本地价格,保留小数点后面 2 位
                 NSString *price = p.stringPrice;
                 //产品本地货币代码(如:CNY)
                 NSString* currencyCode = p.priceCurrencyCode;
             }
         }else{     
             NSLog(@"[error: failed to request product details]");
         }
     }];

Last updated

Was this helpful?