0

I'm working on a plugin and rather than write my own payment processing code I was wondering if I could leverage woocommerce to do this. My plugin handles what amounts to rental spaces and all the custom management stuff is done with my plugin. It would be nice if there is a way for woocommerce to just to collect and log payments for my plugin. Is this possible? Most of the examples I've found about the API seem to apply to remote API use for woocommerce.

Thanks

1
  • 1
    I'm going to try the same thing. So far my idea is to dynamically generate a woocommerce product with the required price and description, programmatically add that product to the cart and use a completely customized checkout page with my own fields to allow the payment. Nov 11 '20 at 10:48
1

It is possible, but you're going to need a product to log in your orders. You could create a product 'placeholder' and then pass variables to the cart before checkout. This way the actual product already exists but everything else in WooCommerce will perform as normal.

Orders don't store a link to the current price of the item as prices change from time to time and then order history would be useless.

An example: The product could be "Rental Space" with a zero value that the user adds to the cart. Your plugin gives it a price in the cart and WooCommerce (and your chosen payment gateway) do the rest.

Your 'logs' would be the WooCommerce orders created per checkout.

2
  • This is as good an answer as one could expect and I'd have said the same thing. Technically, if you're able to write the code for it, everything is possible, that's the beauty of Open Source software. I gave Innate's answer an upvote because short of writing the entire solution, there's not much else that can be answered here. Nov 12 '20 at 15:54
  • I'm looking more for a hook into the payment processing side without having to make fake products. Since they offer an API to the plug-in I was hopeful there was direct access to just process a payment. I guess not. I didn't realize their plug-in is open source so I'll look through their code.
    – user6972
    Nov 14 '20 at 5:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.