Yaya
Forum Replies Created
-
Thanks @joyously. In deed this fixed my problem. I moved it up earlier together with separate PHP tags but didn’t work. Only if in the same PHP tag as you suggested works.
Forum: Plugins
In reply to: [PayPal Express Checkout] BuyNow button If terms and conditions checkedsorry I pasted the wrong function name:
function validateimeiWidget()
should be
function checkifagree()Forum: Plugins
In reply to: [PayPal Express Checkout] BuyNow button If terms and conditions checkedHave a look at plugins/paypal-express-checkout/views/frontendcode.php
You can add a checkbox there plus a small javascript that check if ticked when submit is enabled.
Code is currently as follows:<form method="post" action="<?php echo $config->getItem('plugin_form_handler_url'); ?>"> <input type="hidden" name="AMT" value="<?php echo $atts['amount']; ?>" /> <input type="hidden" name="CURRENCYCODE" value="<?php echo $atts['currency']; ?>" /> <?php if ( isset($atts['description']) ) { ?> <input type="hidden" name="PAYMENTREQUEST_0_DESC" value="<?php echo $atts['description']; ?>" /> <?php } ?> <?php if ( isset($atts['tax']) ) { ?> <input type="hidden" name="TAXAMT" value="<?php echo $atts['tax']; ?>" /> <?php } ?> <?php if ( isset($atts['shipping']) ) { ?> <input type="hidden" name="SHIPPINGAMT" value="<?php echo $atts['shipping']; ?>" /> <?php } ?> <?php if ( isset($atts['handling']) ) { ?> <input type="hidden" name="HANDLINGAMT" value="<?php echo $atts['handling']; ?>" /> <?php } ?> <?php if ( isset($atts['qty']) ) { ?> <input type="hidden" name="PAYMENTREQUEST_0_QTY" value="<?php echo $atts['qty']; ?>" /> <?php } ?> <?php if ( isset($atts['return_url']) ) { ?> <input type="hidden" name="RETURN_URL" value="<?php echo $atts['return_url']; ?>" /> <?php } ?> <?php if ( isset($atts['cancel_url']) ) { ?> <input type="hidden" name="CANCEL_URL" value="<?php echo $atts['cancel_url']; ?>" /> <?php } ?> <input type="hidden" name="func" value="start" /> <?php if ( isset($atts['button_style']) ) { ?> <?php if ( $atts['button_style'] == 'buy_now' ) { ?> <input type="image" value="" src="<?php echo $config->getItem('buy_now_button_src'); ?>" /> <?php } elseif ( $atts['button_style'] == 'checkout' ) { ?> <input type="image" value="" src="<?php echo $config->getItem('checkout_button_src'); ?>" /> <?php } ?> <?php } else { ?> <input type="submit" value="Pay with PayPal" /> <?php } ?> </form>
Add somewhere :
<input type="checkbox" name="terms" value="agree">Agree terms and conditions<br>
And add onsubmit=”return checkifagree()” also give it a name so the form header looks like this:
<form name="paypal_form" method="post" action="<?php echo $config->getItem('plugin_form_handler_url'); ?> " onsubmit="return checkifagree()">
finally define checkifagree() function and do the checks.
function validateimeiWidget() { var checkbox=document.forms["paypal_form"]["terms"].value; if( checkbox == ''agree") { return true; } return false; }
I am not a programmer; please test and bespoke the code as you wish; this is just to give you an idea. If you managed to get it to work please share your code ??
Forum: Plugins
In reply to: [PayPal Express Checkout] Pending paymentsSorry I posted the wrong section; it should be the following:
$fields = array( 'USER' => urlencode(get_option('paypal_api_username')), 'PWD' => urlencode(get_option('paypal_api_password')), 'SIGNATURE' => urlencode(get_option('paypal_api_signature')), 'VERSION' => urlencode('72.0'), 'PAYMENTREQUEST_0_PAYMENTACTION' => urlencode('Sale'), 'PAYERID' => urlencode($result['PAYERID']), 'TOKEN' => urlencode($result['TOKEN']), 'PAYMENTREQUEST_0_AMT' => urlencode($result['AMT']), 'PAYMENTREQUEST_0_CURRENCYCODE' => urlencode($result['CURRENCYCODE']), 'METHOD' => urlencode('DoExpressCheckoutPayment') );
Forum: Plugins
In reply to: [PayPal Express Checkout] Doesn't seem to work properlyTry with a fresh WordPress installation just to isolate the issue; this plugin works fine out of the box; i’m using it with 3.5.1 with no issues at all.
the api handler is located at wp-content/plugins/paypal-express-checkout/classes/paypalapi.php so that link should be accessible.post a link to your website I might be able to help.
Forum: Plugins
In reply to: [PayPal Express Checkout] Pending paymentsHey mate. I had similar problems when I 1st installed this plugin.
The Pending issue is because of a missing line in the programming.
$fields = array( 'USER' => urlencode(get_option('paypal_api_username')), 'PWD' => urlencode(get_option('paypal_api_password')), 'SIGNATURE' => urlencode(get_option('paypal_api_signature')), 'VERSION' => urlencode('72.0'), 'PAYMENTREQUEST_0_PAYMENTACTION' => urlencode('Sale'), 'PAYMENTREQUEST_0_AMT0' => urlencode($_POST['AMT']), 'PAYMENTREQUEST_0_AMT' => urlencode($_POST['AMT']), 'PAYMENTREQUEST_0_ITEMAMT' => urlencode($_POST['AMT']), 'ITEMAMT' => urlencode($_POST['AMT']), 'PAYMENTREQUEST_0_CURRENCYCODE' => urlencode($_POST['CURRENCYCODE']), 'RETURNURL' => urlencode($config->getItem('plugin_form_handler_url').'?func=confirm'), 'CANCELURL' => urlencode(get_permalink(get_option('paypal_cancel_page'))), 'METHOD' => urlencode('SetExpressCheckout') );
Compare it to yours in paypalapi.php and that should sort out the pending payments issue.
Do you really need the IPN?
this plugin will tell you if payment is a success but wont update any info like when the transaction is cleared.
I already have IPN implementation that update the transaction details into a table in the same database.Forum: Plugins
In reply to: [PayPal Express Checkout] Passing a user input field to express checkoutI installed short code plugin, created a new short code with the code above as contents. Now I have a custom shortcode to access PaypalExpressCheckout.
Now I started adding new fields to append user input to the payment history in the admin area.
So I can start using the short code as follows:
[paypal amount=10 currency=USD button_style=”buy_now” custom_field=”value”]if someone think that this is not a good approach; please do advise. My end goal is pass user input to the order history.
Forum: Plugins
In reply to: [PayPal Express Checkout] Passing a user input field to express checkoutNo much of a support, so I decided to support my self.
I used the description field to pass a variable user input. This can not be done in short code.
<form name="form" action="LINK TO WORDPRESS DIR/wp-content/plugins/paypal-express-checkout/form-handler.php" method="post" onsubmit="return validateForm()"> <input type="hidden" value="2.2" name="AMT"> <input type="hidden" value="USD" name="CURRENCYCODE"> <input type="text" name="PAYMENTREQUEST_0_DESC"> <input type="hidden" value="start" name="func"> <input type="submit" value="Pay with PayPal"> </form>
validateForm() will simply validate user input before submission.