Subscribe: RSS
  • Quote from: nuan88 at Jan 10, 2019, 03:22 AM
    what output do you want? most of it is already defined, but the success output is most important of course

    Thanks - sorry for being vague.

    So I have three products to sell all on one page.
    Two of those will have size options (but they don't affect the price).
    So potentially, someone could buy 2 x product A, 1 x product B, and 1 x product C.
    I can obviously create a simple form using formit for the products/select menus etc etc, but I just don't know how to integrate this so that it adds up the total, and passes that to stripe.
    The customer will then get a confirmation email, and I will get a product request email so I can organise the shipping etc.
    It's for a local charity, so I can't really afford to invest in other software, or pay for a developer to put it all together.

    Thanks for any help you can give!

    Andy
    • Ok here's how it should work:

      Create your form.

      Save the php code as a snippet, I believe the name should be stripeResponseHandler, as included in the js (I think , a little unsure about this part)

      The js will be needed on that page, I believe its ok to put it down at the bottom of the template for that page, usually people put the js in the footer, it gets rendered when the page loads.

      The js apparently will run the snippet, so my earlier idea of putting the snippet as a posthook may not be correct.

      Its also possible we would want the js to run as a pre-hook, but I've never really seen js used that way, bottom of the page should work (it will load and then be ready for the order event)

      Also get that script in there, in your <head>

      I assume that the stripe will take over and probably move the buyer to stripe for confirmation, possibly not, but I sort of expect the output to be there automatically. So let's see if we can get output from it.

      Why not set it up and let's see where we are, if we can narrow this down to a few specific issues others can help.
      • Quote from: nuan88 at Jan 11, 2019, 01:08 AM
        Ok here's how it should work:

        Create your form.

        Save the php code as a snippet, I believe the name should be stripeResponseHandler, as included in the js (I think , a little unsure about this part)

        The js will be needed on that page, I believe its ok to put it down at the bottom of the template for that page, usually people put the js in the footer, it gets rendered when the page loads.

        The js apparently will run the snippet, so my earlier idea of putting the snippet as a posthook may not be correct.

        Its also possible we would want the js to run as a pre-hook, but I've never really seen js used that way, bottom of the page should work (it will load and then be ready for the order event)

        Also get that script in there, in your

        I assume that the stripe will take over and probably move the buyer to stripe for confirmation, possibly not, but I sort of expect the output to be there automatically. So let's see if we can get output from it.

        Why not set it up and let's see where we are, if we can narrow this down to a few specific issues others can help.

        Hi there - than you so much for you time on this.
        Yes I was confused about whether or not there was a post/pre hook, which is why I didn't understand the process.

        I will put all the elements together as you suggested, and see where we go from there!

        Thanks again!
        Andy
        • Ok great! Yes its a bit 'weird' to have the js fire the snippet, but I think that's what its doing...its a bit hard to read js.

          Try to build in error warnings so we can see what works and what doesn't.

          We can also play with pre and post hooks, the js could/should be a prehook...and we might want to goad the snippet to fire as a post-hook, but these are fairly minor issues as far as structure goes.

          I do think if you can pass the data to stripe it could well be ok.