PayPal自适应支付589023

2024-06-12 09:03:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我目前正在尝试在我的应用程序中实现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'}]}

我有没有其他的方法来计算金额? 我应该为佣金做一个不同的计算吗?在

欢迎任何提示。在


Tags: django实例应用程序ifisemailunicodeamount
1条回答
网友
1楼 · 发布于 2024-06-12 09:03:23

这就是我们在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];
}

相关问题 更多 >