recurly / recurly-js

Simple subscription billing in the browser
https://js.recurly.com/
MIT License
645 stars 138 forks source link

Token not updated when using recurly.paypal #219

Closed carlosescri closed 8 years ago

carlosescri commented 9 years ago

I have both PayPal and Wirecard gateways and they share almost the same javascript code to retrieve the token.

I have a hidden input field like this:

<input data-recurly="token" id="id_token" name="token" type="hidden">

When I use recurly.token() (regular workflow for wirecard gateway) the field gets updated automatically with the token (I suppose it's thanks to the data-recurly attribute) but when the payment method is PayPal and I call recurly.paypal(), after returning to the main window the field is not updated.

I've fixed this by forcing the update myself in my callback but I think it's an unexpected behavior. Both methods should behave the same (both update the field or both don't).

chrissrogers commented 8 years ago

Ah yes, this is true. This is expected from our API standpoint since recurly.paypal does not know about your form at all, whereas you may pass your form reference to recurly.token -- this is the mechanism by which recurly.token will know to look for a token field to update.