"""Searching webhook events. As of Nov 2014, only searching
events within last six months and for a 45 day window is
supported
"""
from paypalrestsdk import WebhookEvent
import logging
logging.basicConfig(level=logging.INFO)

parameters = {
    "page_size": 15,
    "start_time": "2014-11-06T11:00:00Z",
    "end_time": "2014-12-06T11:00:00Z"
}

events = WebhookEvent.all(parameters)
print(events)
            {
                "href": "https://api.sandbox.paypal.com/v1/payments/authorization/3WG12057BW522780J/reauthorize",
                "rel": "reauthorize",
                "method": "POST"
            },
            {
                "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-3KA96482AM105222NKRLNJVY",
                "rel": "parent_payment",
                "method": "GET"
            }
        ]
    },
    "links": [
        {
            "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-8JH82006PH834764Y-9XE6617312678932V",
            "rel": "self",
            "method": "GET"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-8JH82006PH834764Y-9XE6617312678932V/resend",
            "rel": "resend",
            "method": "POST"
        }
    ]
}

webhook_event = WebhookEvent(webhook_event_json)
# event_resource is wrapped the corresponding paypalrestsdk class
# this is dynamically resolved by the sdk
event_resource = webhook_event.get_resource()
"""Searching webhook events. As of Nov 2014, only searching
events within last six months and for a 45 day window is
supported
"""
from paypalrestsdk import WebhookEvent
import logging
logging.basicConfig(level=logging.INFO)

parameters = {"page_size": 15,
              "start_time": "2014-11-06T11:00:00Z",
              "end_time": "2014-12-06T11:00:00Z"
              }

events = WebhookEvent.all(parameters)
print(events)
from paypalrestsdk import WebhookEvent
import logging
logging.basicConfig(level=logging.INFO)

webhook_event = WebhookEvent.find("8PT597110X687430LKGECATA")

if webhook_event.resend():  # return True or False
    print("webhook event[%s] resend successfully" % (webhook_event.id))
else:
    print(webhook_event.error)
Exemple #5
0
from paypalrestsdk import WebhookEvent
import logging

logging.basicConfig(level=logging.INFO)

webhook_event = WebhookEvent.find("8PT597110X687430LKGECATA")

if webhook_event.resend():  # return True or False
    print(("webhook event[%s] resend successfully" % (webhook_event.id)))
else:
    print((webhook_event.error))
            "method": "POST"
        }, {
            "href":
            "https://api.sandbox.paypal.com/v1/payments/authorization/3WG12057BW522780J/reauthorize",
            "rel": "reauthorize",
            "method": "POST"
        }, {
            "href":
            "https://api.sandbox.paypal.com/v1/payments/payment/PAY-3KA96482AM105222NKRLNJVY",
            "rel": "parent_payment",
            "method": "GET"
        }]
    },
    "links": [{
        "href":
        "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-8JH82006PH834764Y-9XE6617312678932V",
        "rel": "self",
        "method": "GET"
    }, {
        "href":
        "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-8JH82006PH834764Y-9XE6617312678932V/resend",
        "rel": "resend",
        "method": "POST"
    }]
}

webhook_event = WebhookEvent(webhook_event_json)
# event_resource is wrapped the corresponding paypalrestsdk class
# this is dynamically resolved by the sdk
event_resource = webhook_event.get_resource()