PayPal自适应薪酬589023

时间:2012-03-01 15:50:59

标签: python django paypal

我目前正在尝试将django-paypal自适应付款实施到我的应用中,并且由于589023 - If a fractional amount is rounded due to currency conversion, funds could be lost

而遇到链接付款无效的实例

在我们的网站上,我们需要6%的佣金,以下是我们所拥有的代码的简单示例。

amount = 5
commission = amount * 0.06
# commission = 0.3
data['receiverList'] = {'receiver': [{'email': settings.PAYPAL_EMAIL, 
    'amount': unicode(amount),
    'primary': 'true'}, 
    {'email': secondary_receiver, 
    # 'amount': unicode(5 - 0.3),
    'amount': unicode(amount - commission),
    'primary': 'false'}]}

我应该以不同的方式计算金额吗? 我应该对佣金进行不同的计算吗?

任何提示都会受到欢迎。

1 个答案:

答案 0 :(得分:1)

这就是我们解决iPhone应用程序中Paypal(沙盒)错误“589023”的方式:

-(void)payWithPayPal{
    for (int i=0;i<numberOfReceipents; i++) {  
        PayPal  *payPal=[PayPal  getPayPalInst];
        payPal.shippingEnabled = FALSE;
        payPal.dynamicAmountUpdateEnabled = NO;
        payPal.feePayer = FEEPAYER_EACHRECEIVER;

        PayPalPayment *payment = [[[PayPalPayment alloc] init] autorelease];
        payment.recipient = @"UKMCA2010@GMAIL.COM";    
        payment.paymentCurrency = @"USD";
        payment.description = @"Payment Discription here...";

        SampleSingleton *sample=[SampleSingleton sharedInstance];
        payment.merchantName =[sample getStrRestaurantName]; 
        payment.invoiceData = [[[PayPalInvoiceData alloc] init] autorelease];
        payment.invoiceData.invoiceItems = [NSMutableArray array];   

        PayPalInvoiceItem *item = [[PayPalInvoiceItem alloc] init];               
        item.totalPrice=[NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%.2f", 126.34545]]; // If u give xxx.xx , no need to give the %.2f , u can give directly %f

        item.name = objTempReceived.strItemName;
        item.itemId = @"Item ID";

        [payment.invoiceData.invoiceItems addObject:item];

        [item release];
    }

    payment.subTotal = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%.2f",126.34545]]; //Total and Subtotal must be equal   
    payment.invoiceData.totalTax = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%.2f",3.34]];

    NSLog(@"Total Tax is :%@",[payment.invoiceData.totalTax stringValue]);

    [payPal checkoutWithPayment:payment];
}