How to send form values from the script in functions.php and not from the form on my website?

I have a form on my website and depending on if the user check paypal or wire-transfer the form action should always go to functions.php where I have this simple check at the end of the file: if ( isset( $_POST['submitted'] ) && isset( $_POST['post_nonce_field'] ) && wp_verify_nonce( $_POST['post_nonce_field'], 'post_nonce' ) ) { // CODE AFTER SUBMIT HERE } So, my question is how do I do some stuff using an if condition in my functions.php before posting the form …
Category: Web

Set the payment processor callbacks to a plugin

We need for our Wordpress page a plugin which processes in certain situations the payments independently from the regular check-out page. Normally, a payment processor like PayPal, Stripe and others, use callback URLs to inform the site about the result. So, we have now this situation: The plugin needs to know the result of the payment process but the callback URLs are set to some URL which do not belong to the plugin. With other words, we would have 2 …
Category: Web

What is the proper way to embed the HTML of an external form such as payflowlink from paypal?

I've had a request to paste in the following into a donations page for a group. The trouble is that WP is (rightfully) curtailing this HTML to prevent me or anyone from doing something less than honest. <form action="https://payflowlink.paypal.com" method="POST"> <input name="LOGIN" type="hidden" value="XXXXXXXXXX" /> <input name="PARTNER" type="hidden" value="PayPal" /> <input name="DESCRIPTION" type="hidden" value="Donation" /> <input name="AMOUNT" type="hidden" value="5.00" /> <input name="TYPE" type="hidden" value="S" /> <input type="submit" value="Donate here" /> </form> Question: That said, how could I display this one-button …
Category: Web

Woo create order only after payment done

We have setup a Woocommerce shop with different payment methods (stripe, Klarna, PayPal). When the customer clicks on the final button for the order, the order is being generated in woo. Then an external window opens, where the customer handles all the payment things. If the customer exits this process without paying, we have a hanging orders. Is there a way (or a plugin) to have it the other way round? So an order should only be created when the …
Category: Web

Add Paypal button redirect to a specific page after completing

I have created a new page on my WordPress site to test the paypal payment flow. I have subscription based products. Attached code is for the paypal subscription button code. <div id="paypal-button-container-P-91F08612M1573283BMIUWMOA"></div> <script src="https://www.paypal.com/sdk/js?client-id=AfGWAPJxdGbCj7b51a2mpoZQYI5y63txxxxxxxxIe1UDh2Vxcr05AFJxxxxNSCNDf8y-xopaJ6&vault=true&intent=subscription" data-sdk-integration-source="button-factory"></script> <script> paypal.Buttons({ style: { shape: 'rect', color: 'gold', layout: 'vertical', label: 'subscribe' }, createSubscription: function(data, actions) { return actions.subscription.create({ /* Creates the subscription */ plan_id: 'P-91xxxxxxxxxxxxxxx' }); }, onApprove: function(data, actions) { alert(data.subscriptionID); // You can add optional success message for the subscriber here } …
Category: Web

Payment field disappears on custom Paypal plugin

I have a custom Paypal plugin. I get the Paypal button to appear under the payment method box in checkout but after ?wc-ajax=get_refreshed_fragments is ran, initiated by vendors~rollbar.noconflict.umd.min.js, the button disappears, I have no error in my console. On my payment_fields() function I have a single div that is populated with the paypal button from the paypal SDK script like this: function payment_fields(){ ?> <div id="paypal-button-container"></div><?php } This is how I enqueue my scripts: function enqueueScripts(){ if(is_checkout()){ $currency = get_woocommerce_currency(); …
Category: Web

paypal not showing on woocommerce payments

Had install a fresh wordpress installation on localhost, and after install woocommerce plugin, the paypal default - payment isnt there on woocommerce tab "payments". On the live website paypal continues working just fine. Do I need a plugin now, anyone knows something about it
Category: Web

PayPal Express Ninja Forms extension - how change currency?

I have a form set up through Ninja Forms and the PayPal Express extension. I'm currently testing the form and all works as expected (on submit the user is redirected to the PayPal payment portal, payment is processed successfully and it shows up in my PayPal sandbox account). However, the amount the user has to pay when they reach the PalPal payment portal is in USD, but I would like it to be in GBP. Is there a way to …
Category: Web

Calculate Paypal/Stripe fee by country?

Please tell me how to set the fee, depending on the country that the user chose when placing an order? Payment methods paypal and stripe. For example, for stripe, for the USA it is 2.9% + $ 0.30, and for the UK 1.4% + $ 0.25, maybe there is some kind of plugin for this, or there is another method for calculating it.
Category: Web

Making the 'add to cart' button redirect to PayPal

I want to program the Add to Cart button, on a product page, so when the customer press on it, it skips the Cart & Checkout pages and send him directly to the PayPal payment gateway. Not spending time on the Cart page, nor filling details on the Checkout page. How can I do this?
Category: Web

Unpaid PayPal orders switching to "processing"

Well well... after two weeks of testing, trial and error I finally came to Stackexchange. Following issue/bug: We have major issues with PayPal. We noticed orders without any payment. When you order something in our shop, choose PayPal and cancel the order in PayPal by just clicking "cancel" or leaving the browser tab, WooCommerce switches the order from either "canceled" or "pending" to "processing". Which indicated, that the user has paid. We received my emails from users who said they …
Category: Web

How to create a digital product download link that can't be used twice?

The goal is after people paid (PayPal or Stripe), they land on a download page. You upload the file to /uploads for example. You can deny access to the dir with .htaccess. I suppose if I then create a link /uploads/product, that a client can download it. But that link can now be shared all over the internet. What would be the best way to go about it? I want to code it myself in PHP & JS if required.
Category: Web

"jQuery Not Defined" Error When Connecting to PayPal

I have been looking all over Google for hours now and am very confused. Everyone has a different answer, and most don't explain where to put the code snippet that they post. I am attempting to create a new blog and web store with a self-hosted WordPress site. The site is running on a machine running the latest version of Ubuntu Server and apache2. I am using the plugin "WP Simple PayPal Shopping Cart" to create a way for users …
Category: Web

504 Timeout gateway when trying to pay for an order in Woocommerce. What else can I do?

I receiving a 504 Gateway Timeout error when I try to pay via PayPal or Stripe in Woocommerce. PayPal in Sandbox mode also causes an error with ajax request, although in the PayPal logs it is written that the payment was successful and in the WP admin panel it is clear that the subscription has been extended. Tried to disconnect plugins, it did not help. max_execution_time set to 500, also did not help. I did not try to change the …
Category: Web

How to force Woocommerce to deliver the product to the paypal adress which was used?

i have a woocommerce shop where i sell keys. After the payment my customers get the key instantly. Problem: There are many scammers who used stolen credentials. They send the keys to their own email and pay with an other paypal account. So afterwards i have to refund the owner of the account. Is there a possibility to link the order to the paypal adress? Thank you very much in advance!
Category: Web

Am i doing something wrong by getting plugins from github repos?

I was trying to add paypal payment to my website, I'm using Gravirty form with stripe add-on but not paypal add-on. I happened to find a github repo for the (paypal addon). so I downloaded it then uploaded it to my website and now i have the plugin. The developer who built the site has purchesed a licence for gravity form but i don't have it as i lost connection with him otherwise i can get the addon from the …
Category: Web

Pay before posting (frontend insert post)

I have a form on the frontend which I want users to fill out, when they have I want to save the data and redirect them to pay before submitting the post. How do I save the data before they pay? I have a cookie working that lets me know when they have successfully paid. If they haven't paid then the form action looks like this: $form_action = get_bloginfo('template_url').'/Checkout/paypal_ec_redirect.php'; Can I pass these post variables to the above page somehow? …
Category: Web

How to change or add Woocommerce thank you page URL key content?

I have searched enough and I did not find an answer for this question but this may be a simple one. In analytics, I want to set up goals for purchase and we have only 5 products, so each product purchase should be a separate goal. The easy way to set purchase goal in Analytics is to supply thank you URL. Now, Woocommerce thank you URL includes important details in the thank you URL like below. exampledomain.com/?key=wc_order_584a9caad78bc&amt=239.00&cc=USD&charset=windows-1252&cm={"order_id":13586,"order_key":"wc_order_584a9caad78bc"}&st=Completed&tx=2AF5736382483492L This is how …
Category: Web

Set up PayPal with wrong email by mistake

I set up a PayPal in WooCom and the email that I typed in was in error. Just found this out when someone placed an order and it was placed ON HOLD. So, I have a client that paid for her order, but no way to have it get into my clients PayPal account. I also can't refund it. It is just frozen.
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.