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.41.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0053718cb4bfeea8236c1a0a88c3c8ea65a80076f8bf519a9b715e3cf7b3dbd |
|
MD5 | 7514c1417785ca4f6faa691ad8571b95 |
|
BLAKE2b-256 | 2535be3f3dce706b132af68f2db7d61ae3cb242e9d204a31ffd6086351a8b922 |
Close
Hashes for cloudcomponents.cdk_stripe_webhook-1.41.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4af9d5679707f5ed7c251b994735eec8681d7a731966ecfc3cabe0f2d6bef8e |
|
MD5 | 178115ced082ae30625bff97b4dc4c90 |
|
BLAKE2b-256 | 1a5c2dca77508e162e0f2623f2f0752c8dabf64ebbea458f5cf4a02ccfc0aa85 |