Developer's Guide

32 August 2012 PayPal Mobile Payments Developer Guide and Reference – iOS Edition
tax = taxAmount[i];
shipping = shippingAmount[i];
details.invoiceData = [[[PayPalInvoiceData
alloc] init] autorelease];
details.invoiceData.totalShipping = [NSDecimalNumber
decimalNumberWithString:order];
details.invoiceData.totalTax = [NSDecimalNumber
decimalNumberWithString:tax];
details.invoiceData.totalShipping = [NSDecimalNumber
decimalNumberWithString:shipping];
details.description = description;
details.recipient = [emails objectAtIndex:i];
details.merchantName = [NSString
stringWithFormat:@"Recipient %d",i+1];
[payment.receiverPaymentDetails addObject:details];
}
[ppMEP advancedCheckoutWithPayment:payment]; }
Placing the Pay with PayPal Button
UIButton *button = [[PayPal getInstance] getPayButtonWithTarget:self
andAction:@selector(payWithPayPal) andButtonType:BUTTON_278x43
andButtonText:BUTTON_TEXT_PAY];
[self.view addSubview:button];
[super viewDidLoad];
The getPayButtonWithTarget method returns the Pay with PayPal button. Then, you can
add the button to your
UIViewController. The demo application payWithPayPal method is
passed through so the Pay with PayPal button can call it on
touchUpInside. For this example
payment, the payment type is
Hard Goods. Set the left and top position of the button by
specifying those parameters.
The
getPayButtonWithTarget method follows standard memory management conventions
and is autoreleased.
For a list of button image types, see PayPalButtonType.
Creating the PayPalPayment Object
PayPalPayment *currentPayment = [[[PayPalPayment alloc] init]
autorelease];
currentPayment.paymentCurrency = @”USD”;
currentPayment.paymentType = TYPE_GOODS;
currentPayment.subTotal = [NSDecimalNumber
decimalNumberWithString: @”10.00”];
currentPayment.recipient = @”
recipient@paypal.com”;
currentPayment.merchantName = @“Recipient Name”;