When I try to process the transaction through the PayPal MPL for adaptive payments , I am getting "Invalid Parameter SubTotal" error. It works perfectly if amount is < 10000 but not if amount is > 10000. Here is my code
-(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];
}
Here is the values that I am using to process the transaction
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] !!!--------------------------------------
When I print the subtotal of admin & seller its showing me below values
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
So the total is 29997.7+2.3 = 30000 which is correct. Then why I am getting this error ?
I came across this question iOS - PayPal integration - "Invalid parameter Subtotal" error which tells that there is a limit of 10000. Is this limit causing me this error ?
I am getting this error in LIVE ENVIRONMENT of Paypal. Thanks.
UPDATE I tested new transaction with AU$12700 & I got the same error. So I think its a limit issue. Can any one confirm this ?
That's correct - here are the limits for each currency: https://www.paypal.com/us/webapps/helpcenter/helphub/article/?solutionId=11637&m=SRE