Skip to content

Add webhook handling #1

@theolujay

Description

@theolujay

Users still have to decode Paystack webhook signature by themselves. The SDK can handle this for them with something like the following:

from os import getenv
from paystack import PaystackClient, APIError

paystack_client = PaystackClient(secret_key=getenv("PAYSTACK_SECRET_KEY"))

def paystack_webhook(request):
    try:
        paystack_client.webhook.verify_signature(request)
        webhook_data = paystack_client.webhook,get_data(request)
        # ...rest of user's code
    except APIError as e:
        return (
            f"Failed to verify Paystack signature header: {e}"
        )

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions