Payment_status is None, but not pledge_payment_status

Hello, I’m working on the patreon api for a discord bot and I’m looking to know the user’s payment history, this way if the user paid for an offer but didn’t use it, he will be able to use it even after a month, however I’m having a problem when I look at all the user’s payments (via https://www. patreon.com/api/oauth2/v2/members/{patreon_id}), when I look at payment status, the value is None, but instead I have pledge_payment_status which is valid, however this value does not appear in the documentation. This is what I get:

{

   "data":{

      "attributes":{

         

      },

      "id":"XXXX",

      "relationships":{

         "pledge_history":{

            "data":[

               {

                  "id":"pledge_start:XXX",

                  "type":"pledge-event"

               }

            ]

         }

      },

      "type":"member"

   },

   "included":[

      {

         "attributes":{

            "amount_cents":150,

            "currency_code":"USD",

            "date":"2022-08-27T19:33:20.801+00:00",

            "payment_status":"None",

            "pledge_payment_status":"valid",

            "tier_id":"9042131",

            "tier_title":"Test",

            "type":"pledge_start"

         },

         "id":"pledge_start:XXX",

         "type":"pledge-event"

      }

   ],

   "links":{

      "self":"https://www.patreon.com/api/oauth2/v2/members/XXXX"

   }

}

I am trying to find out which value I should use to know if the payment has been made, My second question is why socials connection is empty when a user stops supporting a patreon, while when the user supports the patreon, it is possible to see the social connection attribute of the user resource. I need this attribute to authenticate the user

Are you getting the pledge events through an include?

If so, the first payment should not have payment_status. It should have pledge_payment_status. Subsequent, automatically charged subscription payments should have payment_status.

Though, you should use currently_entitled_amount_cents and currently_entitled_tiers to decide what a patron has access to, instead of checking pledge events. Those fields will give you the accurate and up to date entitlements. You can get it by requesting it in members’ details as an include like how the WordPress plugin does it:

ok, thanks for your answer, and do you know a way to know when someone has renewed a subscription (every month)?

If you request the member and member’s details by using the includes in the example from the WP plugin’s call, you dont need to do anything specific to know whether a patron has renewed or not. The two fields I described above will give you the patronage status of a patron at any given time. This includes the 2-3 day grace period which patrons get when their payments are retried upon being declined. So its much better to use those fields to decide whether to allow a benefit instead of specifically checking the payment status.

But if your use case requires checking the payment status specifically, the payment_status should give you that info. Note that you should not immediately cut benefits if a patron’s payment_status is declined. You can check the patron’s status (active, former etc) to see whether a patron is finally cut from benefits after declined payment retries did not succeed.

it’s not for payment, but my patreon allows to buy google translate characters by subscription, I would like that every month I reload the number of characters available to all those who continue the subscription, that’s why I need to know if they have renewed or not their subscription, but knowing that patreon makes people pay every 1st of the month, can I reload the characters every 2nd day of the month? This way, only those who have paid for a new month will still be present

Declined payment retries can historically last up to 3 days. So its better to do such things on the 3rd. But as said before, if you have such a specific need, you can keep checking the payment status of the patron (not pledge payment status if the patron is not a new subscriber) then decide whether to cut access.

1 Like

okay, thaks you for your answer, I have always a question, how to know the payments status of a specific tier?

Payment status of a specific tier as in? The payment statuses of the patrons who subscribe to that tier?

yes, I have 3 offers and people can subscire for one offer and not another, so I need to know the payment status of specific offers to know when I need to reset the benefits.

That’s fairly easy. You can just check a patron’s currently_entitled_tiers. If the tier is not in that tier list, then the patron is not entitled to that tier.

1 Like