4
votes

I'm testing Stripe orders on my local Mac OS X machine. I am implementing this code:

stripe.api_key = settings.STRIPE_SECRET

        order = stripe.Order.create(
          currency = 'usd',
          email = 'j@awesomecom',
          items = [
                    {
                      "type":'sku',
                      "parent":'sku_88F260aQ',
                      "quantity": 1,
                    }
                  ],
          shipping = {
            "name":'Jenny Rosen',
            "address":{
              "line1":'1234 Main Street',
              "city":'Anytown',
              "country":'US',
              "postal_code":'123456'
            }
          },
        )

I receive an error:

Stripe no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later.

I am using django 1.10 and python version 2.7.10

How can I force the use of TLS 1.2? Would I do this on the python or django side?

3
Can you show/tell how are you connecting with Stripe API in your application/project? Django's runserver doesn't support HTTPS but your problem suggests that you are using old TLS mechanism.Muhammad Fahad Manzoor
@MuhammadFahadManzoor I added the code. It has no reference to TLS though.Atma
It means that you are using another application in your project for interacting with Stripe, correct? Are you using the latest version of that application/library?Muhammad Fahad Manzoor

3 Answers

6
votes

I solved installing this libraries:

pip install urllib3
pip install pyopenssl
pip install ndg-httpsclient
pip install pyasn1

solution from:

https://github.com/pinax/pinax-stripe/issues/267

1
votes

This is not a django issue, but operating system and language issue.

I'm using Mac OS X and and a brew version of python. I'm also using virtual env which has its own copy of python and open ssl.

I did the following:

I first downloaded the most recent version of XCode which updates OpenSSL. I then uninstalled and reinstalled brew python. I then updated virtualenv.

0
votes

If you have already tried to update openssl and python (using brew), and still does not work, make sure your settings have DEBUG = False.

Watch this thread for more information https://code.google.com/p/googleappengine/issues/detail?id=13207