简体   繁体   中英

Paypal Transaction (Push notification on iOS device)

I want to send push notification on the iOS device(logged in state) whenever any transaction occurs related to that PayPal account.

Transaction occurring related to that account anywhere (whether on PayPal website or on mobile device) Push notification in both case.

How can this functionality be achieved using PayPal iOS sdk? or any other way....

When there is transaction with PayPal then after successful transaction, it will return with a reference id you can check it on device. You get it OR not if yes then you can invoke the push Notification service.

But you can't do it just after money transaction because control will be on PayPal page so you can't detect any event occurring on that page

There are few PayPal delegates which are called on behalf of Transaction state as

#pragma mark - PayPalPaymentDelegate methods

- (void)payPalPaymentDidComplete:(PayPalPayment *)completedPayment {
    // Payment was processed successfully; send to server for verification and fulfillment.
    [self verifyCompletedPayment:completedPayment];

    // Dismiss the PayPalPaymentViewController.

}

- (void)payPalPaymentDidCancel {
    // The payment was canceled; dismiss the PayPalPaymentViewController.
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)verifyCompletedPayment:(PayPalPayment *)completedPayment {
    // Send the entire confirmation dictionary
    NSData *confirmation = [NSJSONSerialization dataWithJSONObject:completedPayment.confirmation
                                                           options:0
                                                             error:nil];


}

So in delegate payPalPaymentDidComplete you can send confirmation to your server; your server should verify the proof of payment and give the user their goods or services and notify user with PUSH Notification . If the server is not reachable, save the confirmation and try again later.

Hope it helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM