• Resolved ayakish

    (@ayakish)


    Hello.

    Is there any way I can access/grab the $clientToken variable from somewhere? Say functions.php or a custom plugin we have.
    $clientToken = $gateway->clientToken()->generate());

    I need that to load it on the DOM for generating a js object for Paypal: https://developer.paypal.com/braintree/docs/guides/paypal/client-side

    Or do you have a simpler way to generate the button for client side and embed it on a template ?

    Thank You for your help.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Payment Plugins

    (@mrclayton)

    Hi @ayakish

    Are you attempting to render the PayPal button in a section not already provided by the plug-in?

    If so, once you confirm I’ll show you what to do. It’s very simple and doesn’t require you to write but a single line of custom code.

    Thread Starter ayakish

    (@ayakish)

    @mrclayton i do see in the plugin where the option “mini-cart” is available, but we wrote our own custom drawer and custom plugin for it, and when adding “mini cart” in the sections field, it doesn’t get added. We’d like to add it in this section, which I do not believe is something that’s already provided.

    Plugin Author Payment Plugins

    (@mrclayton)

    but we wrote our own custom drawer and custom plugin for it, and when adding “mini cart” in the sections field, it doesn’t get added

    Did you verify that the JS scripts aren’t loading? It’s possible they’re loading but your mini-cart is missing some of the html elements this plugin looks for when initializing the payment buttons in the cart.

    Kind Regards,

    Thread Starter ayakish

    (@ayakish)

    @mrclayton yes, this isn’t what we want. we’re just trying to get the validated button into some other section. can you please provide the one line you’re talking about? we’re not using any default “mini-cart” classes or anything like that. we just need the validated button embedded into a custom section.

    Thread Starter ayakish

    (@ayakish)

    @mrclayton hello. “If so, once you confirm I’ll show you what to do. It’s very simple and doesn’t require you to write but a single line of custom code.”

    can you please provide us with this example so we can wrap this up?

    Plugin Author Payment Plugins

    (@mrclayton)

    can you please provide us with this example so we can wrap this up?

    Please be mindful that the weekend just passed and this is free support. If you want a guaranteed faster response, that is what our Premium Support is for which you can purchase on our website.

    Something like the following should work:

    
    wc_braintree_get_template(
    			'cart/cart-fields.php',
    			array(
    				'gateways'   => [WC()->payment_gateways()->payment_gateways()['braintree_paypal']],
    				'priority'   => 10,
    				'cart_total' => WC()->cart->total,
    			)
    		);
    

    You will then need to apply the appropriate styles to hide things like the .wc-braintree-cart-text element since that’s just for the cart page.

    Thread Starter ayakish

    (@ayakish)

    @mrclayton understood and thank you very much. can you please provide the link to purchase the premium support. i cannot find it anywhere. we’re going to try to implement what you’ve suggested as well, and i will reply here. thanks again!

    Plugin Author Payment Plugins

    (@mrclayton)

    @ayakish It is on our main site. https://paymentplugins.com/

    Thread Starter ayakish

    (@ayakish)

    @mrclayton thank you. i just purchased the premium support (order 719). thanks for all of your help!

    Plugin Author Payment Plugins

    (@mrclayton)

    @ayakish Now when you reach out to our support email or use the support widget in the plugin settings, we will see that you’re a premium support subscriber.

    Thanks,

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘PayPal access/grab the $clientToken variable’ is closed to new replies.