Я включил Paypal Sdk для своего приложения iOS.Когда я нажимаю кнопку «Pay with PayPal», сервис становится недоступен. А ответ с сервера Paypal выглядит следующим образом.Пожалуйста, найдите мою ошибку.
Код, который я написал
[PayPal getPayPalInst].shippingEnabled = false;
//optional, set dynamicAmountUpdateEnabled to TRUE if you want to compute
//shipping and tax based on the user's address choice, default: FALSE
[PayPal getPayPalInst].dynamicAmountUpdateEnabled = false;
//optional, choose who pays the fee, default: FEEPAYER_EACHRECEIVER
[PayPal getPayPalInst].feePayer = FEEPAYER_EACHRECEIVER;
//for a payment with a single recipient, use a PayPalPayment object
PayPalPayment *payment = [[[PayPalPayment alloc] init] autorelease];
payment.recipient = @"rathnakuamr@yahoo.com";
NSString *currenctData = [[promoteArray objectAtIndex:0] objectForKey:@"currency_code"];
NSString *curreny_str = [currenctData stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
payment.paymentCurrency = curreny_str;
payment.description = @"Product";
payment.merchantName = @"Product";
if (UrgentTableview.hidden == NO)
{
payment.subTotal = [NSDecimalNumber decimalNumberWithString:[[promoteArray objectAtIndex:0] objectForKey:@"urgent"]];
}
else
{
payment.subTotal = [NSDecimalNumber decimalNumberWithString:[[[[promoteArray objectAtIndex:0] objectForKey:@"other_promotions"] objectAtIndex:selectedPlan] objectForKey:@"id"]];
//[[[[promoteArray objectAtIndex:0] objectForKey:@"other_promotions"] objectAtIndex:indexPath.row] objectForKey:@"name"]
// payment.subTotal = [NSDecimalNumber decimalNumberWithString:@"10"];
}
//invoiceData is a PayPalInvoiceData object which contains tax, shipping, and a list of PayPalInvoiceItem objects
payment.invoiceData = [[[PayPalInvoiceData alloc] init] autorelease];
payment.invoiceData.totalShipping = [NSDecimalNumber decimalNumberWithString:@"0"];
payment.invoiceData.totalTax = [NSDecimalNumber decimalNumberWithString:@"0"];
//invoiceItems is a list of PayPalInvoiceItem objects
//NOTE: sum of totalPrice for all items must equal payment.subTotal
//NOTE: example only shows a single item, but you can have more than one
payment.invoiceData.invoiceItems = [NSMutableArray array];
PayPalInvoiceItem *item = [[[PayPalInvoiceItem alloc] init] autorelease];
item.totalPrice = payment.subTotal;
if (UrgentTableview.hidden == NO)
{
item.name = @"Urgent";
}else{
item.name = [[[[promoteArray objectAtIndex:0] objectForKey:@"other_promotions"] objectAtIndex:selectedPlan] objectForKey:@"name"];
}
[payment.invoiceData.invoiceItems addObject:item];
[[PayPal getPayPalInst] checkoutWithPayment:payment];
}
NSMutableDictionary *ProductError = [PayPal getPayPalInst].responseMessage;
NSLog(@"Pazaroo Error: %@", ProductError);
NSString *severity = [[PayPal getPayPalInst].responseMessage objectForKey:@"severity"];
NSLog(@"severity: %@", severity);
NSString *category = [[PayPal getPayPalInst].responseMessage objectForKey:@"category"];
NSLog(@"category: %@", category);
NSString *errorId = [[PayPal getPayPalInst].responseMessage objectForKey:@"errorId"];
NSLog(@"errorId: %@", errorId);
NSString *responsemessage = [[PayPal getPayPalInst].responseMessage objectForKey:@"message"];
NSLog(@"message: %@", responsemessage);
И ответ, который я всегда получаю с сервера PayPal,
Product Error: {
category = Application;
errorId = 503;
message = "service unavailable";
severity = Error;
}