redwoodjs / payments

WIP
MIT License
6 stars 0 forks source link

redwoodjs-stripe POC

A place to work on the Proof of Concept for an integration between Redwood and Stripe based off of a proposal. (WIP)

The official repo lives here : redwoodjs-stripe

Proposal doc : redwoodjs-stripe Readme (Viewing only)

Try it out

Some of the functionality can be used as more gets available this section will be updated. The commands used are placeholders for when/if API wishlist items can be fulfilled.

If you haven't already got a Stripe account, now would be a good time to get one. Once you have made an account have your API keys ready. You can find them in your Stripe Dashboard.

Disclaimer: Do not try to break it. Literally held together with spit and wishful thinking ;)

  1. Install Stripe CLI

    brew install stripe/stripe-cli/stripe

    Once Stripe CLI has been install you need to login into Stripe via CLI and enter your Stripe api key

    stripe login -i

  2. Clone this repo then navigate to the app folder

    cd app

  3. Install modules

    yarn install

  4. "Install" package and setup with Stripe API keys.

    yarn rw-setup-plugin-stripe

    What you should see:

    • a webhooks function being added to the api functions folder
    • prompts for Stripe API keys
    • collected keys being added to .env file

    Missing from this step

    • hooking webhook listening command into yarn rw dev
  5. "Install" payment flow "checkout-mode" refers to the Stripe checkout session mode, this is used to determined the payment flow. It can be either "payment" (for once-off payments) or "subscription" (for subscriptions)

    yarn rw-g-stripe-checkout <checkout-mode>

    What you should see for all checkout-modes:

    • add createCheckoutSession and retrieveCheckoutSession functions to api functions folder
    • adds a StripeCart page (localhost:8910/stripe-cart)
    • retrieves checkout session data on successful payment visible in console
    • only for subcription payment flow ("subscription" checkout-mode)
      • adds a createCustomerPortalSession function to api functionc folder
      • after checking out successfully, a button to go to the Customer Portal will appear on the StripeCart page
  6. Run app

    yarn rw-dev

    What you should be able to do:

    • Make one time purchase via Stripe Checkout using dummy data in api side by clicking checkout button in StripeCartPage (localhost:8910/stripe-cart)
    • Watch for webhooks in terminal
    • See success or cancel status in location bar after checkout
    • See the session object in console after successful payment

Extra

yarn rw-d-stripe-checkout <checkout-mode>

Destroys all code in app relating to a specific payment-flow/ checkout-mode

Get Involved

So you would like to be part of this project. At this point in time here's how:

If there is a way that you think you could help that isn't mentioned above do not hesitate to contact me :)

Thank you

Super huge thank you for making it this far and for showing an interest.