from django.core.exceptions import ImproperlyConfigured
from bluebottle.clients import properties


def get_webhook_secret(key):
    if not key:
        key = 'webhook_secret'
    for account in properties.MERCHANT_ACCOUNTS:
        if account['merchant'] == 'stripe':
            return account[key]

    raise ImproperlyConfigured('No merchant account for stripe')


def get_secret_key():
    for account in properties.MERCHANT_ACCOUNTS:
        if account['merchant'] == 'stripe':
            return account['secret_key']

    raise ImproperlyConfigured('No merchant account for stripe')

from django.core.exceptions import ImproperlyConfigured
from bluebottle.clients import properties


def get_webhook_secret(key='webhook_secret'):
    for account in properties.MERCHANT_ACCOUNTS:
        if account['merchant'] == 'stripe':
            return account[key]

    raise ImproperlyConfigured('No merchant account for stripe')


def get_secret_key():
    for account in properties.MERCHANT_ACCOUNTS:
        if account['merchant'] == 'stripe':
            return account['secret_key']

    raise ImproperlyConfigured('No merchant account for stripe')

Fix stripe payment webhook