iphone - iOS - 如何在 iPhone 交易成功后从 paypal 检索交易 ID

标签 iphone paypal

我是 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/

相关文章:

ios - 为什么 iPhone 5S 和 iPad Air 之前的设备在转换 null 变量时不会崩溃?

ios - 如何在表格 View 单元格中添加复选框?

paypal - 在 Paypal Merchant API 中调用 GetBalance 函数

ios - navigator.notification.alert 不适用于 ios 的 cordova

iphone - Xcode 项目总是抛出 SIGTRAP?

paypal - IE 问题与 PayPal In-Context Express Checkout

php - PayPal 捐赠按钮 最低捐赠金额

java - Paypal 重定向 URL 要求在已经登录时登录

javascript - 在 Retina iPhone 上正确设置设备宽度和比例? CSS

php - Paypal 集成中的未知错误