user1640237
user1640237

Reputation: 83

iOS - How to retrieve transaction ID from paypal after successful transaction in iPhone

I am new to iPhone development, i have implemented paypal sdk in my iPhone app and check with sandbox environment, every thing is working perfectly, however i need to find transaction id returned by paypal after successfully done. I have checked with this function below

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

however it is only showing me the status.

Upvotes: 1

Views: 698

Answers (1)

vishy
vishy

Reputation: 3231

Have you looked at the sample app provided from PayPal.. Here is the delegate method from the sample app, follow this you can get the transactionId from this...

//paymentSuccessWithKey:andStatus: is a required method. in it, you should record that the payment
//was successful and perform any desired bookkeeping. you should not do any user interface updates.
//payKey is a string which uniquely identifies the transaction.
//paymentStatus is an enum value which can be STATUS_COMPLETED, STATUS_CREATED, or STATUS_OTHER
- (void)paymentSuccessWithKey:(NSString *)payKey andStatus:(PayPalPaymentStatus)paymentStatus 
{
    NSString* transactionId = [[NSString alloc] initWithString:[payKey substringFromIndex:3]];
    status = PAYMENTSTATUS_SUCCESS;

    [self messageAlert:[NSString stringWithFormat:@"%@",transactionId] 
             title:@"Transaction success" delegate:nil];
    [transactionId release];
}

Upvotes: 1

Related Questions