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.38.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e9559dfff80ea3fad64e38dc90ec8f58460aa9079bbc5cbf8660df226b5a45b |
|
MD5 | ad036cade32db033076ab9d796721342 |
|
BLAKE2b-256 | 43949939d2f8b87f292811a3a440c232dca6b6e9fdc69e63845ccb99b6c17838 |
Close
Hashes for cloudcomponents.cdk_stripe_webhook-1.38.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7ffa420e88f9eb2be9e1649e60306e8f243d48d4388226787d3a50b7886df40 |
|
MD5 | 0fe0a95a517d69fb65932426958b1ce7 |
|
BLAKE2b-256 | e2766f5f3c2ef80de0302b4c071f5c94aa5a2a4f19d406093ce5e6e0546e373a |