Paypal express template rendering question

Hello,

I've been setting up an alternate payment setup vary similar to the purchase order payment setup that is outlined in this thread (https://forum.foxycart.com/discussion/9492/use-purchase-order-option-to-process-certain-payments-offline) and ran into a snag.

After some testing I've figured out that setting "FC.json.show_paypal_express_payment_option" to true will enable the Paypal payment input that is marked as depreciated in the admin/payments settings and similarly, enabling the Paypal express admin payment setting will populate the FC.json.hosted_payment_gateways array with a payment object that will render a different Paypal payment input when the template renders.

So, using that snippet as provided from the thread *and* enabling the non-depreciated Paypal express option results in two Paypal inputs rendering, one of which doesn't work. That was confusing for a while but I figured out why and how that is all happening and it makes sense now.

My question now is... is there a better way to control the creation of that payment object in the hosted_payment_gateways array or is my best option for enabling and disabling the rendering of the Paypal express input block to just manually remove/re-add the object to the array and re-render?

Or, is it better to use the depreciated Paypal setup and continue setting FC.json.show_paypal_express_payment_option to true/false as needed?

Thanks!
Comments
  • fc_adamfc_adam FoxyCart Team
    @joefranks,

    Good question. We'd recommend making use of the new PayPal approach and not the depreciated one. How you detailed handling it would be one good approach, removing and adding the PayPal payment option as needed from the order_payment_options array in the json on the cart, and the hosted_payment_gateways on the checkout.
  • @fc_adam, Sounds good, I've got it working with that setup so I'll keep using the current Paypal implementation. Thanks for the follow up.
Sign In or Register to comment.