iOS-如何在iPhone中成功交易后从贝宝检索交易ID



我是iPhone开发的新手,我已经在iPhone应用程序中实现了贝宝sdk,并与沙盒环境进行了检查,一切都很完美,然而,我需要找到贝宝成功完成后返回的交易id。我已经在下面检查了这个功能

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

然而,它只是向我展示了现状。

您看过PayPal提供的示例应用程序吗。。这是示例应用程序中的委托方法,按照这个方法你可以从中获得transactionId。。。

//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];
}

最新更新