49 lines
1.3 KiB
Objective-C
49 lines
1.3 KiB
Objective-C
//
|
|
// PaySDKUnity3dBridge.m
|
|
// Unity-iPhone
|
|
//
|
|
// Created by xinglikeji on 2018/2/8.
|
|
//
|
|
|
|
#include "PaySDKUnity3dBridge.h"
|
|
#import "SpayClient.h"
|
|
|
|
|
|
@implementation PaySDKUnity3dBridge
|
|
|
|
@end
|
|
|
|
#if defined (__cplusplus)
|
|
extern "C" {
|
|
#endif
|
|
extern void AppPay(const char* tokenId,const char* callBackObjectName,const char* callBackFunName);
|
|
|
|
#if defined (__cplusplus)
|
|
}
|
|
#endif
|
|
|
|
#if defined (__cplusplus)
|
|
extern "C" {
|
|
#endif
|
|
|
|
void AppPay(const char* tokenId,const char* callBackObjectName,const char* callBackFunName)
|
|
{
|
|
[[SPayClient sharedInstance] pay:nil amount:nil spayTokenIDString:[[NSString alloc] initWithUTF8String:tokenId] payServicesString:@"pay.weixin.app" finish:^(SPayClientPayStateModel *payStateModel,SPayClientPaySuccessDetailModel *paySuccessDetailModel)
|
|
{
|
|
if(payStateModel.payState == SPayClientConstEnumPaySuccess){
|
|
UnitySendMessage(callBackObjectName,callBackFunName,[@"1" UTF8String]);
|
|
NSLog(@"%@", @"支付成功");
|
|
}else{
|
|
UnitySendMessage(callBackObjectName ,callBackFunName ,[[NSString stringWithFormat:@"%d",payStateModel.payState] UTF8String]);
|
|
NSLog(@"%@", @"支付失败");
|
|
}
|
|
|
|
}];
|
|
}
|
|
|
|
#if defined (__cplusplus)
|
|
}
|
|
#endif
|
|
|
|
|