2011-12-10 6 views
-2

paypal webservicesを使用してiphoneアプリにpaypalを統合する方法。paypal webservicesを使用してiphoneアプリにpaypalを統合する方法

NSString *parameterString = [NSString stringWithFormat:@"USER=%@&PWD=%@&SIGNATURE=%@&VERSION=57.0&METHOD=SetexpressCheckout&AMT=%.2f&CURRENCYCODE=USD&&DESC=10.00&CancelURL=%@&RETURNURL=%@", userName, password, signature,@"http://www.fourerr.com",returnCallURL]; 
NSURL *url = [NSURL URLWithString:@"https://api-3t.sandbox.paypal.com/nvp"]; 
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url]; 
NSString *msgLength = [NSString stringWithFormat:@"%d", [parameterString length]]; 

[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"]; 
[theRequest setHTTPMethod:@"POST"]; 
[theRequest setHTTPBody: [parameterString dataUsingEncoding:NSUTF8StringEncoding]]; 


NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; 
[theConnection start]; 

コンソール:

getting error: paypal Data: TIMESTAMP=2011%2d12%2d10T11%3a43%3a53Z&CORRELATIONID=2e0852675ece5&ACK=Failure&VERSION=57%2e0&BUILD=2271164&L_ERRORCODE0=10401&L_ERRORCODE1=10471&L_ERRORCODE2=10472&L_SHORTMESSAGE0=Transaction%20refused%20because%20of%20an%20invalid%20argument%2e%20See%20additional%20error%20messages%20for%20details%2e&L_SHORTMESSAGE1=Transaction%20refused%20because%20of%20an%20invalid%20argument%2e%20See%20additional%20error%20messages%20for%20details%2e&L_SHORTMESSAGE2=Transaction%20refused%20because%20of%20an%20invalid%20argument%2e%20See%20additional%20error%20messages%20for%20details%2e&L_LONGMESSAGE0=Order%20total%20is%20invalid%2e&L_LONGMESSAGE1=ReturnURL%20is%20invalid%2e&L_LONGMESSAGE2=CancelURL%20is%20invalid%2e&L_SEVERITYCODE0=Error&L_SEVERITYCODE1=Error&L_SEVERITYCODE2=Error 

答えて

1

エラーメッセージがOrder total is invalidを言うと、私はあなたのパラメータ文字列で注文合計が表示されません。多分これは問題ですか?

+0

私には、paypal webservice用の適切なURL文字列を入力してください。 – saurav

+1

APIドキュメントをお読みください。 https:///// / – tobiasbayer