1

I am using the code from the example templates to integrate a simple stripe pay button on a commerce site:

<form method="POST">
  <input type="hidden" name="action" value="commerce/payments/pay"/>
  <input type="hidden" name="redirect" value="/orders/order?number={number}"/>
  <input type="hidden" name="cancelUrl" value="/checkout/payment"/>
  {{ getCsrfInput() }}
  {% if cart.paymentMethod.class == 'Stripe' %}
  <script
    src="https://checkout.stripe.com/checkout.js"
    class="stripe-button"
    data-label="Pay Now"
    data-key="{{ cart.paymentMethod.settings.publishableKey ?? '' }}"
    data-name="{{ siteName }}"
    data-image="/assets/img/tfa-logo-128.png"
    data-description="Membership" {# This is not used for order description in stripe - see Craft Commerce general settings #}
    data-email="{{ cart.email }}"
    data-currency="{{ cart.paymentCurrency }}"
    data-amount="{{ cart.totalPrice|commerceCurrency(cart.paymentCurrency,convert=true,format=false) * 100 }}"
    data-locale="auto">
  </script>
  {% endif %}
</form>

When the form submits I get back the following error:

Stripe no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at https://stripe.com/blog/upgrading-tls.

Is this something that needs updating in the commerce plugin? I am running my local site using HTTPS using Valet. I found this link which suggests it might be the plugin that needs updating (I am using the latest version of craft commerce).

  • Which browser and browser version are you using? – Erik Weber Oct 30 '17 at 20:23
  • I’m on the latest version of chrome. I don’t think it’s a browser issue, but I could be wrong. – Gareth Oct 30 '17 at 20:27
2

This is an issue with your local install of OpenSSL curl/PHP or some other system level component.

| improve this answer | |
  • This is the answer but I have no idea how to update Valet to work using TLS 1.2 or later. – Gareth Oct 30 '17 at 22:11
1

If you are using macOS then your cURL is most likely linked against SecureTransport rather than OpenSSL.

To verify you can issue the following command: php -i | grep "SSL Version"

If affected, it should return: SSL Version => SecureTransport

To fix the issue you need to recompile cURL and PHP linked with OpenSSL.

For PHP 7.1 do this:

brew uninstall php71-mcrypt
brew uninstall --ignore-dependencies --force php71
brew install --with-openssl curl
brew install --with-homebrew-curl php71
brew install php71-mcrypt

Replace 71 with 70 if you're using PHP 7.0

| improve this answer | |

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.