Sorry should of added I want the user to fill in the form and click pay by card and all the information get sent to my email address and take payment
or
I just use a downlaod button and it sends it to a payment gateway but this option is just as tricky as i cant seem to find a solution that will just connect to my own page download button?
ideas/help?
Your first clarification of a separate payment button makes more sense to me. As a use/customer, when I click a download button, I expect a download to start. Getting sent to Stripe without warning would be off-putting. You could have two buttons – payment and download. The download button could be disabled until Stripe confirms successful payment. Confirmation and changing disabled status is handled with JavaScript or jQuery.
You could send user data to Stripe by making Stripe the action attribute of the form, but I’m not sure how Stripe would properly respond to that in a way that is usable by your site. It seems to me that the Stripe submittal should be sent via Ajax. Then the Ajax response script can correctly handle the Stripe response and enable the download button upon successful payment.
How to format the Ajax request depends on the Stripe API’s requirements. Ajax in WP can be a bit quirky, but it’s mainly in how WP accepts Ajax requests. Since you are sending to Stripe, most of that would not matter. The one quirk to be aware of is WP has its own jQuery library, you should not fetch it from another CDN. To enable jQuery on a page, in PHP you enqueue “jquery” from a callback added to “wp_enqueue_scripts”. See the Plugin Handbook for specifics.
Once you’ve correctly enqueued jQuery and your payment handling script, that’s the end of WP quirks. The form and submit process is no different than any other non-WP site.
You could use an e-commerce platform to connect your ‘download’ button to a payment gateway. Plasso.com can either redirect your users to a landing page to handle payments or you can embed a payment modal to keep your users on your site using their WordPress plug-in. Either way, the platform has a clean design which should make your users happy. Also, they can secure digital downloads too if your design company calls for it.
-
This reply was modified 8 years, 3 months ago by
chasedev.