Page MenuHomePhabricator

Paypal grant transactions in Civi not being matched to paypal audit file
Closed, ResolvedPublic

Description

10 transactions from STL-20260115.01.009.CSV did not settle into CiviCRM in the audit process. Note of them have entries in the pending table. There are all larger payments from charitable organisations who appear to have self initiated the donation within paypal - ie the subjet is "xxxx Program has sent you money" - I think they might be being imported by Melanie as 'paypal grants' - but the paypal ID is not being added on import

These contacts relate https://civicrm.wikimedia.org/civicrm/contact/view?reset=1&cid=59606568
https://civicrm.wikimedia.org/civicrm/contact/view?reset=1&cid=50778

transaction
PAYPAL 2BR61104NB769812F
PAYPAL 9CP188008M585833N
PAYPAL 88P651919U618643V
PAYPAL 5UC369406P6694047
PAYPAL 5E546255WJ459661K
PAYPAL 7J496691S6256893V
PAYPAL 21185585PJ749110C
PAYPAL 2YB44267CH786632P
PAYPAL 1A259552PL380884G
PAYPAL 3TR684630N543181Y

Query to find in pending

SELECT *
FROM smashpig.pending
WHERE gateway_txn_id IN (
    '2BR61104NB769812F',
    '9CP188008M585833N',
    '88P651919U618643V',
    '5UC369406P6694047',
    '5E546255WJ459661K',
    '7J496691S6256893V',
    '21185585PJ749110C',
    '2YB44267CH786632P',
    '1A259552PL380884G',
    '3TR684630N543181Y'
)
OR message REGEXP
    '2BR61104NB769812F|9CP188008M585833N|88P651919U618643V|5UC369406P6694047|5E546255WJ459661K|7J496691S6256893V|21185585PJ749110C|2YB44267CH786632P|1A259552PL380884G|3TR684630N543181Y';

Event Timeline

OK - I found it - the last lot was hand entered by @MDemosWMF - I'm looking at whether we can autocreate these from the audit report... The main challenge seems to be whether we can identify the 3 relevant contacts - ie donor, DAF name and banking institution

FieldFrom
contact_id?
contribution_status_id:nameCompleted
financial_type:nameCash
total_amountreconciliation/audit files
currencyreconciliation/audit files
receive_datereconciliation/audit files
payment_instrument_id:namePaypal Grants
soft_credit_contact_id? audit file has this in text "You received a payment from - is that enough? - this one is the Banking Institution type
soft_credit_contact_id? Donor-advised Fund
Gift_Data.Fund:nameMajor Gifts - CC104
Gift_Data.is_major_gifttrue
Gift_Data.channel:nameOther offline
Gift_Data.type:nameDonor Advised Fund
Gift_Data.Appeal:nameWhite Mail
contribution_extra.gatewayPaypal DAF

Hmm - it seems quite unclear whether the API can provide name data - I'll check in with Melanie & see what Melanie sees - but it seems like if we are going to see something then https://developer.paypal.com/docs/transaction-search will be where it comes from. I might throw together a way to see what this data shows in case it is helpful

For my purposes I really want the gateway_txn_id on the contribution - & if I can automate something manual then even better

Eileenmcnaughton renamed this task from Paypal transactions not getting to Civi 15 Jan 26 to Paypal grant transactions in Civi not being matched to paypal audit file.Jan 20 2026, 1:27 AM

@Eileenmcnaughton We enter the paypal grants using batch data entry weekly. All files are saved here that are exported from Paypal and have the donor/donation information if that helps! https://drive.google.com/drive/folders/1wMdv7SWqyN09iWNJEGY-fVfu-CGtlTHB?usp=drive_link

cc @EMartin

Change #1229832 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/SmashPig@master] Maintenance script to GetTransactionDetails (paypal)

https://gerrit.wikimedia.org/r/1229832

@MDemosWMF is there any more info available in the paypal UI - I'm looking for a value that would allow linking them to the paypal donation

The 3 references I have are
transaction ID 2BR61104NB769812F
Custom Field 1016635885
Consumer ID 8WB9X83MZJ62W

In your spreadsheet the only ID on the relevant row is 8002098

(note I'm manually adding the transaction ID to these few as part of figuring out how to deal with them - so if you see them on the record that is why)

I think the Custom Field - eg 1016635885 is the most likely for a match

@Eileenmcnaughton The fields in the file are all that I have available to me for the data entry. I'm not sure if more information lives somewhere else in the Paypal console.

Change #1229832 merged by Eileen:

[wikimedia/fundraising/SmashPig@master] Maintenance script to GetTransactionDetails (paypal)

https://gerrit.wikimedia.org/r/1229832

Change #1233837 had a related patch set uploaded (by Eileen; author: Eileen):

[wikimedia/fundraising/SmashPig@master] Bubble up grant_provider from paypal trr files

https://gerrit.wikimedia.org/r/1233837

here is my thinking on PaypalGrants

  1. new entity / table - GrantTransactions
  2. write paypal grants data to it as it comes in via audit
  3. write a api/process to take the rows from that table with a gateway_txn_id that is not in civi and try to link it by a) do a get for all around the right date with the same banking institution and amount b) if only one match then yay c) if more than one then as long as the total transactions count is the same then just match from the top d)) ug - the aggregate ones - one paypal split into maybe 20 real ones - we will need to append something to the gateway_txn_id & the fields on the settled table will need to be pro-rata - fortunately I don't think there is any fees or currency issues to worry about e) I don't think I can avoid doing the match routine but I had been wondering about code-creating the start of a data entry batch for them - so the amounts and what we know is already in a batch data entry screen & Melanie can fill in the rest

Note I need to bubble up a field from the smashpig audit to support this - looking at callling it grant_provider

Change #1233837 merged by jenkins-bot:

[wikimedia/fundraising/SmashPig@master] Bubble up grant_provider from paypal trr files

https://gerrit.wikimedia.org/r/1233837

XenoRyet set Final Story Points to 4.