0

I'm writing an offsite payment method for Drupal Commerce (I need that to interact with my bank API). The thing is that when I create a form to send to payment server via PAYMENT_redirect_form I have the only button - SUBMIT there. I want to add one more button there - smth like GO A STEP BACK to return to checkout state. So, i've created one more button, but it performs the same action as SUBMIT - goes to payment server... I think i'm missing smth very simple, but how can i make that one more button in payment submition form to perform a step back like those we have in checkout proccess?

Will be very thankful for your advice :)

0

It's likely you can't, because the form's action will be on a PayPal domain. So it'll always be submitted to them, and your site will never know about it.

The simplest solution would be to use a styled link instead of an input.

  • My point is that I want to have a possibility to cancel the payment before it is sibmitted to the payment server. Is it impossible? – john Jun 9 '15 at 9:06
  • No, not impossible; if you implement what I described above that's what will happen (unless I'm missing something) – Clive Jun 9 '15 at 9:17
  • I'm not sure that i understood your idea correctly, so will try to clearify my question a bit more. I'm creating a form with data which have to be sent to the offsite payment server via PAYMENT_redirect_form function. The form looks like a few fields with data plus submit button which sends all this to my bank server. – john Jun 9 '15 at 9:49
  • In my case 'offsite_autoredirect' option is disabled, so i need to click "SUBMIT" button (which i've created together with form) to perform data transfer. I have also created one more button called "CANCEL" in that form and my idea was to make that button perform a returning to chekout state (and i failed with that task). – john Jun 9 '15 at 9:49
  • From your answer I see that the form will be sent to the payment server anyway as well as it is said in its $form['#action']. So the thing is to create a markup element with a link inside instead of button? But if the order is on checkout_payment state, the cart is already empty, so we can't just return to checkout via simple url. And how can i make that link to perfom the step back action i need? Use hook_menu or i'm missing smth again? – john Jun 9 '15 at 9:50

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.