Easy Stripe Component

Here is an easy Stripe component for Moqui: GitHub - coarchy/stripe: Stripe Component for Moqui based on Coarchy code written by Michael Jones

I’ve been working on this as part of another project. I’ve tried to make it as easy as possible to use. If you have any questions or feature requests let me know

What you need to know:

Usage

Note: Can be used with a party logged in or from a guest checkout perspective properly.

  • Create a SalesOrder with a Product with a valid ProductStore and ProductPrice
    call stripe.StripeServices.create#CheckoutFromSalesOrder with the order, and your successUrl and cancelUrl
    Optionally set the setup_future_usage to "off_session" to allow for charging customer on their payment method (like in a subscription or usage based model)

  • Redirect the user to the checkoutUrl returned from the service (note the checkoutUrl and checkoutId are added to the OrderPart that is passed in)

  • If this is the first time the user has checkout out (or they’re in not logged in), they will enter their payment information like name, credit card(depending on payment methods configurd in stripe), and billing address.

  • If the user is already logged in or the orderPart.customerPartyId is set and that party has a valid PartyIdentification with type PtidSci and a valid payment method in stripe, the user will only need to type in new information if they want to change it.

  • The user will then submit the payment in the Stripe Checkout screen and will redirect to your successUrl.

  • You will then need to deliver the Product / Service to the User who just paid (this can be done through checking the status of the OrderPart and if the OrderPart is in the OrderPlaced or later status then it should be okay to deliver the product to the OrderPart.customerPartyId )

  • At any time, if the customer wants to cancel the order part, call stripe.StripeServices.cancel#CheckoutFromSalesOrderPart

  • If the User is in the Stripe Checkout screen, Stripe should redirect to your customer to cancelUrl where they can restart their Order, leave feedback, or whatever

You are responsible for:

Things to consider doing:

  • Configure the Stripe Checkout branding settings: production test
  • Configure the Handling of the stripe webhooks. Do this by:
    • Creating a seca for the service before or after the stripe service potential services:
      • Webhook checkout.session.completed: stripe.StripeServices.consume#CheckoutSessionCompleted
      • Webhook checkout.session.expired: stripe.StripeServices.consume#CheckoutSessionExpired
      • Service: stripe.StripeServices.create#CheckoutFromSalesOrder
      • Service: stripe.StripeServices.cancel#CheckoutFromSalesOrderPart
    • Overriding the services by creating a file in compone://yourcomponent/service/stripe/StripeServices.xml with the same name as the service overriding

Things not considered:

  • Moqui Refunds (message me here for implementation: Profile - michael - Moqui Forum)
  • Moqui Vendor Rejection seca (message me here for implementation: Profile - michael - Moqui Forum)
  • Stripe Taxes
  • Stripe Subscriptions
  • Stripe Customer Portal
  • Stripe Connect
  • Stripe Invoices
  • Stripe Invoice Emails
  • Stripe Receipt Emails

Limitations

  • stripe is a big set of products, but we only use a very tiny subset of them here
  • at the moment no vaulting functionality for a customer service agent entering information on behalf of a customer
1 Like