儲值(必接)
作用
用於玩家儲值,可傳遞透傳參數,如果沒有傳遞透傳參數的需要,該字段可傳入空字符串。調用此接口調用後,直接彈apple的付款界面(顯示是否,購買的次數,都是由遊戲方控制),示例圖:
函數
objective-c
- (void)gamedreamerStoreWithProItemid:(NSString *)proItemid
andValidation:(NSString * _Nullable)validation
andCompletion:(void (^)(NSDictionary *result, NSError *error))storeCallback;參數
| 參數名 | 是否可空(是/否) | 說明 |
|---|---|---|
| proItemid | 否 | 平臺品項ID,此id由遊戲負責的PM提供 |
| validation | 是 | 透傳參數,透傳參數由原廠傳遞 |
回調
注意一定不能以客戶端返回作為用戶支付的結果,應以服務器端的接收的支付通知或查詢API返回的結果為準。 result參數:
| 字段 | 說明 |
|---|---|
| code | 當code = 1000時,表示購買成功 |
error參數(當其參數不為空的時候,就表示購買失敗)
示例代碼
objective-c
[[GamedreamerManager shareInstance] gamedreamerStoreWithProItemid:proItemId andValidation:@"test_by_zts" andCompletion:^(NSDictionary *result, NSError *error) {
NSLog(@"---------- 外部接口储值回调 >>>>> ");
NSString *msg = @"";
if(error){
//錯誤信息
NSLog(@"%@",error);
}else{
msg = [NSString stringWithFormat:@"%@",result[@"message"]];
NSLog(@"%@",result);
if([[result objectForKey:@"code"] intValue] == 1000){
//儲值成功
}
}
}];