PHP Class PayPal\Api\WebhookEvent

A webhook event notification.
Inheritance: extends PayPal\Common\PayPalResourceModel
显示文件 Open project: paypal/rest-api-sdk-php Class Usage Examples

Public Methods

Method Description
all ( array $params, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : WebhookEventList Lists webhook event notifications. Use query parameters to filter the response.
get ( string $eventId, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : WebhookEvent Retrieves the Webhooks event resource identified by event_id. Can be used to retrieve the payload for an event.
getCreateTime ( ) : string The date and time when the webhook event notification was created.
getEventType ( ) : string The event that triggered the webhook event notification.
getEventVersion ( ) : string The version of the event.
getId ( ) : string The ID of the webhook event notification.
getResource ( ) : PayPalModel The resource that triggered the webhook event notification.
getResourceType ( ) : string The name of the resource related to the webhook notification event.
getSummary ( ) : string A summary description for the event notification. For example, A payment authorization was created.
resend ( ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : WebhookEvent Resends a webhook event notification, by ID. Any pending notifications are not resent.
setCreateTime ( string $create_time ) The date and time when the webhook event notification was created.
setEventType ( string $event_type ) The event that triggered the webhook event notification.
setEventVersion ( string $event_version ) The version of the event.
setId ( string $id ) The ID of the webhook event notification.
setResource ( PayPalModel $resource ) The resource that triggered the webhook event notification.
setResourceType ( string $resource_type ) The name of the resource related to the webhook notification event.
setSummary ( string $summary ) A summary description for the event notification. For example, A payment authorization was created.
validateAndGetReceivedEvent ( string $body, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : WebhookEvent Validates Received Event from Webhook, and returns the webhook event object. Because security verifications by verifying certificate chain is not enabled in PHP yet, we need to fallback to default behavior of retrieving the ID attribute of the data, and make a separate GET call to PayPal APIs, to retrieve the data.

Method Details

all() public static method

Lists webhook event notifications. Use query parameters to filter the response.
public static all ( array $params, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : WebhookEventList
$params array
$apiContext PayPal\Rest\ApiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall PayPal\Transport\PayPalRestCall is the Rest Call Service that is used to make rest calls
return WebhookEventList

get() public static method

Retrieves the Webhooks event resource identified by event_id. Can be used to retrieve the payload for an event.
public static get ( string $eventId, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : WebhookEvent
$eventId string
$apiContext PayPal\Rest\ApiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall PayPal\Transport\PayPalRestCall is the Rest Call Service that is used to make rest calls
return WebhookEvent

getCreateTime() public method

The date and time when the webhook event notification was created.
public getCreateTime ( ) : string
return string

getEventType() public method

The event that triggered the webhook event notification.
public getEventType ( ) : string
return string

getEventVersion() public method

The version of the event.
public getEventVersion ( ) : string
return string

getId() public method

The ID of the webhook event notification.
public getId ( ) : string
return string

getResource() public method

The resource that triggered the webhook event notification.
public getResource ( ) : PayPalModel
return PayPal\Common\PayPalModel

getResourceType() public method

The name of the resource related to the webhook notification event.
public getResourceType ( ) : string
return string

getSummary() public method

A summary description for the event notification. For example, A payment authorization was created.
public getSummary ( ) : string
return string

resend() public method

Resends a webhook event notification, by ID. Any pending notifications are not resent.
public resend ( ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : WebhookEvent
$apiContext PayPal\Rest\ApiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
$restCall PayPal\Transport\PayPalRestCall is the Rest Call Service that is used to make rest calls
return WebhookEvent

setCreateTime() public method

The date and time when the webhook event notification was created.
public setCreateTime ( string $create_time )
$create_time string

setEventType() public method

The event that triggered the webhook event notification.
public setEventType ( string $event_type )
$event_type string

setEventVersion() public method

The version of the event.
public setEventVersion ( string $event_version )
$event_version string

setId() public method

The ID of the webhook event notification.
public setId ( string $id )
$id string

setResource() public method

The resource that triggered the webhook event notification.
public setResource ( PayPalModel $resource )
$resource PayPal\Common\PayPalModel

setResourceType() public method

The name of the resource related to the webhook notification event.
public setResourceType ( string $resource_type )
$resource_type string

setSummary() public method

A summary description for the event notification. For example, A payment authorization was created.
public setSummary ( string $summary )
$summary string

validateAndGetReceivedEvent() public static method

This is important to do again, as hacker could have faked the data, and the retrieved data cannot be trusted without either doing client side security validation, or making a separate call to PayPal APIs to retrieve the actual data. This limits the hacker to mimick a fake data, as hacker wont be able to predict the Id correctly. NOTE: PLEASE DO NOT USE THE DATA PROVIDED IN WEBHOOK DIRECTLY, AS HACKER COULD PASS IN FAKE DATA. IT IS VERY IMPORTANT THAT YOU RETRIEVE THE ID AND MAKE A SEPARATE CALL TO PAYPAL API.
Deprecation: Please use `VerifyWebhookSignature->post()` instead.
public static validateAndGetReceivedEvent ( string $body, ApiContext $apiContext = null, PayPalRestCall $restCall = null ) : WebhookEvent
$body string
$apiContext PayPal\Rest\ApiContext
$restCall PayPal\Transport\PayPalRestCall is the Rest Call Service that is used to make rest calls
return WebhookEvent