thephpleague / omnipay-paypal

PayPal driver for the Omnipay PHP payment processing library
MIT License
295 stars 174 forks source link

#219 support rest jsv4 implementation #221

Open eileenmcnaughton opened 5 years ago

eileenmcnaughton commented 5 years ago

Adds support for Rest jsv4 where the createCard object can create a reference to a billing agreement that can be rebilled when the card is not present. This is similar to the normal createCard in that a token represents the card but the card details have been validated in the Paypal popup rather than by them being passed through this code.

The process is that createCard is called and getTransactionReference then returns a token which is passed back to the paypal js script. The paypal script pops up a modal where the user authorizes the card and then the authorized token can be used like a normal cardReference from then on. Obviously the paypal js script is out of scope for Omnipay but it needs to be able to call some php function via ajax to work

I've been a bit back & forth on whether the token should be retrieved via getTransactionReference & getCardReference - also in https://github.com/thephpleague/omnipay-paypal/issues/215 - it's the only reference that exists for the transaction prior to it being authorized & it kinda refers to the transaction about to be authorized but it also kinda makes sense as a cardReference. It's a fallback in the getTransactionReference function at the moment & could arguably be a fallback in both.

See https://github.com/thephpleague/omnipay-paypal/pull/220

Includes https://github.com/thephpleague/omnipay-paypal/pull/220