PayPal MPL iOS SDK中的参数SubTotal无效 [英] Invalid Parameter SubTotal in PayPal MPL iOS SDK
问题描述
当我尝试通过PayPal MPL处理交易以进行自适应支付时,我收到Invalid Parameter SubTotal错误。如果金额<<< 10000但不是如果金额> 10000.这是我的代码
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] !!!--------------------------------------
当我打印admin的小计时&安培;卖家给我看下面的价值
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
所以总数是29997.7 + 2.3 = 30000这是正确的。那我为什么会收到这个错误?
So the total is 29997.7+2.3 = 30000 which is correct. Then why I am getting this error ?
我遇到了这个问题 iOS - 贝宝集成 - "无效参数小计"错误表示存在10000的限制。此限制是否导致我出现此错误?
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 ?
我在实时环境中收到此错误Paypal。谢谢。
更新
我测试了新的交易,价格为AU $ 12700&我得到了同样的错误。所以我认为这是一个限制问题。任何人都能证实这一点吗?
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 ?
推荐答案
这是正确的 - 以下是每种货币的限制: https://www.paypal.com/us/webapps/helpcenter/helphub/ article /?solutionId = 11637& m = SRE
That's correct - here are the limits for each currency: https://www.paypal.com/us/webapps/helpcenter/helphub/article/?solutionId=11637&m=SRE
这篇关于PayPal MPL iOS SDK中的参数SubTotal无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!