Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
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))
Ejemplo n.º 3
0
    '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: