我在iphone sdk中创建了一个应用程序。 我已经获取了用户信用卡详细信息,如ccnumber,ccverification number等。 现在我有任务实现这个用户的付费按钮点击按钮付款应该完成。 用户不必输入其信用卡号或其他详细信息,因为我已经拍摄了。因此不应该进行用户交互。
我使用过这种方法
-(IBAction)pay:(id)sender
{
// perfomingSetMobileCheckout=YES;
// recordResults = FALSE;
NSString *parameterString = [NSString stringWithFormat:@"USER=myuser"
"&PWD=mypassword"
"&SIGNATURE=mysignature"
"&METHOD=DoDirectPayment"
"&CREDITCARDTYPE=Visa"
"&ACCT=1234"
"&EXPDATE=sep/11"
"&CVV2=256"
"&AMT=6549"
"&FIRSTNAME=Demo"
"&LASTNAME=Test"
"&STREET=WallStreet"
"&CITY=HI"
"&STATE=Ohio"
"&COUNTRY=US"
"&ZIP=98251"
"&COUNTRYCODE=US"
"&PAYMENTACTION=Sale"
"&VERSION=2.3"];
// txtCreditCardType.text,txtAccountNumber.text,txtExpireDate.text,txtTotalAmount.text,txtFirstName.text,txtLastName.text,txtStreet.text,txtCity.text,txtState.text,txtCountry.text,txtZip.text];
NSLog(@"parameter:%@",parameterString);
NSString *str = [NSString stringWithFormat:@"https://api-3t.sandbox.paypal.com/nvp?%@",parameterString];
NSLog(@"str:=%@",str);
NSURL *url = [NSURL URLWithString:@"https://api-3t.sandbox.paypal.com/nvp"];
//https://www.sandbox.paypal.com/cgi-bin/webscr
//https://api-3t.sandbox.paypal.com/nvp;
NSLog(@"url:%@",url);
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
NSString *msgLength = [NSString stringWithFormat:@"%d", [parameterString length]];
NSLog(@"msgLength:%@",msgLength);
[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
[theRequest setHTTPMethod:@"POST"];
[theRequest setHTTPBody: [parameterString dataUsingEncoding:NSUTF8StringEncoding]];
NSLog(@"theRequest:%@",theRequest);
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
NSLog(@"Connection:%@",theConnection);
if( theConnection )
{
NSMutableData *webData = [[NSMutableData data] retain];
NSLog(@"Data:=%@",webData);
//[self displayConnectingView];
}else
{
NSLog(@"theConnection is NULL");
}
}
因此,当用户点按付费按钮时,付款应由paypal&用户只能获得付款已完成的消息。
如何实施该付款按钮?