ios6 - PayPal MPL iOS SDK 中的无效参数小计

标签 ios6 paypal paypal-adaptive-payments invalid-argument

当我尝试通过 PayPal MPL 处理自适应支付交易时,出现“无效参数小计”错误。如果金额 < 10000 则效果很好,但如果金额 > 10000 则效果不佳。这是我的代码

    -(void)processSplitPaymentWithAdminPayPalId:(NSString*)adminId sellerPayPalId:(NSString*)sellerId withAdminPercentage:(NSNumber*)adminPercentage forTotalAmount:(NSNumber*)totalAmount andShippingCharges:(NSNumber*)shippingCharges
{
    DLog(@"!!!--------------------------------------");
    DLog(@"AdminID: %@",adminId);
    DLog(@"SellerID: %@",sellerId);
    DLog(@"Admin Percentage: %@",adminPercentage);
    DLog(@"Total Amount: %@",totalAmount);
    DLog(@"Shipping Charges: %@",shippingCharges);
    DLog(@"!!!--------------------------------------");

    PayPal *ppMEP = [PayPal getPayPalInst];
    ppMEP.shippingEnabled = FALSE;
    ppMEP.dynamicAmountUpdateEnabled = FALSE;
    ppMEP.feePayer = FEEPAYER_EACHRECEIVER;
    PayPalAdvancedPayment *payment = [[[PayPalAdvancedPayment alloc] init] autorelease];
    payment.paymentCurrency = @"AUD";

    payment.receiverPaymentDetails = [NSMutableArray array];

    NSArray *emails = nil;
    if ([adminPercentage doubleValue]>0.0) {
        emails = [[NSArray alloc]initWithObjects:adminId,sellerId, nil];
    }
    else {
        emails = [[NSArray alloc]initWithObjects:sellerId, nil];
    }


    for (int i = 0; i < emails.count; i++)
    {
        PayPalReceiverPaymentDetails *details = [[[PayPalReceiverPaymentDetails
                                                   alloc] init] autorelease];

        details.invoiceData = [[[PayPalInvoiceData alloc] init] autorelease];

        float adminAmount = [adminPercentage floatValue];
        float sellerAmount = [totalAmount floatValue] - adminAmount;

        switch (i) {
            case 0:
                if (emails.count>1) {
                    // Admin commission
                    details.subTotal = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%.2f",adminAmount]];
                    NSLog(@"Admin commission::details.subTotal: %@",details.subTotal);
                    details.description = @"Amount paid to Admin as a Commission";
                    details.merchantName = [NSString stringWithFormat:@"%@",ADMIN];
                }
                else {
                    // Seller amount
                    details.invoiceData.totalShipping = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%@",shippingCharges]];
                    details.subTotal = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%.2f",sellerAmount]];
                    NSLog(@"Seller amount 1::details.subTotal: %@",details.subTotal);
                    details.description = [NSString stringWithFormat:@"Amount paid to Seller :%@",self.product.sellerName];
                    details.merchantName = [NSString stringWithFormat:@"%@ : %@",SELLER,self.product.sellerName];
                }
                break;
            case 1:
                // Seller amount
                details.invoiceData.totalShipping = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%@",shippingCharges]];
                details.subTotal = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%.2f",sellerAmount]];
                NSLog(@"Seller amount 2::details.subTotal: %@",details.subTotal);
                details.description = [NSString stringWithFormat:@"Amount paid to Seller :%@",self.product.sellerName];
                details.merchantName = [NSString stringWithFormat:@"%@ : %@",SELLER,self.product.sellerName];
                break;
            default:
                break;
        }
        details.recipient = [emails objectAtIndex:i];
        [payment.receiverPaymentDetails addObject:details];
    }
    [ppMEP advancedCheckoutWithPayment:payment];
    [emails release];
}

这是我用来处理交易的值

2013-07-24 11:28:20.234 AppName[6602:907] !!!--------------------------------------
2013-07-24 11:28:20.236 AppName[6602:907] AdminID: admin@gmail.com
2013-07-24 11:28:20.237 AppName[6602:907] SellerID: seller@gmail.com
2013-07-24 11:28:20.239 AppName[6602:907] Admin Percentage: 2.30
2013-07-24 11:28:20.240 AppName[6602:907] Total Amount: 30000
2013-07-24 11:28:20.241 AppName[6602:907] Shipping Charges: 0
2013-07-24 11:28:20.242 AppName[6602:907] !!!--------------------------------------

当我打印管理员和卖家的小计时,它会显示以下值

2013-07-24 12:21:44.685 AppName[6720:907] Admin commission::details.subTotal: 2.3
2013-07-24 12:21:44.687 AppName[6720:907] Seller amount 2::details.subTotal: 29997.7

所以总数是 29997.7+2.3 = 30000,这是正确的。那为什么我会收到这个错误?

我遇到了这个问题 iOS - PayPal integration - "Invalid parameter Subtotal" error这告诉我有 10000 的限制。这个限制是否导致了我这个错误?

我在 Paypal 的 LIVE ENVIRONMENT 中遇到此错误。 谢谢。

更新 我用 AU$12700 测试了新交易,我得到了同样的错误。所以我认为这是一个限制问题。谁能证实这一点?

最佳答案

关于ios6 - PayPal MPL iOS SDK 中的无效参数小计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17827245/

相关文章:

ios - Paypal iOS 总是返回相同的 Paypal ID

php - PayPal-PHP-SDK 是否支持向另一个 paypal 帐户付款?

paypal - 如何汇款到任何 Paypal 账户

ios - 应用程序调试 - 什么决定了我的应用程序在后台停留的时间?

objective-c - RestKit iOS 应用程序根据请求崩溃

paypal - 为什么创建应用程序按钮在 paypal 中被禁用?

php - 将数据插入2个表php

iphone - 如何在 UIToolBar 中添加条形按钮

iOS 5 iPhone 应用程序无法在 iOS 6 iPad 上运行

paypal - 为不存在的业务测试 Premier/Business 帐户