Hi!
We have an application integrated with the Patreon API.We now need to calculate the total amount of sponsorship for a specific period for a patron. Can we calculate this using pledge events, and what are the specific calculation rules? For example, based on the attached sponsorship records, how can we determine that campaign_lifetime_support_cents equals 5000?
Alternatively, is there any other way to calculate the total amount of sponsorship for a patron during a specific period?
Thanks!
{
“data”: {
“attributes”: {
“campaign_lifetime_support_cents”: 5000,
“currently_entitled_amount_cents”: 2000,
“last_charge_status”: “Paid”
},
“relationships”: {
“currently_entitled_tiers”: {
“data”: [
{
“id”: “742695”,
“type”: “tier”
}
]
},
“pledge_history”: {
“data”: [
{
“id”: “pledge_downgrade:197908484”,
“type”: “pledge-event”
},
{
“id”: “pledge_downgrade:197908199”,
“type”: “pledge-event”
},
{
“id”: “pledge_start:197908172”,
“type”: “pledge-event”
},
{
“id”: “pledge_delete:182217312”,
“type”: “pledge-event”
},
{
“id”: “pledge_start:182217312”,
“type”: “pledge-event”
},
{
“id”: “pledge_delete:152830716”,
“type”: “pledge-event”
},
{
“id”: “subscription:1315520202”,
“type”: “pledge-event”
},
{
“id”: “pledge_downgrade:152830716”,
“type”: “pledge-event”
},
{
“id”: “pledge_start:152830674”,
“type”: “pledge-event”
}
]
}
},
“type”: “member”
},
“included”: [
{
“attributes”: {},
“id”: “742695”,
“type”: “tier”
},
{
“attributes”: {
“amount_cents”: 2000,
“currency_code”: “USD”,
“date”: “2025-01-05T03:40:37.180+00:00”,
“payment_status”: null,
“pledge_payment_status”: “valid”,
“tier_id”: “742695”,
“tier_title”: “Student”,
“type”: “pledge_downgrade”
},
“id”: “pledge_downgrade:197908484”,
“type”: “pledge-event”
},
{
“attributes”: {
“amount_cents”: 2000,
“currency_code”: “USD”,
“date”: “2025-01-05T03:37:22.878+00:00”,
“payment_status”: null,
“pledge_payment_status”: “declined”,
“tier_id”: “742695”,
“tier_title”: “Student”,
“type”: “pledge_downgrade”
},
“id”: “pledge_downgrade:197908199”,
“type”: “pledge-event”
},
{
“attributes”: {
“amount_cents”: 2000,
“currency_code”: “USD”,
“date”: “2025-01-05T03:37:03.794+00:00”,
“payment_status”: null,
“pledge_payment_status”: “declined”,
“tier_id”: “742695”,
“tier_title”: “Student”,
“type”: “pledge_start”
},
“id”: “pledge_start:197908172”,
“type”: “pledge-event”
},
{
“attributes”: {
“amount_cents”: 600,
“currency_code”: “USD”,
“date”: “2024-08-26T14:52:42.829+00:00”,
“payment_status”: null,
“pledge_payment_status”: “valid”,
“tier_id”: “742657”,
“tier_title”: “Passerby”,
“type”: “pledge_delete”
},
“id”: “pledge_delete:182217312”,
“type”: “pledge-event”
},
{
“attributes”: {
“amount_cents”: 600,
“currency_code”: “USD”,
“date”: “2024-08-26T13:51:33.831+00:00”,
“payment_status”: null,
“pledge_payment_status”: “valid”,
“tier_id”: “742657”,
“tier_title”: “Passerby”,
“type”: “pledge_start”
},
“id”: “pledge_start:182217312”,
“type”: “pledge-event”
},
{
“attributes”: {
“amount_cents”: 1200,
“currency_code”: “USD”,
“date”: “2024-02-02T14:10:34.060+00:00”,
“payment_status”: null,
“pledge_payment_status”: “valid”,
“tier_id”: “742659”,
“tier_title”: “Brawler”,
“type”: “pledge_delete”
},
“id”: “pledge_delete:152830716”,
“type”: “pledge-event”
},
{
“attributes”: {
“amount_cents”: 1200,
“currency_code”: “USD”,
“date”: “2024-01-05T00:00:00.000+00:00”,
“payment_status”: “Paid”,
“pledge_payment_status”: null,
“tier_id”: “742659”,
“tier_title”: “Brawler”,
“type”: “subscription”
},
“id”: “subscription:1315520202”,
“type”: “pledge-event”
},
{
“attributes”: {
“amount_cents”: 1200,
“currency_code”: “USD”,
“date”: “2023-12-05T02:37:02.482+00:00”,
“payment_status”: null,
“pledge_payment_status”: “valid”,
“tier_id”: “742659”,
“tier_title”: “Brawler”,
“type”: “pledge_downgrade”
},
“id”: “pledge_downgrade:152830716”,
“type”: “pledge-event”
},
{
“attributes”: {
“amount_cents”: 1200,
“currency_code”: “USD”,
“date”: “2023-12-05T02:36:21.788+00:00”,
“payment_status”: null,
“pledge_payment_status”: “declined”,
“tier_id”: “742659”,
“tier_title”: “Brawler”,
“type”: “pledge_start”
},
“id”: “pledge_start:152830674”,
“type”: “pledge-event”
}
]
}