Hot answers tagged

5

You can hook to the init action and then check for the query variable, you can use the PayPal provided query var or you can use your own custom query var. I will give you example of your own custom query var i.e MYIPN_LISTENER The Code: function wpse58656_paypal_ipn_listener() { // check for your custom query var // If you are paranoid you can ...


4

Best way is to handle this with user roles. A user can register but not read. After paying with paypal, the role will be updated (e.g. from reader to subscriber). The update can be done through PayPals IPN. I made this for one of my clients. You will be paid by your customer. I will be paid by you. You got the plugin. Update As you want to write a theme ...


3

In your admin panel, go to Woocommerce > Settings > Payments tab > and drag the payment methods in the order you want.


3

you can edit the return url woocommerce provides to gateways by using the filter woocommerce_get_return_url some gateway plugins use a different method to get return url by invoking $order->get_checkout_order_received_url() ; which applies the filter woocommerce_get_checkout_order_received_url an example would be like : add_filter('...


3

You can't alter a constant once it is defined. That is how PHP works. Don't fight it. The good news is that you should not be using a constant at all. Use options. // get your value // the second parameter is the default $enable_paypal = get_option('enable_paypal',true); // set your value based on, I assume, a form of some kind update_option('...


3

Use the ajax api: http://codex.wordpress.org/AJAX_in_Plugins If you let all your ajax calls go through this you will have access to all WP functions. Also take a look at these: http://www.james-vandyne.com/process-paypal-ipn-requests-through-wordpress/ http://wordpress.org/extend/plugins/paypal-framework/ Don't know if what you want is in there, but ...


2

Easy Digital Downloads is in my opinioin the best plugin if you are selling downloads. You can see a full review of the plugin here.


2

A solution can be found in the function woocommerce_add_to_cart_action. We have to chain two filters. In the first, we check for the product ID, if it's one of a list we add the redirect. add_action( 'woocommerce_add_to_cart_validation', 'check_ids_wpse_119466', 10, 3 ); function check_ids_wpse_119466( $true, $product_id, $quantity ) { # Not our ...


2

Here's an idea for a starting point, by looking how the word counting is done in the /wp-admin/js/post.js file: /** * Testing word price calculations */ add_action( 'after_wp_tiny_mce', function() { ?><script> ( function( $ ) { $( function() { // Init var $content = $( '#content' ), $count = $( '...


2

It's far better to use a plugin such as Easy Digital Downloads as there are many steps you will need to code in e.g. 1) Check if user has paid (by checking if they were referred back successfully by Paypal) and then set the option in the admin area to say yes you have paid 2) Check what you have bought and direct you to download the item 3) Set a limit on ...


2

You can create a custom template in the theme that displays the 'products' custom post types (see the section on Template Files in Custom Post Types). Then code the HTML for the Paypal button in to your specific single-{posttype}.php and have the attributes such as price, etc, coming from custom fields. <form target="paypal" action="https://www.paypal....


2

If I understand your question, the race condition you describe between WordPress knowing the transaction was "complete" and the user returning to your site is the problem. Regarding a potential solution, what about changing the way you're approaching this such that this race condition is accepted as a real possibility rather than something that you can ...


1

Your html is broken. Check your quotes at <div class="paiement-honoraires-right>


1

I would normally make this a comment but I believe it warrants an answer. You should not circumvent the order process of WooCommerce because the order itself represent the state of the order and its transaction regardless of whether the transaction (payment) fails or succeeds. You need to consider: what happens if the payment succeeds but the order fails? ...


1

add_action( 'woocommerce_thankyou', 'change_order_status', 10, 1 ); function change_order_status( $order_id ){ if( ! $order_id ) return; $order = wc_get_order( $order_id ); if( $order->get_status() == 'processing' ) $order->update_status( 'pending' ); }


1

Perhaps look at flipping your work flow (right term?) so that they go to PayPal first, then after the donation has been made, go back to your website and verify their account details. We don't collect donations but we do use PayPal standard buttons for people to register on our website for online training. Our process is 1) make payment on PayPal (credit ...


1

PayPal offer two ways of doing this: Parallel Payments This allows you to essentially conduct 2 transactions (each with their own line item) in one go. The end-user adds their information to your cart, and get's forwarded to the PayPal Gateway. They see 2 distinct line items: Your vendors product info @ 95% of the total Your fee @ 5% of the total This ...


1

To send an email, check out wp_mail(); For example: $to = 'sendto@example.com'; $subject = 'The subject'; $body = 'The email body content'; $headers = array('Content-Type: text/html; charset=UTF-8'); wp_mail( $to, $subject, $body, $headers ); As for when a confirmation is made, it might be best to customize the return url on the form - see setting the ...


1

Add this to your child theme / plugin functions.php. I think this should do the trick. Let me know function your_meta_callback( $post ) { echo Paypal_payment_accept(); } add_meta_box( 'your_meta', __( 'Meta Box Title', 'your-textdomain' ), 'your_meta_callback', 'your-posttype-name', 'side' ); For more information see Wordpress Codex on add_meta_box(). ...


1

Because you mention an infinite I am guessing that you are hooked into a hook like save_post that fires for wp_insert_post() so if you hook your code into that your code will run then fire the same hook over and over. To avoid that remove the action from the top of your callback: remove_action('save_post','yourcallbackfunctionname'); $my_post = array( ...


1

Try adding this to the top of your script: require('/path/to/httpdocs/wp-blog-header.php'); global $wpdb; Then you can run queries using: $sql = "Your SQL Query Here"; $wpdb->get_results($sql)


1

You should be able to generate discount codes within your callback function by using the edd_add_discount() function. You can learn more about this function here on the EDD Codex to see what specific data you need to pass to the function. However, edd_complete_purchase might not be the right action to hook to. If you only want specific codes to be generated ...


1

First of all, is better use get_template_directory_uri() instead of bloginfo(... <input type="hidden" name="notify_url" value="<?php echo get_template_directory_uri(); ?>/ipn.php"> but you are right if you think the problem is not this one. I cannot be sure, but I bet your problem is here: include_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load....


1

Not sure how I ran into this question one year later, but since it is unanswered... Instead of self-submitting the form and then redirecting to Paypal, you can instead have the paypal url as your form's action, but use Ajax to save the form data before the form is submitted to Paypal. You can also use the Ajax response to prepare the form before submission, ...


Only top voted, non community-wiki answers of a minimum length are eligible