Reputation: 21
I am working to integrate PayPal in our iOS app. On our backend we have implemented chained payment and exposed that on the api. The backend is responsible for generating the pay key.
On the web app the library opens a light box and injects the pay key for the user to approve the payment by logging in.
We need to accomplish this same thing on the iOS app using either the paypal sdk or MPL library. I see how to do a chained payment from beginning to end in the iOS app but no how to simply jump right into the approval process with an already generated pay key.
Upvotes: 1
Views: 1616
Reputation: 964
I have just complete delay chained payment in iPhone
First create transaction with all parameter like amount,receipts etc and get PAY_KEY for the transaction from backend (PHP,JAVA,RUBY or any) with the help of reference paypal link :- Step 2 : https://devtools-paypal.com/guide/ap_chained_payment/php?success=true
Then with paykey we can make payment only in webview so Open UIWebView in ViewController with following URL
[wbView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay?paykey=%@&expType=mini",@"[PAY_KEY]"]]]];
and the handle delegate methods
#pragma mark - UIWebView Delgate
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:UIWebViewNavigationType)navigationType
{
NSLog(@"\n\n-- %@\n--%@\n\n",request.URL,[request.URL absoluteString]);
if([[request.URL absoluteString] isEqualToString:@"https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/closewindow"])
{
[self validatePayment];
return YES;
}
return YES;
}
- (void)webViewDidStartLoad:(UIWebView *)webView
{
if (!actView.isAnimating) {
[actView startAnimating];
}
NSLog(@"start %@",webView.request);
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
NSLog(@"End %@",webView.request);
[actView stopAnimating];
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
[actView stopAnimating];
}
This will open popwindow with for login & payment of the given PAYKEY transaction
Login and make payment in Paypal Popup
The finally on close the popup you can validate payment with the PAYKEY
from backend by step 4 in https://devtools-paypal.com/guide/ap_chained_payment/php?success=true
Upvotes: 9
Reputation: 1081
At this time, there is no true native flow for Adaptive Payments other than MPL. The caveat with MPL is that it's being deprecated as soon as the Adaptive flow is ported over into the RESTful APIs and subsequently into the mSDK.
Upvotes: 0