def create_webhook(events, url, mode, client_id, client_secret): webhook = Webhook( { 'url': url, 'event_types': [{ 'name': event } for event in events] }, api=Api({ 'mode': mode, 'client_id': client_id, 'client_secret': client_secret })) if webhook.create(): print("Webhook[%s] created successfully" % (webhook.id)) else: print(webhook.error)
from paypalrestsdk import Webhook import logging logging.basicConfig(level=logging.INFO) webhook = Webhook({ "url": "https://www.yeowza.com/paypal_webhook", "event_types": [{ "name": "PAYMENT.AUTHORIZATION.CREATED" }, { "name": "PAYMENT.AUTHORIZATION.VOIDED" }] }) if webhook.create(): print(("Webhook[%s] created successfully" % (webhook.id))) else: print((webhook.error))
from paypalrestsdk import Webhook import logging logging.basicConfig(level=logging.INFO) webhook = Webhook({ "url": "https://www.yeowza.com/paypal_webhook", "event_types": [ { "name": "PAYMENT.AUTHORIZATION.CREATED" }, { "name": "PAYMENT.AUTHORIZATION.VOIDED" } ] }) if webhook.create(): print("Webhook[%s] created successfully"%(webhook.id)) else: print(webhook.error)