Reputation: 243
i integrate paypal into my app by using the following code:
- (IBAction)MakePayment:(id)sender
{
PayPalItem * item1 = [PayPalItem itemWithName:@"Item" withQuantity:1 withPrice:[NSDecimalNumber decimalNumberWithString:@"0.04"] withCurrency:@"USD" withSku:@"SKU-Item"];
NSArray * items = @[item1];
NSDecimalNumber * subtotal = [PayPalItem totalPriceForItems:items];
NSDecimalNumber * shipping = [[NSDecimalNumber alloc]initWithString:@"0.0"];
NSDecimalNumber * tax = [[NSDecimalNumber alloc]initWithString:@"0.0"];
PayPalPaymentDetails * paymentDetails = [PayPalPaymentDetails paymentDetailsWithSubtotal:subtotal withShipping:shipping withTax:tax];
NSDecimalNumber * total = [[subtotal decimalNumberByAdding:shipping]decimalNumberByAdding:tax];
PayPalPayment * payment = [[PayPalPayment alloc]init];
payment.amount = total;
payment.currencyCode = @"USD";
payment .shortDescription = @"My Payment";
payment.items = items;
payment.paymentDetails = paymentDetails;
if(!payment.processable)
{
}
PayPalPaymentViewController * paymentViewController = [[PayPalPaymentViewController alloc]initWithPayment:payment configuration:self.payPalconfig delegate:self];
[self presentViewController:paymentViewController animated:YES completion:nil];
}
In this code i entered amount through codes. But according to the requirement user have to enter any amount manually on payment page. Please suggest me any code by which i can allow user to enter amount manually on payment page by displaying amount field.
Upvotes: 0
Views: 122
Reputation: 308
If you want to allow your user to enter or select price, then ask user enter manually with textfield before paypal controller appears.
You can't enter price in paypal controller. Then you can pass price value in paypal controller.
Upvotes: 2