これは、iPhone アプリケーションの Paypal (サンドボックス) エラー「589023」の解決策です。
-(無効)payWithPayPal{
for (int i=0;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];
}
ここで、合計、小計、および税は、.(ドット) の後に 2 桁しか使用できません 例: (234.xx)。したがって、 %.2f を使用して完全に機能します。