1

我是 iPhone 开发的新手,我已经在我的 iPhone 应用程序中实现了 paypal sdk 并检查了沙盒环境,一切都运行良好,但是我需要在成功完成后找到 paypal 返回的交易 ID。我在下面检查了这个功能

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

但是它只向我显示状态。

4

1 回答 1

1

您是否查看过 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];
}
于 2012-09-14T07:23:58.263 回答