Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Multiform module and Stripe payment


Go to End


778 Views

Avatar
DimSum

Community Member, 1 Post

1 September 2015 at 4:56am

Hi. I'm trying to build a form using multiform module and Stripe payment as the final step. The problem is, I still wish the user can go back to the previous step when they are in the final Stripe payment step. But if I enable can_go_back in the final step, when hitting submit, the form will go directly to the previous step without sending payment to Stripe. When I disable can_go_back (set value to false), the submission and payment work fine.

My guess is the way Stripe works (submit the form => create token => add hidden input with token value => submit again), the two submissions is confusing Multiform module. However, even if I disable can_go_back (so there is only one submit button), and manually add a link to the previous step, it still goes to the previous step without sending payment when hitting submit.

Here is what I used to get the previous step link:

public function PrevLink(){
    $prevStepClass = $this->getCurrentStep()->getPreviousStep();
    $prevStep = DataObject::get_one($prevStepClass, "\"SessionID\" = {$this->session->ID}");
    $this->setCurrentStep($prevStep);
    return $prevlink = $prevStep->Link();
}

Anyone has any ideas? Thanks!