我已经完成了一些问题,例如Alipay Integration
但没有人帮我整合支付宝。任何人都可以告诉我如何在我的iOS项目中弄清楚这个整合。
答案 0 :(得分:-1)
有两种方法可以做到这一点
整合支付宝SDK并使用支付宝应用程序完成工作。 SDK下载自:https://openhome.alipay.com/doc/docIndex.htm#goto=https://openhome.alipay.com/doc/viewKbDoc.htm?key=236698_261849&type=info
开发一个在网上付费的WAP网站,这不是我们的工作......
同样适用于演示,您可以在此处查看Alipay SDK
使用支付宝到完整的支付功能,我们有以下内容 步骤:1)第一份合同和支付宝,获取业务ID (合伙人)和账户ID(卖方)(这主要是负责人 公司)2)下载公钥和私钥文件(用 相应的加密和签名)3)下载SDK(登录付费 宝贝:/)它提供了如何非常详细的文件,合同, 如何获取公钥和私钥,如何拨打付款 接口。 4)生成订单信息5)致电支付宝 到客户端,客户通过支付宝支付宝安全服务器处理6) 付款后付款给商家退还给客户和 server.There是一个Demo。集成了支付宝功能的SDK;该 具体的综合支付功能操作方式,即可 参考演示7)包括来自上面演示链接的支付宝sdk。
****包括这是表视图确实选择行**********
1 // 2 //The selected commodities call to pay treasure quick pay 3 // 4 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 5 { 6 /* 7 *Click the get the prodcut instance and initializes the order information 8 */ 9 Product *product = [_products objectAtIndex:indexPath.row]; 10 11 /* 12 *Parnter and seller only merchant. 13 *The demo parnter and seller information stored in (AlixPayDemo-Info.plist), external merchants can consider stored in *local server or other places. 14 *After signing the contract, pay treasure to be assigned a unique parnter and seller for each merchant. 15 */ 16 //If the partner and seller data stored in other place, please rewrite the following two lines of code 17 NSString *partner = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"Partner"]; 18 NSString *seller = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"Seller"]; 19 20 //Partner and seller failed to get, tips 21 if ([partner length] == 0 || [seller length] == 0) 22 { 23 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Prompt" 24 message:@"The lack of partner or seller. " 25 delegate:self 26 cancelButtonTitle:@"Determine" 27 otherButtonTitles:nil]; 28 [alert show]; 29 [alert release]; 30 return; 31 } 32 33 /* 34 *To generate orders information and signature 35 *Because of the limitation of demo, the private key in the *demo stored in the AlixPayDemo-Info.plist, the external *merchant can *be stored in local server or other places. 36 */ 37 //The commodity information gives the AlixPayOrder member //variable 38 AlixPayOrder *order = [[AlixPayOrder alloc] init]; 39 order.partner = partner; 40 order.seller = seller; 41 order.tradeNO = [self generateTradeNO]; //ID (order shall be formulated by the merchants) 42 order.productName = product.subject; //The title of goods 43 order.productDescription = product.body; //The description of the goods 44 order.amount = [NSString stringWithFormat:@"%.2f",product.price]; //Commodity prices 45 order.notifyURL = @"enter your server url"; //Callback URL 46 47 //Application of registered scheme, defined in the //AlixPayDemo-Info.plist URL types, for quick payment after //successful //re arouse the business application 48 NSString *appScheme = @"AlixPayDemo"; 49 50 //Product information will be spliced into a string 51 NSString *orderSpec = [order description]; 52 NSLog(@"orderSpec = %@",orderSpec); 53 54 //To obtain the private key and the signature of the external //merchant merchant information, according to the situation of //storing private key and the signature, only need to follow //the RSA //signature specification, and the signature string Base64 //coding and //UrlEncode 55 id<DataSigner> signer = CreateRSADataSigner([[NSBundle mainBundle] objectForInfoDictionaryKey:@"RSA private key"]); 56 NSString *signedString = [signer signString:orderSpec]; 57 58 //The sign string formatting string for the order, please follow the format 59 NSString *orderString = nil; 60 if (signedString != nil) { 61 orderString = [NSString stringWithFormat:@"%@&sign=\"%@\"&sign_type=\"%@\"", 62 orderSpec, signedString, @"RSA"]; 63 64 //Fast access to pay a single case and quick call payment interface 65 AlixPay * alixpay = [AlixPay shared]; 66 int ret = [alixpay pay:orderString applicationScheme:appScheme]; 67 68 if (ret == kSPErrorAlipayClientNotInstalled) { 69 UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"Prompt" 70 message:@"You did not install Alipay fast payment, please install. " 71 delegate:self 72 cancelButtonTitle:@"Determine" 73 otherButtonTitles:nil]; 74 [alertView setTag:123]; 75 [alertView show]; 76 [alertView release]; 77 } 78 else if (ret == kSPErrorSignError) { 79 NSLog(@"Signature error!"); 80 } 81 82 } 83 84 [tableView deselectRowAtIndexPath:indexPath animated:YES]; 85 }
主要集成是以下步骤的关键:
//.Package model order AlixPayOrder *order = [[AlixPayOrder alloc] init]; // To generate orders description NSString *orderSpec = [order description]; //The sign of the 2 id<DataSigner> signer = CreateRSADataSigner(@"The private key key"); // Incoming order description of signature NSString *signedString = [signer signString:orderSpec]; //3 generation order string NSString *orderString = [NSString stringWithFormat:@"%@&sign=\"%@\"&sign_type=\"%@\"", orderSpec, signedString, @"RSA"]; //The 4 call to the payment interface AlixPay * alixpay = [AlixPay shared]; // appScheme: The first merchant own protocol int ret = [alixpay pay:orderString applicationScheme:appScheme];