When does Webhook get fired?


#1

Hey there, I’m a little on confused on when exactly does webhook get fired? I tried looking for documentation on this, but none documents this.

Does pledges:create get fired right when someone subscribes or when their card is charged?

When does pledges:update get fired? Does it occur when one of their social connection is updated?

When does pledges:delete get fired? As soon as they unsubscribe or right before Patreon try to charge the cards

Thanks!


#2

A pledge is created independent of payment. There are currently no webhooks that notify when a payment has been successfully processed. Some creators may have charge upfront enabled for their campaign but that’s a beta feature used only be some creators so you cannot depend on that – and even for creators with it enabled, that’s only going to inform you that there’s been a first payment, not subsequent payments.

A pledge is considered updated when the pledge itself is changed by the user, i.e: the patron increases or decreases their amount, or opts for a different reward. A pledge is not considered updated when payment statuses change, you will not received webhooks about payment statuses.

A pledge is not deleted when payment fails. Patreon will try to charge their card again a few times, and prompt the user to update their card if it continues to fail. As far as I know, a pledge is only deleted after this process has yielded no valid card over time.

If you’re trying to determine how the Patreon system works, and how you (as a developer) can determine payment status, I recommend these 2 threads as they contain lots of helpful information from the dev team:

And if you’re looking for a PHP library that implements this information and provides helpful methods for determining payment status, you can check out my Patreon PHP library to save you reinventing the wheel :slight_smile:


#3

So from what I understand, pledges:create is fired as soon as someone subscribed? Similar to how Patreon gives out Discord server perks right as they subscribe?


#4

Correct.

Do you have a specific use case you’re trying to determine an implementation for? We might be able to provide more helpful guidance that way.


#5

I’m currently using pledges:create to send new Patrons right away to my back-end to give them perks, but for some reason my back-end isn’t receiving it or it isn’t firing. The test fire button works though.


#6

The way I usually test this is to use a second account to pledge to the first account which has webhooks. You should then see that the event is received by your backend. You can set up a requestbin URL to inspect events as well.


#7

Tag along question: does pledges:delete get fired when a pledge gets marker as fraudulent? Does pledges:delete get fired when I block a patron?


#8

I really wish Patreon would document this better, I have to resort to community to find this out


#9

Tag along question: does pledges:delete get fired when a pledge gets marker as fraudulent?

When a patron is first marked as fraudulent, the pledges:delete event is not immediately triggered. However, after a certain period of time (currently 9 days), if they are not determined to be non-fraudulent, all their pledges to creators and pledges from patrons get deleted. So yes, the pledges:delete event should be fired after they are confirmed to be fraudulent.

Does pledges:delete get fired when I block a patron?

Yes. This should happen immediately


#10

Thanks Jeffrey! Would love to have the reason for deletion added to that webhook some day. Hint hint. :wink:


#11

A follow up question, I recently enabled upfront payment, does that mean if the charge is successfully, patreon:create would be fired? Also, if I offer Discord integration, how would I detect if they link their Discord account? Since patreon:create gets called before they can link it and patreon:update won’t get called.


#12

I’m curious how the Patreon Discord bot work? How does it know who to give the role to, what triggers the bot?


#13

Hey @RumbleFrog,

Nick here from the Patreon Platform team.

When you connect your Discord server to your Patreon creator page you will be given the option in your membership tiers to provide a Discord benefit and the role you want to give on Discord associated with it.

When a patron connects their Discord account to their profile or updates/modifies their membership for a tier that contains a Discord reward we will send the notification to Discord to update their user role.


#14

I’m more interested in the backend logic of the bot, does it utilize an internal API?


#15

@RumbleFrog

Are you talking on the Discord side? It’s using Discord’s API to modify users based on the information sent from Patreon.


#16

Do I understand correctly that you can get updates on payment events now? The v2 webhook docs says that you get them as part of the new members:update webhook. I sent a test payload using the My Webhooks console and got this in the response JSON:

 "attributes": {
      "full_name": "...",
      "is_follower": false,
      "last_charge_date": "2014-04-01T00:00:00+00:00",
      "last_charge_status": "Paid",
      "lifetime_support_cents": 12345,
      "patron_status": "active_patron",
      "pledge_amount_cents": 550,
      "pledge_cap_amount_cents": null,
      "pledge_relationship_start": "2014-03-14T00:00:00+00:00"
    }

Does that mean I’ll get a members:update event when a payment goes through?