I'm trying to create my own custom online payment gateway plugin to allow clients to make payments through our bank payment gateway API.
So when the client clicks on "proceed to checkout" button, a RESTful exchange happens between our Woocommerce website and the bank payment gateway API to redirect the client to the payment page hosted in the bank platform to make the payment.
I've read most of the tutorials but they were not helpful and I'm getting lost:
https://www.sitepoint.com/building-a-woocommerce-payment-extension/
https://docs.woocommerce.com/document/payment-gateway-api/
My question is How can manage to make Woocommerce work with the payment API ?
In your function process_payment at the end you have that :
return array(
'result' => 'success',
'redirect' => $payment_url
);
$payment_url is the way where your order was redirected, so set it with your API response url, to redirect the client to the payment page hosted in the bank platform to make the payment.
Related
hi I have a question I developed a custom payment gateway that is redirected to the payment portal after proceeding to check out when they return after payment is complete how can I create a URL link order id and order key link this order-received/785/?key=wc_order_5b909f1966e92
I've got this payment gateway running on a site, after checkout it's taking customers to the Worldpay hosted payments and then the payment is done. It is notifying of successful payment but not redirecting the shopper back to the order confirmation page on WooCommerce.
Does anyone know what I need to set as the Shopper Redirect URL in Worldpay for this to happen?
I'm currently working on the wordpress ecwid plugin. In order to develop my own payment method, I downloaded on github their payment gateway template that I'm now trying to install on my wordpress ecwid shop without success. Please, would you know how to proceed? Thank you for your attention.
It's Gunter from Ecwid team. I see you reached out to us via email too. We've addressed the email request. And we will post the answer here too, just in case.
If you want to integrate a custom payment to your Ecwid store, you should follow these steps:
Register a custom app. You can do that at this direct link: https://my.ecwid.com/#develop-apps
Provide us with the payment URL (your own server) to which Ecwid will send the payment requests. You can send us your URL to apps#ecwid.com email and we'll add it to your app.
After that, when your customers choose your own payment at checkout and click on the “Pay” button, Ecwid will send a POST request with the cart data to your server payment URL. And your customer will be also redirected to this URL. So, you can show any external page to them after redirection.
After redirection, your server needs to get cart details from the request, decrypt it and send it to the payment provider in a correct format for processing. After the payment is processed, your server needs to update the order status and redirect the customers back to the Ecwid storefront.
You can find more details about how the custom payment apps work here: https://api-docs.ecwid.com/docs/how-payment-method-works
Our payment gateway and CRM and not supported by WooCommerce by default as a plugin, so I need to add custom code that sends data to our CRM and payment gateway whenever a customer places an order, then reject or accept the order depending on the payment gateway API response.
Where and how in the Woo code should I be intercepting the order submission?
You should try woocommerce_checkout_process action hook where the billing provider's API response, should return an error notice to reject and stop the checkout process…
This hook is located in WC_Checkout process_checkout() method and it's before the order creation. The data is accessible through $_POST or through $posted_data = WC()->checkout->get_posted_data(); WC_Checkout method.
Or woocommerce_checkout_order_processed action hook where the order is already created (meaning that the order data is accessible through 3 arguments: $order_id, $posted_data and $order) but before payment… To stop the process the billing provider's API response should: throw new Exception()…
So anyway the solution is one of the WC_Checkout available hooks…
Is there a way I can pass the sellers credentials to the Paypal API and it can make a transaction without taking him to Paypal URL?
TL. DR.
I am trying to build an eCommerce website for a shop with Paypal as the payment medium. The payment for user has been implemented where he is redirected to the Paypal website and he can purchase an item. But under certain conditions he is allowed to cancel his purchase and his payment must be credited back to him.
I need this transaction to happen without navigating to the Paypal URL.The reason is that, the buyer is the one initiating the transaction. So there is no way he can authorize a transfer from sellers to buyers account. The buyer should be able to press the "Cancel Order" button and the payment should be immediately credited back to his paypal account.
I can store the sellers credentials in the server and send it to the API which should be able to authorize him but I was looking for an API which Paypal provides to make this happen.
My requirement is different from the anser provided in this question as here they still show a popup of paypal webpage.