Perch Shop Checkout Issue

  • I am nearing the end of a Perch Shop build. I am primarily a front end dev, and have tried to learn as I go, but have now hit a wall.


    I am trying to set up Stripe as the payment gateway.


    When loading checkout.php, I get nothing. The header layout is still pulled in, but once perch_shop_checkout is called the html ends abruptly.


    I have followed the example and added the following to the head.

    <script src="https://js.stripe.com/v3/"></script>


    Is this the correct stripe.js?


    I have also set up the config file as shown and added my API keys.


    The first item in the body is:

    <?php perch_shop_checkout(); ?>


    But I have also tried:

    <?php perch_shop_checkout('stripe'); ?>


    I then call:

    <?php perch_shop_payment_form('stripe'); ?>


    Have tried a few combinations and cannot get it working. Am I doing something silly?


    Thanks

  • drewm

    Approved the thread.
  • Hi Andrew


    I think you probably need to check if the form has been submitted before calling the perch_shop_checkout function.


    I have the following in a checkout page using Stripe - I've only done this once so cannot claim to be an expert (no change there).


    I don't have any additional javascript - I think that's already done with the stripe function in Perch Shop but I'm not 100% sure.


    This bit of code in the head of the page template (before anything else) checks is the member is logged in and gets a token from the form once the user is returned from Stripe. It also controls where the user gets redirected depending on the status of the transaction.

    Then in the body you place


    Code
    1. perch_shop_payment_form('stripe');