cloudcomponents.cdk-stripe-webhook


Namecloudcomponents.cdk-stripe-webhook JSON
Version 2.4.0 PyPI version JSON
download
home_pagehttps://github.com/cloudcomponents/cdk-constructs
SummaryCreate, update and delete stripe webhooks with your app deployment
upload_time2024-05-16 19:33:37
maintainerNone
docs_urlNone
authorhupe1980
requires_python~=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![cloudcomponents Logo](https://raw.githubusercontent.com/cloudcomponents/cdk-constructs/master/logo.png)](https://github.com/cloudcomponents/cdk-constructs)

# @cloudcomponents/cdk-stripe-webhook

[![Build Status](https://github.com/cloudcomponents/cdk-constructs/workflows/Build/badge.svg)](https://github.com/cloudcomponents/cdk-constructs/actions?query=workflow=Build)
[![cdkdx](https://img.shields.io/badge/buildtool-cdkdx-blue.svg)](https://github.com/hupe1980/cdkdx)
[![typescript](https://img.shields.io/badge/jsii-typescript-blueviolet.svg)](https://www.npmjs.com/package/@cloudcomponents/cdk-stripe-webhook)
[![python](https://img.shields.io/badge/jsii-python-blueviolet.svg)](https://pypi.org/project/cloudcomponents.cdk-stripe-webhook/)

> Create, update and delete stripe webhooks with your app deployment

## Install

TypeScript/JavaScript:

```bash
npm i @cloudcomponents/cdk-stripe-webhook
```

Python:

```bash
pip install cloudcomponents.cdk-stripe-webhook
```

## How to use

### EventBus Producer

```python
import { SecretKey, SecretKeyStore } from '@cloudcomponents/cdk-secret-key';
import { StripeWebhook, StripeEventBusProducer } from '@cloudcomponents/cdk-stripe-webhook';
import { Stack, StackProps, aws_ssm } from 'aws-cdk-lib';
import { Construct } from 'constructs';

export class StripeWebhookEventBusStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    if (typeof process.env.SECRET_KEY === 'undefined') {
      throw new Error('environment variable SECRET_KEY undefined');
    }
    const secretKey = SecretKey.fromPlainText(process.env.SECRET_KEY);

    const endpointSecretParameter = aws_ssm.StringParameter.fromSecureStringParameterAttributes(this, 'Param', {
      parameterName: 'stripe',
      version: 1,
    });

    const producer = new StripeEventBusProducer(this, 'Producer', {
      secretKey,
      endpointSecret: SecretKey.fromSSMParameter(endpointSecretParameter),
    });

    const events = ['charge.failed', 'charge.succeeded'];

    const endpointSecretStore = SecretKeyStore.fromSSMParameter(endpointSecretParameter);

    new StripeWebhook(this, 'StripeWebhook', {
      secretKey,
      url: producer.url,
      events,
      logLevel: 'debug',
      endpointSecretStore,
    });
  }
}
```

### Custom Handler

```python
import { SecretKey } from '@cloudcomponents/cdk-secret-key';
import { StripeWebhook } from '@cloudcomponents/cdk-stripe-webhook';
import { Stack, StackProps, aws_apigateway } from 'aws-cdk-lib';
import { Construct } from 'constructs';
export class StripeWebhookStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    const api = new aws_apigateway.RestApi(this, 'Endpoint');
    api.root.addMethod('POST');

    if (typeof process.env.SECRET_KEY === 'undefined') {
      throw new Error('environment variable SECRET_KEY undefined');
    }
    const secretKey = SecretKey.fromPlainText(process.env.SECRET_KEY);

    const events = ['charge.failed', 'charge.succeeded'];

    new StripeWebhook(this, 'StripeWebhook', {
      secretKey,
      url: api.url,
      events,
      logLevel: 'debug',
    });
  }
}
```

## API Reference

See [API.md](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-stripe-webhook/API.md).

## Example

See more complete [examples](https://github.com/cloudcomponents/cdk-constructs/tree/master/examples).

## License

[MIT](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-stripe-webhook/LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cloudcomponents/cdk-constructs",
    "name": "cloudcomponents.cdk-stripe-webhook",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "hupe1980",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/47/42/3ac2aa75dfba42dcb254c709733459c55e0ba0d23854dfc209b919c23b19/cloudcomponents.cdk-stripe-webhook-2.4.0.tar.gz",
    "platform": null,
    "description": "[![cloudcomponents Logo](https://raw.githubusercontent.com/cloudcomponents/cdk-constructs/master/logo.png)](https://github.com/cloudcomponents/cdk-constructs)\n\n# @cloudcomponents/cdk-stripe-webhook\n\n[![Build Status](https://github.com/cloudcomponents/cdk-constructs/workflows/Build/badge.svg)](https://github.com/cloudcomponents/cdk-constructs/actions?query=workflow=Build)\n[![cdkdx](https://img.shields.io/badge/buildtool-cdkdx-blue.svg)](https://github.com/hupe1980/cdkdx)\n[![typescript](https://img.shields.io/badge/jsii-typescript-blueviolet.svg)](https://www.npmjs.com/package/@cloudcomponents/cdk-stripe-webhook)\n[![python](https://img.shields.io/badge/jsii-python-blueviolet.svg)](https://pypi.org/project/cloudcomponents.cdk-stripe-webhook/)\n\n> Create, update and delete stripe webhooks with your app deployment\n\n## Install\n\nTypeScript/JavaScript:\n\n```bash\nnpm i @cloudcomponents/cdk-stripe-webhook\n```\n\nPython:\n\n```bash\npip install cloudcomponents.cdk-stripe-webhook\n```\n\n## How to use\n\n### EventBus Producer\n\n```python\nimport { SecretKey, SecretKeyStore } from '@cloudcomponents/cdk-secret-key';\nimport { StripeWebhook, StripeEventBusProducer } from '@cloudcomponents/cdk-stripe-webhook';\nimport { Stack, StackProps, aws_ssm } from 'aws-cdk-lib';\nimport { Construct } from 'constructs';\n\nexport class StripeWebhookEventBusStack extends Stack {\n  constructor(scope: Construct, id: string, props?: StackProps) {\n    super(scope, id, props);\n\n    if (typeof process.env.SECRET_KEY === 'undefined') {\n      throw new Error('environment variable SECRET_KEY undefined');\n    }\n    const secretKey = SecretKey.fromPlainText(process.env.SECRET_KEY);\n\n    const endpointSecretParameter = aws_ssm.StringParameter.fromSecureStringParameterAttributes(this, 'Param', {\n      parameterName: 'stripe',\n      version: 1,\n    });\n\n    const producer = new StripeEventBusProducer(this, 'Producer', {\n      secretKey,\n      endpointSecret: SecretKey.fromSSMParameter(endpointSecretParameter),\n    });\n\n    const events = ['charge.failed', 'charge.succeeded'];\n\n    const endpointSecretStore = SecretKeyStore.fromSSMParameter(endpointSecretParameter);\n\n    new StripeWebhook(this, 'StripeWebhook', {\n      secretKey,\n      url: producer.url,\n      events,\n      logLevel: 'debug',\n      endpointSecretStore,\n    });\n  }\n}\n```\n\n### Custom Handler\n\n```python\nimport { SecretKey } from '@cloudcomponents/cdk-secret-key';\nimport { StripeWebhook } from '@cloudcomponents/cdk-stripe-webhook';\nimport { Stack, StackProps, aws_apigateway } from 'aws-cdk-lib';\nimport { Construct } from 'constructs';\nexport class StripeWebhookStack extends Stack {\n  constructor(scope: Construct, id: string, props?: StackProps) {\n    super(scope, id, props);\n\n    const api = new aws_apigateway.RestApi(this, 'Endpoint');\n    api.root.addMethod('POST');\n\n    if (typeof process.env.SECRET_KEY === 'undefined') {\n      throw new Error('environment variable SECRET_KEY undefined');\n    }\n    const secretKey = SecretKey.fromPlainText(process.env.SECRET_KEY);\n\n    const events = ['charge.failed', 'charge.succeeded'];\n\n    new StripeWebhook(this, 'StripeWebhook', {\n      secretKey,\n      url: api.url,\n      events,\n      logLevel: 'debug',\n    });\n  }\n}\n```\n\n## API Reference\n\nSee [API.md](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-stripe-webhook/API.md).\n\n## Example\n\nSee more complete [examples](https://github.com/cloudcomponents/cdk-constructs/tree/master/examples).\n\n## License\n\n[MIT](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-stripe-webhook/LICENSE)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Create, update and delete stripe webhooks with your app deployment",
    "version": "2.4.0",
    "project_urls": {
        "Homepage": "https://github.com/cloudcomponents/cdk-constructs",
        "Source": "https://github.com/cloudcomponents/cdk-constructs.git"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3da2f9eb46a12ca13405ff714f2a55511b0332de9f7ff88e8c80fa337589641a",
                "md5": "c9e03a98721d3988b69ffaa4b05a7cde",
                "sha256": "9f7b3da8e62c80c662fd684e29e311f6f333815346759128c1ca593133853efb"
            },
            "downloads": -1,
            "filename": "cloudcomponents.cdk_stripe_webhook-2.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c9e03a98721d3988b69ffaa4b05a7cde",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 702333,
            "upload_time": "2024-05-16T19:33:31",
            "upload_time_iso_8601": "2024-05-16T19:33:31.566761Z",
            "url": "https://files.pythonhosted.org/packages/3d/a2/f9eb46a12ca13405ff714f2a55511b0332de9f7ff88e8c80fa337589641a/cloudcomponents.cdk_stripe_webhook-2.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "47423ac2aa75dfba42dcb254c709733459c55e0ba0d23854dfc209b919c23b19",
                "md5": "0d6f78711b64a0f9296f53f124aff630",
                "sha256": "04f84d805eda0083d764ae899862050bd95206b44f77e97da5e65e35382649c4"
            },
            "downloads": -1,
            "filename": "cloudcomponents.cdk-stripe-webhook-2.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0d6f78711b64a0f9296f53f124aff630",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 703565,
            "upload_time": "2024-05-16T19:33:37",
            "upload_time_iso_8601": "2024-05-16T19:33:37.319512Z",
            "url": "https://files.pythonhosted.org/packages/47/42/3ac2aa75dfba42dcb254c709733459c55e0ba0d23854dfc209b919c23b19/cloudcomponents.cdk-stripe-webhook-2.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-16 19:33:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cloudcomponents",
    "github_project": "cdk-constructs",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "cloudcomponents.cdk-stripe-webhook"
}
        
Elapsed time: 9.73284s