有没有什么办法从iOS应用程序向卡充电,而无需从我们的服务器收取后端费用(Stripe – iOS)

我正在使用条纹付款。 我想从我的应用程序中收取卡。 目前我正在使用下面的代码来收费卡,但这个过程是从服务器端完成的。 有什么办法从应用程序向卡充电,而不是将stripeToken发送到服务器?

-(void)createBackendChargeWithToken:(STPToken *)token completion:(void (^)(PKPaymentAuthorizationStatus))completion { NSURL *url = [NSURL URLWithString:@"https://example.com/token"]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url]; request.HTTPMethod = @"POST"; NSString *body = [NSString stringWithFormat:@"stripeToken=%@&amount=%@", token.tokenId,_txtAmount.text]; request.HTTPBody = [body dataUsingEncoding:NSUTF8StringEncoding]; NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration]; NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if (error) { completion(PKPaymentAuthorizationStatusFailure); // [self customeAlertView:@"Payment not successful" message:@"Please try again later."]; NSLog(@"Payment not successful. Please try again later."); } else { completion(PKPaymentAuthorizationStatusSuccess); // [self customeAlertView:@"Success" message:@"Please enjoy your new purchase."]; NSLog(@"Payment Success. Please enjoy your new purchase."); } }]; [task resume]; } 

不,这是不可能的。 Stripe的iOS和Android绑定仅用于收集卡信息并创build令牌,就像Stripe.js和Checkout在Web应用程序中一样。

一旦令牌被创build,它必须被发送到外部服务器,你可以在API请求中使用它,例如创build一个收费 。

必须使用外部服务器的原因是除了令牌创build之外的所有API请求都必须使用您的秘密API密钥来发布,这些密钥不得直接用于您的应用程序,否则恶意用户将能够检索并使用它来访问您的帐户。