我是 iPhone 开发的新手,我已经在我的 iPhone 应用程序中实现了 paypal sdk 并检查了沙箱环境,一切都运行良好, 但是我需要找到成功完成后 Paypal 返回的交易ID。 我在下面检查了这个功能
- (void)paymentSuccessWithKey:(NSString *)payKey andStatus:(PayPalPaymentStatus)paymentStatus
{
status = PAYMENTSTATUS_SUCCESS;
}
但是它只显示状态。
最佳答案
您看过 PayPal 提供的示例应用程序了吗?这是示例应用程序中的委托(delegate)方法,按照此操作您可以从中获取 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];
}
关于iphone - iOS - 如何在 iPhone 交易成功后从 paypal 检索交易 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12419081/