0

I'm developing a payment gateway extension and it "works" in the sense of I can show it in the backend and frontend and have my "Place Order" button.

But that's where I despair..

I want to:

  1. Via API Call, create an order at the external payment gateway backend (I can do that with curl in the Gateway Client
  2. When I receive the order URL from the external payment gateway, I want to redirect to this URL so that the customer can pay there. Alternatively, display the URL in an iframe so that the customer can pay.

How can I do step 2? I can't find that out.. Both options would be ok for me..

Thanks a lot in advance!

2 Answers 2

0

There would be 2 options.

  1. Iframe - The payment form would be displayed in the Checkout screen itself. You need to follow the instructions regarding the parameters to be passed in the Payment Gateway. (cancel_url, return_url, etc.). As per the URL param given, create controllers and get the orders created programmatically.

  2. Redirection - Same as iframe form, pass the params with the custom route link, and upon the payment response, create the orders using Rest API.

"When I receive the order URL from the external payment gateway, I want to redirect to this URL so that the customer can pay there. Alternatively, display the URL in an iframe so that the customer can pay." -- Usually, the payment gateway has the documentation - link, and params to pass. Please let me know the Payment Gateway you are trying to integrate.

2
  • Basically I would love to create something similar to PayPal. Where I will click on Button Place Order and then create it on the backend. Then it opens the popup where I can pay and if the payment is successful, it will redirect to the success page. The Payment Gateway I'm trying to integrate is GNU Taler. A new payment gateway currently in development.
    – kAYd9iN
    Commented May 20 at 18:34
  • @kAYd9iN, good to hear that you have done it. Just a suggestion from my end. 1. Create an order with pending status on clicking a button (pass controller route URL as a return URL) 2. We will get payment status-related data in the controller. 3. If it succeeds, update the order with the status and create an invoice based on the method selected - authorize, authorize & capture. 4. If it fails, cancel the order. Commented May 24 at 12:25
0

I solved the problem myself now.

Basically the solution I was looking for is like this:

  1. In frontend/web/template/payment/form.html, I do set my JS action.

     <div class="actions-toolbar">
             <div class="primary">
                 <button data-role="review-save"
                         class="action primary checkout"
                         type="submit"
                         data-bind="
                             click: talerAction,
                             attr: {title: $t('Place Order')},
                             enable: (getCode() == isChecked()),
                             css: {disabled: !isPlaceOrderActionAllowed()}                                "
                         disabled>
                     <span data-bind="i18n: 'Place Order'"></span>
                 </button>
             </div>
         </div>
    
  2. In the JS, I do open my payment popup

  3. At the end of the JS, i simply put this.placeOrder() and it goes on with the normal payment flow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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