I'm searching for example of implementation for Recurlyjs normal Paypal checkout flow. I suppose to request Billing info from the user besides Paypal token but it's not clear how do I merge them together to use.
Here are docs mentioning normal workflow but no details: https://docs.recurly.com/docs/paypal-payments
Here is example of Paypal express flow: https://github.com/recurly/recurly-js-examples/blob/master/public/paypal/index.html . It looks like I need to add [additional-fields] to the form and merge_token_fields, but I can not find appropriate function.
<section>
<form method="post" action="/api/subscriptions/new">
<button id="subscribe">Subscribe with PayPal</button>
<div name="recurly-[additional-fields]></div> // TODO: fix this
<input type="hidden" id="recurly-token" name="recurly-token">
</form>
<script>
var form = $('form');
recurly.configure('PUBLIC_KEY');
var paypal = recurly.PayPal({
display: { displayName: 'My product' }
});
paypal.on('token', function (token) {
$('#recurly-token').val(token.id);
merge_token_fields(); // TODO: fix this
form[0].submit();
});
form.on('submit', function (event) {
event.preventDefault();
paypal.start();
});
</script>
</section>