码迷,mamicode.com
首页 > 其他好文 > 详细

关于支付宝的注意事项

时间:2015-04-30 08:57:37      阅读:145      评论:0      收藏:0      [点我收藏+]

标签:

1.生成订单信息

AlixPayOrder *order = [[AlixPayOrder alloc] init];

order.partner = PartnerID;

order.seller = SellerID;

order.tradeNO = [self generateTradeNO]; //订单ID(由商家自行制定)

order.productName = product.subject; //商品标题

order.productDescription = product.body; //商品描述

order.amount = [NSString stringWithFormat:@"%.2f",product.price]; //商品价格

order.notifyURL =  @"http%3A%2F%2Fwwww.xxx.com"//回调URL


2.签名加密



// 支付宝头文件

#import "AlixPayOrder.h"

#import "PartnerConfig.h"

#import "DataSigner.h"

#import "AlixLibService.h"

// 支付宝头文件




- (IBAction)buy {

    // 1.生成订单信息

    AlixPayOrder *order = [[AlixPayOrder allocinit];

    order.partner = PartnerID// 商户ID

    order.seller = SellerID// 帐号ID

    

    order.tradeNO = @"2014082717183778587475"// 订单ID(由商家自行制定)

order.productName = self.deal.title// 商品标题

order.productDescription = self.deal.desc// 商品描述

order.amount = [NSString stringWithFormat:@"%.2f", [self.deal.current_price floatValue]]; //商品价格

order.notifyURL =  @"http%3A%2F%2Fwwww.xxx.com"// 回调URL

    

    // 2.签名加密

    id<DataSigner> signer = CreateRSADataSigner(PartnerPrivKey);

    NSString *signedString = [signer signString:[order description]];

    

    // 3.利用订单信息、签名信息、签名类型生成一个订单字符串

    NSString *orderString = [NSString stringWithFormat:@"%@&sign=\"%@\"&sign_type=\"%@\"",

                             [order description], signedString, @"RSA"];

    // 4.打开支付宝,传递订单信息

    [AlixLibService payOrder:orderString AndScheme:@"heituan" seletor:@selector(paymentResultDelegate:) target:self];

//url上面设置

}


关于支付宝的注意事项

标签:

原文地址:http://blog.csdn.net/guoyule2010/article/details/45375301

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!