background processor

Processing Webhooks

Webhooks is a feature that allows you to set callback URL’s (webhooks) for various background processing events.

For example, let’s assume you are post processing all your campaigns and you wanted to be notified of events that transpire when campaign and it’s transactions are being processed so that you could do some other post processing using such events within your own system.

Well you could accomplish that by first navigating to Administration Panel -> Webhooks -> Background Processor.

There (as depicted in screenshot below) you will see several URL’s that can be set for each type of events you want to listen for. Once set the processor will send the URL notifications automatically when there is new data available to process.

Event notification endpoints for Background Processor

  1. Process Ending Campaigns ( Endpoint URL for campaigns in ended state )
  2. Process Pre-Auth Campaigns ( Endpoint URL for campaigns in pre-auth state )
  3. Process Accepted For Capture Campaigns ( Endpoint URL for campaigns in accepted for capture state )
  4. Process Capture Campaigns ( Endpoint URL for campaigns in capture state )
  5. Process Cancelled Campaigns ( Endpoint URL for campaigns in cancelled state )

As campaigns transition through these event states appropriate callback URL’s will be invoked as set in the Administration Panel -> Webhooks -> Background Processor and your code can then execute to do something else.

The Callback URL will get JSON posted data with following main array keys.

“data” => Main Result Data
“error” => Any Processing Errors
“action” => Endpoint Action
“fingerprint” => Fingerprint or signature for the request so it can be verified

If you need to verify that requests are originating from your instance and not somewhere else then you can use fingerprint field. Simply take the fingerprint field which will come in the JSON callback request and send GET request

You can also update fingerprint by sending PUT request to the same endpoint with fingerprint and used parameter set to true or false. This marks fingerprint as used. Note that signed fingerprints auto expire after 3 weeks from when they are created. Once expired they are removed from system.

Endpoint event actions are outlined further as per below.

Action NameAction DescriptionEndpoint
process_ending_directCampaign finalized as direct charge detected#1
process_ending_preauthCampaign updated to pre-auth state, post processing detected#1
process_preauth_campaignState change on campaign#2
process_preauth_transactionPre-auth performed on transaction#2
process_accepted_capture_campaignState change on campaign#3
process_capture_campaignState change on campaign#4
process_capture_transactionCapture performed on transaction#4
process_cancelled_campaignState change on campaign#5

Event notification endpoints for Campaign

  1. Pledge Operations ( Endpoint URL for campaign pledges )
Action NameAction DescriptionEndpoint
pledge_createCreate campaign pledge#1
pledge_updateUpdate campaign pledge#1
pledge_deleteDelete campaign pledge#1

NOTE: All event actions will result in either sucess or failure as indicated by the “error” structure returned. Also consider using HTTPS callback URL’s for increased security as information will be transmitted in encrypted form.

Below is example PHP code which can be used to listen for events on your side. You can however write such code in pretty much any modern language such as Python or Ruby.

Tagged