2011-09-20 4 views
1

나는 내 아이폰 프로젝트에서 지불을 위해 페이팔 (paypal) 라이브러리를 구현했습니다.아이폰의 페이팔 (paypal)에서 거래 아이디를 취득하는 것에 관하여

성공적으로 호출 된 다음의 방법으로 트랜잭션 ID를 검색하는 방법은 무엇입니까?

-(void)paymentSuccessWithKey:(NSString *)payKey andStatus:(PayPalPaymentStatus)paymentStatus { 
    status = PAYMENTSTATUS_SUCCESS; 
} 

- (void)paymentLibraryExit 
{ 
    UIAlertView *alert1 = nil; 

    switch (status) 
     {   
     case PAYMENTSTATUS_SUCCESS:    
       { 
        ....... 
        ........... 
       } 
       ............... 
       .............. 
     } 
} 

답변

0

마지막으로, 나는 다음과 같은 API를 세부 API에 의해 paykey를 사용하여 트랜잭션 ID를 가지고

- (void)paymentSuccessWithKey:(NSString *)payKey andStatus:(PayPalPaymentStatus)paymentStatus { 
    status = PAYMENTSTATUS_SUCCESS; 

    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://svcs.paypal.com/AdaptivePayments/PaymentDetails"]]; 

    NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:url]; 


    NSString *parameterString = [NSString stringWithFormat:@"payKey=%@&requestEnvelope.errorLanguage=%@",payKey,@"en_US"]; 

    NSString *msgLength = [NSString stringWithFormat:@"%d", [parameterString length]]; 

    [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"]; 

    //do post request for parameter passing 
    [theRequest setHTTPMethod:@"POST"]; 

    [theRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; 

    //passing key as a http header request 
    [theRequest addValue:api_username forHTTPHeaderField:@"X-PAYPAL-SECURITY-USERID"]; 

    //passing key as a http header request 
    [theRequest addValue:api_password forHTTPHeaderField:@"X-PAYPAL-SECURITY-PASSWORD"]; 

    [theRequest addValue:api_signature forHTTPHeaderField:@"X-PAYPAL-SECURITY-SIGNATURE"]; 

    [theRequest addValue:@"NV" forHTTPHeaderField:@"X-PAYPAL-REQUEST-DATA-FORMAT"]; 

    [theRequest addValue:@"NV" forHTTPHeaderField:@"X-PAYPAL-RESPONSE-DATA-FORMAT"]; 

    [theRequest addValue:app_id forHTTPHeaderField:@"X-PAYPAL-APPLICATION-ID"]; 

    [theRequest setHTTPBody: [parameterString dataUsingEncoding:NSUTF8StringEncoding]]; 

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

    if(connection) 
    { 
     webData = [[NSMutableData data] retain]; 
    } 
    else 
    { 
     NSLog(@"theConnection is NULL"); 
    } 
} 
+0

어디에서 api_username, api_password 및 api_signature를 찾았습니까?/ –

+0

테스트 용도로 api_username, api_password 및 api_signature를 원할 경우 https://developer.paypal.com/webapps/developer/applications/myapps –

+0

에서 가져올 수 있습니다. api_username, api_password 및 원래 계정에 대한 api_signature 다음 링크에서 제공되는 단계를 수행 할 수 있습니다. - http://www.putler.com/support/faq/how-to-get-paypal-api-username-password-and-signature-information/ 또는 https://www.paypal.com/us/cgi-bin/webscr?cmd=xpt/cps/merchant/wppro/WPProIntegrationSteps-outside –

관련 문제