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.37.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09139cffeab81a4ce406704218e4036a611047cc4d56980cb77adaa4794e96b3 |
|
MD5 | ee9332bf8cc63ae0b9f0c94173a3de7b |
|
BLAKE2b-256 | 31160a1a6b5688684d7b388a10746b1abadc025c4e7329750bc11af026618945 |
Close
Hashes for cloudcomponents.cdk_stripe_webhook-1.37.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 654269306e8b25b8ed51f69f7f3ec94a7e678274292c99a465016ff31006ca20 |
|
MD5 | 1f26ccb95d4ae345160f1d6255b678fe |
|
BLAKE2b-256 | d5405d3e336d6fc31fc33fbd3cea8cee31515bbededb3caa00e7ae44ed951f98 |