github-experts / github-experts-app

0 stars 0 forks source link

Decide on a technology for payments (if any at all) #32

Closed nilofer closed 4 years ago

nilofer commented 4 years ago

Could use GitHub Sponsors or go through Paypal. Other options?

nwams commented 4 years ago

Could use GitHub Sponsors or go through Paypal. Other options?

Stripe is also a widely use payment gateway, they're pretty popular. Both PayPal and Stripe are widely used. I've never used GitHub sponsors but I'll look into it to see which of the 3 is the most befitting option.

nwams commented 4 years ago

Regarding payments, I’d recommend that we use GitHub Sponsors existing flow (rather than Stripe or PayPal).

TLDR;

I assessed 3 options: 1) GitHub Sponsors 2) PayPal and 3) Stripe.

I chose GitHub sponsors primarily because it allows us to leverage GitHub’s existing legwork with payments which, from my experience, is not trivial. After reading through their docs, I discovered that GitHub sponsors actually sitting on top of Stripe Connect.

Additionally, they absorb/handle the processing fees and they don’t charge a fee to facilitate this. Their decision to absorb the fees is great and is also very, very rare! I feel this shows their commitment to making sure developers get paid.

Quirk of GitHub Sponsors:

Since the buyers are billed monthly (along w/ all of their other subscriptions), this leads me to believe that Developers won’t receive payment until the end of the month, when it’s all aggregated. Not sure how they’ll feel about this, might be a hit or a miss. Might be fine, but might be something we to suggest to GitHub to alter (in our hackathon video) specifically for GitHub Experts. Only after user research.

Fees comparison:

  1. GitHub Sponsors: $0.
  2. Stripe: 2.9% + $0.30 per transaction. 0.6% fee for international credit cards. In addition to that, your sellers will be charged $0.25 per ACH payout.
  3. PayPal: Not publicly available. There is no way of getting the actual fee dollar amount from the API. This coupled with the variability of fees depending on the sellers country makes determining exact payout amounts difficult. Unlike Stripe, PayPal also charges a commission from the marketplace admin, so it is important to take note that your marketplace admin commission percentage should be enough to cover the PayPal fee.

Lots of Details:

I’ve used PayPal (for multi-party payments) in my first startup and Stripe (for direct payments) in my second. Handling payments for a marketplace a.k.a. multiparty payments, can be more challenging especially when compared with direct payments because, e.g. you’re dealing with setting rules for how to money flows between 3 total parties (You, your sellers and the buyers) as well as other issues like who is responsible for settling disputes on chargebacks, etc.

How GitHub Sponsors Works Currently

Stripe Connect (It’s for Marketplaces)

https://stripe.com/connect Developer docs: https://stripe.com/docs/connect

PayPal for Marketplaces

https://www.paypal.com/us/webapps/mpp/partner-marketplaces Developer docs: https://developer.paypal.com/docs/platforms/

nwams commented 4 years ago

Action Item for @nwams :

Zakeelm commented 4 years ago

@WilliamMortlMicrosoft will be pairing with @nwams on this work

nwams commented 4 years ago

Great discussion today Will!

@WilliamMortlMicrosoft Action Items

WilliamMortlMicrosoft commented 4 years ago

We can change the subscription level per month: https://stripe.com/docs/billing/subscriptions/change

Also, I have code samples:

https://stripe.com/docs/payments#build-your-own https://github.com/stripe-samples

WilliamMortlMicrosoft commented 4 years ago

All APIs: https://stripe.com/docs/api

WilliamMortlMicrosoft commented 4 years ago

How to check on customer: https://stripe.com/docs/api/customers

This should be sufficient to check if a person sponsors someone

WilliamMortlMicrosoft commented 4 years ago

Might be the secret sauce: https://github.com/stripe-samples/subscription-use-cases/tree/master/usage-based-subscriptions

nwams commented 4 years ago

Here's the payment flow (I created 3 diagrams, attached):

Screen 1 Page-1

Screen 2 Page-2

Screen 3 Page-3

What Stripe Service to Use. Use Stripe Connect’s Destination charges. For example, Destination charges are typically used in ride-hailing services like Lyft. Use case: Customers transact with your platform (GitHub) for services provided by your user (Expert).

Technical Implementation. Here’s how it works behind-the-scenes. GitHub will create a charge on GitHub’s platform’s account so the payment appears as a charge on your account. Then, GitHub determines whether some or all of those funds are transferred to the connected account. GitHub’s account balance will be debited for the cost of the Stripe fees, refunds, and chargebacks. Docs: https://stripe.com/docs/connect/collect-then-transfer-guide

Holding payments. Payments can be held in an escrow-like behavior and are released when video chat ends using transfer_groups. We will hold funds in GitHub balance before sending them to Experts accounts.

WilliamMortlMicrosoft commented 4 years ago

In order to get the sponsors for a particular Github user, you need to execute the following GraphQL query:

query {
  user(login: "prophen") {
    id
    sponsorsListing {
            id
      fullDescription
    }
    sponsorshipsAsMaintainer(first:100) {
      edges {
        node {
          tier {
            id
            __typename
          }
          sponsorEntity{
            __typename
            ... on User {
              name
              url
            }
          }
          privacyLevel
          createdAt
        }
      }
    }
  }
}

This query gets the sponsors for Github user "prophen" and displays the following response (to change the query to another user, replace "prophen" with that person's Github user name):

{
  "data": {
    "user": {
      "id": "MDQ6VXNlcjM5NDE4NTY=",
      "sponsorsListing": {
        "id": "MDE1OlNwb25zb3JzTGlzdGluZzEwNzQw",
        "fullDescription": "My work is about creating opportunities for technologists like myself who are just getting started in their tech careers.\n\nI recognize from experience the extra effort it takes to get a great start when you are dealing with financial hardships and a number of non-negotiable adult responsibilities.\n\nWhen you sponsor me, you allow me the mental space to do my work to the best of my ability.\n\nThank you ❤️\n"
      },
      "sponsorshipsAsMaintainer": {
        "edges": [
          {
            "node": {
              "tier": null,
              "sponsorEntity": {
                "__typename": "User",
                "name": "Thomas Reynolds",
                "url": "https://github.com/tdreyno"
              },
              "privacyLevel": "PUBLIC",
              "createdAt": "2020-07-25T23:33:20Z"
            }
          },
          {
            "node": {
              "tier": null,
              "sponsorEntity": {
                "__typename": "User",
                "name": "Ryan Florence",
                "url": "https://github.com/ryanflorence"
              },
              "privacyLevel": "PUBLIC",
              "createdAt": "2020-07-07T16:59:29Z"
            }
          },
          {
            "node": {
              "tier": null,
              "sponsorEntity": {
                "__typename": "User",
                "name": "Max Desiatov",
                "url": "https://github.com/MaxDesiatov"
              },
              "privacyLevel": "PUBLIC",
              "createdAt": "2020-06-28T01:15:55Z"
            }
          },

          ...

        ]
      }
    }
  }
}

You can pare the query down to remove resulting data that you don't need.

The GraphQL endpoint for V4 of the Github API is:

https://api.github.com/graphql

rather than using curl to explore V4 of the GraphQL API, you can also use the easy to use query explorer:

https://developer.github.com/v4/explorer/

Of special note, V3 of the API is a conventional REST api but does not seem to export any functionality to query sponsorships.