You are browsing a read-only backup copy of Wikitech. The live site can be found at

Fundraising/Data and flow/PSP integrations/Braintree

From Wikitech-static
Jump to navigation Jump to search
Original Name Braintree
Our Name Braintree
Current Name Braintree
Payment Methods PayPal
Countries ?
Production Console
Test Console
Contact ?


Braintree is supposed to replace PayPal Express Checkout, but has been delayed because it requires an extra click from donors to make payments.

We used GraphQL first time as our API, As Google pay and apple pay from Adyen, Braintree PayPal render a button in our payments page and we now only collect the employ field, encrypting the data before submitting it to our server.

All calls to the Braintree API are routed through the SmashPig library. There are PaymentProcessor subclasses for each payment method.

Braintree Graphql API Explorer

Based on their graphql schema, we store graphql querys under Smashpig box PaymentProviders/Braintree/Queries

  • we used `ping` to test the connection;
  • we used `chargePaymentMethod` to create payments;
  • we used `search` to get all transactions for audit parse;
  • we used `report` to get Venmo reports;



Payment Methods


File:Screen Shot 2022-07-13 at 5.36.55 PM.png

Since we want to have recurring and monthly convert, we choose the vault:

Vaulting a PayPal account will allow you to charge the account in the future without requiring your customer to be present during the transaction or re-authenticate with PayPal when they are present during the transaction.



Recurring Braintree donations are tokenized and are charged on our schedule by the SmashPig Civi extension's recurring payment charge job.

IPN messages


Braintree generates json files from the search queries for PayPal, and Venmo potentially.

We generate the report with process-control yaml file, daily and the maintaince script is SearchYesterdayTransactions

could generate report manually by inside the civi box, then run `php ./vendor/wikimedia/smash-pig/PaymentProviders/Braintree/Maintenance/SearchTransactions.php --r=90 --t=refund` (it will get the refund report from 90 hrs till now) types are (report, refund, chargeback) and the report will be stored under 'drupal/sites/default/files/wmf_audit/braintree/incoming' folder.

We process them with the wmf_audits drupal module that calls functions from SmashPig to parse the Json reports as run `drush parse-audit braintree` from /srv/civi-sites/wmff/drupal.

Pending Table

Jobs Queue

For overall payment queue can go to server, then run `drush --user=1 -v -r /srv/civi-sites/wmff/drupal qc` to consume the queues


Fundraising/Development tools/Testing#Braintree