关于支付宝的注意事项
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 alloc] init];
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上面设置
}