Create, update and delete stripe webhooks with your app deployment
Project description
@cloudcomponents/cdk-stripe-webhook
Create, update and delete stripe webhooks with your app deployment
Install
TypeScript/JavaScript:
npm i @cloudcomponents/cdk-stripe-webhook
Python:
pip install cloudcomponents.cdk-stripe-webhook
How to use
EventBus Producer
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from aws_cdk.aws_ssm import StringParameter
from aws_cdk.core import Construct, Stack, StackProps
from cloudcomponents.cdk_secret_key import SecretKey, SecretKeyStore
from cloudcomponents.cdk_stripe_webhook import StripeWebhook, StripeEventBusProducer
class StripeWebhookStack(Stack):
def __init__(self, scope, id, *, description=None, env=None, stackName=None, tags=None, synthesizer=None, terminationProtection=None, analyticsReporting=None):
super().__init__(scope, id, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting)
secret_key = SecretKey.from_plain_text(process.env.SECRET_KEY)
endpoint_secret_parameter = StringParameter.from_secure_string_parameter_attributes(self, "Param",
parameter_name="stripe",
version=1
)
producer = StripeEventBusProducer(self, "Producer",
secret_key=secret_key,
endpoint_secret=SecretKey.from_sSMParameter(endpoint_secret_parameter)
)
events = ["charge.failed", "charge.succeeded"]
endpoint_secret_store = SecretKeyStore.from_sSMParameter(endpoint_secret_parameter)
StripeWebhook(self, "StripeWebhook",
secret_key=secret_key,
url=producer.url,
events=events,
log_level="debug",
endpoint_secret_store=endpoint_secret_store
)
Custom Handler
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from aws_cdk.aws_apigateway import RestApi
from aws_cdk.core import Construct, Stack, StackProps
from cloudcomponents.cdk_secret_key import SecretKey
from cloudcomponents.cdk_stripe_webhook import StripeWebhook
class StripeWebhookStack(Stack):
def __init__(self, scope, id, *, description=None, env=None, stackName=None, tags=None, synthesizer=None, terminationProtection=None, analyticsReporting=None):
super().__init__(scope, id, description=description, env=env, stackName=stackName, tags=tags, synthesizer=synthesizer, terminationProtection=terminationProtection, analyticsReporting=analyticsReporting)
api = RestApi(self, "Endpoint")
api.root.add_method("POST")
secret_key = SecretKey.from_plain_text(process.env.SECRET_KEY)
events = ["charge.failed", "charge.succeeded"]
StripeWebhook(self, "StripeWebhook",
secret_key=secret_key,
url=api.url,
events=events,
log_level="debug"
)
API Reference
See API.md.
Example
See more complete examples.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for cloudcomponents.cdk-stripe-webhook-1.32.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d744fc92ef41a10540cf454a5132557cb7abf9d892c4dde1cd63371059994b7 |
|
MD5 | aa6c3033dada38cc15f64d1a691aab26 |
|
BLAKE2b-256 | 492ca67f86ad4f50cad346caf45fa58d16e7ca3f0ce15463b06c59e7bbf6ecbd |
Close
Hashes for cloudcomponents.cdk_stripe_webhook-1.32.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebaffd90209006c1dd6a8e1951b6f354004783f16b2dfdc5a9f5644dab09528b |
|
MD5 | dc3e21cd50c1afa2a45f541b2a894a4c |
|
BLAKE2b-256 | 4ecb24db4259998b20b2e6ebd7793e3c99e86c839e03306c4ffbd71946c73afc |