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.35.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 899998311ca156461773a3d5902666cdf3e10aeadb82054d8ff4e1b2b761e5b7 |
|
MD5 | 9f28a202a23827cde7b124bd1e13c728 |
|
BLAKE2b-256 | 883faf3c82369e3138353a7b685eb97b1ba62b318b10b2ea808feb80fcb3a96a |
Close
Hashes for cloudcomponents.cdk_stripe_webhook-1.35.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea9842e5cad04d1a67cfc2c926afdb65b9b93801be686a4d99ab9fd41969350f |
|
MD5 | b82ea1bca16a1c9c4da7fada904b5f5c |
|
BLAKE2b-256 | ce7350d73f73325cf37d0ade96a39249f500068822e0022e577675d07d41bd1f |