paypal / paypal-ios

One merchant integration point for all of PayPal's services
Apache License 2.0
59 stars 27 forks source link

Vault Without Purchase PayPal #225

Closed KunJeongPark closed 10 months ago

KunJeongPark commented 10 months ago

Summary of changes

https://github.com/paypal/paypal-ios/assets/9273272/496553c9-efd3-44fe-be0d-e699853c80a8

Checklist

Authors

@KunJeongPark

KunJeongPark commented 10 months ago

I've been thinking about the approach to minimize the number of views in the demo app as suggested in previous PR's such as suggestion to use general view that toggles content for each API result and approach that I explored above, which was to use parent viewModel between two payment methods for vaulting without payment so that SetupTokenView and PaymentTokenView and their result views can be reused across different payment methods when applicable.

I considered other payment methods being added as stand alone vault features in this approach to reducing the number of views by having a parent VaultViewModel class with shared state and payment specific properties as published properties in their respective viewModels. In JS, so far we have PayPal and Card vaulting and in Braintree, we have PayPal, Card and Venmo vaulting if I remember correctly.

Assuming that purpose of our demo app is for internal testing, demonstration of features and giving example usage of SDK to merchants, I think simplicity might be the best approach.

We can adapt as we add more payment methods to vault. As far as I know, the flow for vault without pay is the same: create setupToken, do approval in SDK with payment method and merchants use this temporary setupToken to create paymentToken.