gpt4 book ai didi

python - Paypal 自适应支付 589023

转载 作者:太空宇宙 更新时间:2023-11-03 16:37:24 28 4
gpt4 key购买 nike

我目前正在尝试在我的应用程序中实现 django-paypal-adaptive 支付,并且遇到了一个实例,由于 589023,链式支付无法正常工作 - 如果由于货币转换导致小数额四舍五入,资金可能迷失

在我们的网站上,我们收取 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'}]}

有没有其他方法可以计算出金额?我应该对佣金进行不同的计算吗?

欢迎任何提示。

最佳答案

这就是我们如何解决 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];
}

关于python - Paypal 自适应支付 589023,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9519326/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com