Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Gordon Saxby 1461 posts 1883 karma points
    May 15, 2019 @ 09:41
    Gordon Saxby
    0

    Error using Stripe Gateway

    I have created a Stripe payment option and added the code (from Github) onto a payment page, but get this error:

    (index):1 Uncaught IntegrationError: Please call Stripe() with your publishable key. You used an empty string.
        at new t (https://js.stripe.com/v3/:1:10589)
        at new e (https://js.stripe.com/v3/:1:114612)
        at ss (https://js.stripe.com/v3/:1:122178)
    

    The source of the error is:

    // Create a Stripe client.
    var stripe = Stripe('');
    

    However, in the code it is:

    // Create a Stripe client.
    var stripe = Stripe('@Request.Form["api_key"]');
    

    So why is the form variable blank? What am I missing?! (I need another coffee!!)

    I have configured both the test and live keys and the gateway is currently set to "test".

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    May 15, 2019 @ 10:05
    Matt Brailsford
    0

    The Request.Form["api_key"] should get populated with either the test_public_key or live_public_key depending on what mode the payment provider is configured in.

    https://github.com/TeaCommerce/Payment-Providers/blob/master/Source/TeaCommerce.PaymentProviders/Inline/BaseStripeProvider.cs#L61

    Do you have the test_public_key filled in for the payment provider?

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    May 15, 2019 @ 10:07
    Matt Brailsford
    0

    Also, you need to have gotten to your payment form page having clicked a button wrapped in the GeneratePaymentForm call

    https://docs.teacommerce.net/3.3.0/api/payment-forms/#generatepaymentform

  • Gordon Saxby 1461 posts 1883 karma points
    May 15, 2019 @ 10:29
    Gordon Saxby
    0

    Oh dear, I'm sure it's supposed to be easier than this!

    The page was not working because I had accessed it directly, and now I remember why ... because when I go from the "Accept and Pay" page via the GeneratePaymentForm button, I get this error:

    The resource cannot be found.
    Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 
    
    Requested URL: /en/store/cart-content/payment/
    

    However, the URL most definitely exists! So it must be something else?

  • Gordon Saxby 1461 posts 1883 karma points
    May 15, 2019 @ 10:52
    Gordon Saxby
    0

    OK, found the problem - me being forgetful (not creating a controller action)!

  • Matt Brailsford 4125 posts 22222 karma points MVP 9x c-trib
    May 15, 2019 @ 14:22
    Matt Brailsford
    0

    If that's an Umbraco page, it shouldn't require a controller action? Unless this is specific to how you setup your install?

Please Sign in or register to post replies

Write your reply to:

Draft