Discourse/Uncategorized/2019-01-24 Feeding Stripe data into LittleGreenLight

From Noisebridge
Jump to navigation Jump to search

📜 Discourse Archive
This page is preserved verbatim from discuss.noisebridge.info, the Noisebridge community forum that operated roughly 2018–2022. The original site is defunct; this content was recovered via the Wayback Machine and is archived here as a primary source for Noisebridge history.
⮡ Original URL: https://discuss.noisebridge.info/t/feeding-stripe-data-into-littlegreenlight/133
📦 Verify on Wayback Machine
📅 Archived: 2020-11-27
🏷 Original category: Uncategorized

Feeding Stripe data into LittleGreenLight[edit | edit source]


tdfischer

Earlier this month, @rando and I sat down and figured out how to pipe data from stripe into our CRM, LittleGreenLight.

After a bunch more poking and prodding the stripe and LGL APIs (wtf when did they introduce Invoices?), I’ve come up with this script:


     gist.github.com
 
 
   

https://gist.github.com/tdfischer/9703ca8a8d3f8605e4b40d3583a5253c[edit | edit source]

Pipfile[edit | edit source]

``` source name = "pypi" url = "https://pypi.org/simple" verify_ssl = true

[dev-packages]

[packages] stripe = "*" pytz = "*" ```

This file has been truncated. show original

Pipfile.lock[edit | edit source]

``` {

   "_meta": {
       "hash": {
           "sha256": "0f34cbb1f0ca3aff45880bd70563e1b9256c13cc8f93eb4bb3d0c03195376716"
       },
       "pipfile-spec": 6,
       "requires": {
           "python_version": "2.7"
       },
       "sources": [https://gist.github.com/tdfischer/9703ca8a8d3f8605e4b40d3583a5253c 

```

This file has been truncated. [show original]

app.py[edit | edit source]

``` import requests import json import random import stripe import dotenv import os import time from datetime import datetime, timedelta

dotenv.load_dotenv() ```

This file has been truncated. show original





I’ll be installing it on unicorn and setting it to run in a daily cron. When it runs, it creates a number of entries in the “Integration Queue” in LGL which allow for manual approval of the data. At some point we can turn off the manual approval step and let this sucker run forever.

The step after this is to setup a system where we all check LGL frequently and use the Gift Acknowledgement flags to send a thank-you e-mail to people and track who has responded to which donation.

The LGL API is frikkin weird as hell and I might be doing it wrong, but this works for now. Its goofy because you don’t actually do CRUD operations like “create this gift” “update this person’s list of donations”; instead, you POST a bunch of data to a URL, then configure some maps that translate those POST parameters into LGL fields, then review that your fields match up for each record and approve it.

But thank god it isn’t SOAP.




gaardn2019-01-24

The LGL people are pretty responsive, so if we encounter weirdness we can’t get around with their derpy API, chances are good they’ll help us work through it.

We can’t be the only people pulling from Stripe having to come to with quirky solutions.