gpt4 book ai didi

ios - 将 token 发送到后端 strip objective-c

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:32:14 27 4
gpt4 key购买 nike

我似乎找不到将我的 token 发送到我的 firebase 后端的代码。

- (void)addCardViewController:(STPAddCardViewController *)addCardViewController didCreateToken:(STPToken *)token completion:(STPErrorBlock)completion {
[self submitTokenToBackend:token completion:^(NSError *error) {
if (error) {
completion(error);
} else {
[self dismissViewControllerAnimated:YES completion:^{
[self showReceiptPage];
}];
}
}];
}

最佳答案

试试这段代码,

STPAddress  *address = [[STPAddress alloc] init];
address.name ="Test";
address.line1 = @"Test Address-1";
address.line2 = @"Test Address-2";
address.city = @"City";
address.postalCode = @"1234";
address.state = @"State";
address.country = @"Country";



STPCard *stripCard;
stripCard = [[STPCard alloc] init];
stripCard.number = strCard_Number;
stripCard.cvc = strCard_Cvv;
stripCard.expMonth = month;
stripCard.expYear = year;
stripCard.address = address;
stripCard.currency = @"INR";


[[STPAPIClient sharedClient] createTokenWithCard:stripCard completion:^(STPToken * _Nullable token, NSError * _Nullable error)
{
NSString *strMess= @"";
if(error) {
strMess = [error localizedDescription];
}
else {
strMess = stringValue(token.tokenId);
strMess = [NSString stringWithFormat:@"Token:\n-------\n%@\n\n\nCard Details:\n-------\n%@",strMess,token.allResponseFields];
//[Function showAlertMessage:strMess autoHide:NO];

NSString *strToken = @"";
strToken = token.tokenId;

NSLog(@"strToken: %@",strToken);
}
NSLog(@"strMess: %@",strMess);
}];

关于ios - 将 token 发送到后端 strip objective-c ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45471036/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com