在iPhone应用程序中的Paypal错误589023的解决方案

时间:2012-08-30 13:02:18

标签: paypal-sandbox

这是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];

}

这里的总和小计和税只允许在。(点)Ex:(234.xx)之后的两位数。所以通过使用%.2f来完美地工作。

0 个答案:

没有答案