0

我经历了一些问题,例如支付宝集成

但没有人帮助我集成支付宝。谁能告诉我如何在我的 iOS 项目中找出这个集成。

4

1 回答 1

-1

有两种方法可以做到这一点

  1. 集成支付宝 SDK 并使用支付宝应用来完成这项工作。SDK下载地址:https ://openhome.alipay.com/doc/docIndex.htm#goto=https://openhome.alipay.com/doc/viewKbDoc.htm?key=236698_261849&type=info

  2. 开发 WAP 网络以进行网络支付,这不是我们的工作……</p>

也可以用于演示,您可以在这里查看支付宝 SDK

使用支付宝来完成支付功能,我们有以下步骤: 1)首先签约支付宝,获取商家ID(合作伙伴)和账户ID(卖家)(这个主要是公司负责) 2)下载公众号和私钥文件(有相应的加密和签名) 3)下载SDK(登录支付宝:/)里面提供了如何获取一个非常详细的文档,合约,如何获取公私钥,如何调用支付接口。4) 生成订单信息 5) 调用支付宝给客户端,客户端由支付宝支付宝安全服务器处理 6) 支付给商户付款后返回给客户端和服务器。有一个Demo。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];

步骤整合支付宝

于 2015-06-25T05:26:31.343 回答