Как интегрировать Alipay с правильными шагами в iOS

Я прошел через некоторые вопросы, такие как интеграция Alipay

но никто не помог мне интегрировать Alipay . Может кто-нибудь PLZ рассказать, как выяснить эту интеграцию в моем проекте iOS.

1 ответ

Есть два способа сделать это

  1. Интегрируйте Alipay SDK и используйте приложение Alipay для выполнения этой работы. Загрузите SDK: https://openhome.alipay.com/doc/docIndex.htm#goto=https://openhome.alipay.com/doc/viewKbDoc.htm?key=236698_261849&type=info

  2. Разработать WAP-сеть, чтобы платить по сети, это не наша работа...

Также для демонстрации вы можете посмотреть здесь Alipay SDK

Используйте Alipay для полной функции оплаты, у нас есть следующие шаги: 1) Первый контракт и оплатить сокровище, получить бизнес-идентификатор (партнер) и идентификатор счета (продавец) (это в основном отвечает за компанию) 2) Скачать публичный и файл закрытого ключа (с соответствующим шифрованием и подписью) 3) Скачать SDK (вход в систему оплаты сокровищ: /) В нем содержится очень подробный документ, контракт, как получить открытый и закрытый ключ, как вызвать интерфейс оплаты. 4) Для генерации информации о заказах 5) Позвоните, чтобы заплатить сокровище клиенту, клиенту через защищенный сервер Alipay Alipay, занимающийся 6) Оплата после оплаты продавцу возвращается клиенту и серверу. Есть демоверсия. встроенная функция Alipay SDK; Конкретный режим работы интегрированной платежной функции, вы можете обратиться к демоверсии 7) включают Alipay 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];

От шагов, чтобы интегрировать Alipay

Другие вопросы по тегам