0

当我尝试通过 PayPal MPL 为自适应支付处理交易时,我收到“Invalid Parameter SubTotal”错误。如果金额<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" 错误,它告诉我有 10000 的限制。这个限制会导致我这个错误吗?

我在 Paypal 的实时环境中收到此错误。谢谢。

更新 我用 12700 澳元测试了新交易,我得到了同样的错误。所以我认为这是一个限制问题。任何人都可以证实这一点吗?

4

1 回答 1

1

没错 - 以下是每种货币的限制:https ://www.paypal.com/us/webapps/helpcenter/helphub/article/?solutionId=11637&m=SRE

于 2013-07-25T03:53:25.770 回答