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.find("8TJ12214WP9291246") if webhook.delete(): print("Webhook deleted") else: print(webhook.error)
from paypalrestsdk import Webhook, ResourceNotFound import logging logging.basicConfig(level=logging.INFO) try: webhook = Webhook.find("70Y03947RF112050J") print("Got Webhook Details for Webhook[%s]" % (webhook.id)) webhook_replace_attributes = [ { "op": "replace", "path": "/url", "value": "https://www.yeowza.com/paypal_webhook_url" }, { "op": "replace", "path": "/event_types", "value": [ { "name": "PAYMENT.SALE.REFUNDED" } ] } ] if webhook.replace(webhook_replace_attributes): webhook = Webhook.find("70Y03947RF112050J") print("Webhook [%s] url changed to [%s]" % (webhook.id, webhook.url)) else: print(webhook.error)
from paypalrestsdk import Webhook, ResourceNotFound import logging logging.basicConfig(level=logging.INFO) try: webhook = Webhook.find("70Y03947RF112050J") print(("Got Webhook Details for Webhook[%s]" % (webhook.id))) webhook_replace_attributes = [{ "op": "replace", "path": "/url", "value": "https://www.yeowza.com/paypal_webhook_url" }, { "op": "replace", "path": "/event_types", "value": [{ "name": "PAYMENT.SALE.REFUNDED" }] }] if webhook.replace(webhook_replace_attributes): webhook = Webhook.find("70Y03947RF112050J") print(("Webhook [%s] url changed to [%s]" % (webhook.id, webhook.url))) else: print((webhook.error)) except ResourceNotFound as error:
from paypalrestsdk import Webhook import logging logging.basicConfig(level=logging.INFO) history = Webhook.all() print(history) print("List Webhook:") for webhook in history: print(" -> Webhook[%s]" % (webhook.name))
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) try: webhook = Webhook.find("8TJ12214WP9291246") print(("Got Details for Webhook[%s]" % (webhook.id))) except ResourceNotFound as error: print("Webhook Not Found")
'client_secret': 'EI-dMlYlcd7Zykf4vJRpizh-a2EnpfVxdFBl4EbzzHYxa9qP8LkwKwOoReBofFWvpSn6w02sBCLFPhPY' }) webhook = Webhook({ "url": "https://budget-track.herokuapp.com/webhook", "event_types": [{ "name": "PAYMENT.SALE.COMPLETED" }, { "name": "PAYMENT.SALE.DENIED" }, { "name": "PAYMENT.SALE.REFUNDED" }, { "name": "PAYMENT.SALE.REVERSED" }, { "name": "PAYMENT.SALE.PENDING" }, { "name": "PAYMENT.AUTHORIZATION.CREATED" }, { "name": "PAYMENT.AUTHORIZATION.VOIDED" }, { "name": "PAYMENT.ORDER.CANCELLED" }, { "name": "PAYMENT.ORDER.CREATED" }] }) if webhook.create(): print("Webhook[%s] created successfully" % (webhook.id)) else:
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)