1

How to get Transaction id from paypal sdk 2.0.1, i searched a lot but i am stuck at getting transaction id from paypal sdk 2.0.1.

check response below;-

{
client =
 {
    environment = sandbox;
    "paypal_sdk_version" = "2.0.1";
    platform = iOS;
    "product_name" = "PayPal iOS SDK";
 };
response =     
  {
    "create_time" = "2014-04-01T07:02:34Z";
    id = "PAY-3J588144TJ947892HKM5GJCQ";
    intent = sale;
    state = approved;
  };
"response_type" = payment;
 }

Above code i got pay id but not getting transaction id, how can i get transaction id.???

Sandy Patel
  • 768
  • 7
  • 19

1 Answers1

1

You should look at the PayPal SDK documentation to Verify Mobile Payment. Have a closer look to Sale and Transaction object.

Sale Object has id field:

id |    string  ID of the sale transaction.

All you need is to interact with REST API.

EDIT:

Try to send curl request using NSURLConnection and NSMutableRequest as described in examples:

  1. Converting a CURL command for Objective C

  2. Objective-c equivalent of curl request

  3. Basic HTTP Authentication Using iOS

Community
  • 1
  • 1
NeverHopeless
  • 11,077
  • 4
  • 35
  • 56
  • Hello . thanks for responding. i try this api but i am getting fail request, https://api.sandbox.paypal.com/v1/payments/payment/PAY-5YK922393D847794YKER7MU i use this api but not working can u seggest me right way.?? how to get it. – Sandy Patel Apr 01 '14 at 07:33
  • How do you call it ? Have you passed an access token and set content type in the request ? – NeverHopeless Apr 01 '14 at 07:54
  • hi.. no i just pass the https://api.sandbox.paypal.com/v1/payments/payment/PAY-3J588144TJ947892HKM5GJCQ'. so how can i pass access token and content t. how to get token and content type.? – Sandy Patel Apr 01 '14 at 09:15
  • How to get accessToken .? – Sandy Patel Apr 01 '14 at 09:23
  • Follow this link, you need to setup app and get the necessary data from there. There are link at the left side. Please explore them as well. – NeverHopeless Apr 01 '14 at 09:23
  • Hi...i want to know that how to get access token and where is the link.? – Sandy Patel Apr 01 '14 at 09:32
  • Hi.. i got access token and i pass content type and access token like this [request setPostValue:@"application/json" forKey:@"Content-Type"]; [request setPostValue:[NSString stringWithFormat:@"Bearer {%@}",accessToken] forKey:@"Authorization"]; but request got fail. – Sandy Patel Apr 01 '14 at 10:31
  • try to remove `{` and `}` – NeverHopeless Apr 01 '14 at 10:37
  • Ok, pass `content-type = application/x-www-form-urlencoded` and `grant_type=client_credentials` – NeverHopeless Apr 01 '14 at 10:50
  • ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.sandbox.paypal.com/v1/payments/payment/%@",strID]]]; [request setPostValue:@"application/json" forKey:@"Content-Type"]; [request setPostValue:[NSString stringWithFormat:@"Bearer %@",accessToken] forKey:@"Authorization"]; [request setDelegate:self]; [request setRequestMethod:@"GET"]; [request setDidFinishSelector:@selector(requestFinished:)]; [request setDidFailSelector:@selector(RequestFailed:)]; [request startAsynchronous]; – Sandy Patel Apr 01 '14 at 11:15