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:
- Uses Stripe Checkout to gather payment information and the payment from the user.
- To work properly: Requires mantle-usl commit
8503eed
or later
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 typePtidSci
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 theOrderPart
is in theOrderPlaced
or later status then it should be okay to deliver the product to theOrderPart.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:
- Setting up the stripe account with your business profile and tax information
- Receive payouts from Stripe
- Inserting publishable key, secret key, and shared secret from the stripe dashboard to your SystemMessageRemote see: stripe/data/StripeDemoData.xml at bf9d4610c0c7d560d4c3df6561a7d30e669ed341 · coarchy/stripe · GitHub
- Create a PaymentGatewayConfig calling the stripe services see: stripe/data/StripeDemoData.xml at bf9d4610c0c7d560d4c3df6561a7d30e669ed341 · coarchy/stripe · GitHub
- Create a ProductStore attached to the PaymentGatewayConfig with appropriate settings for approving Orders see: stripe/data/StripeDemoData.xml at bf9d4610c0c7d560d4c3df6561a7d30e669ed341 · coarchy/stripe · GitHub
- Create products that are part of the ProductStore with Prices
- Code for creating a checkout and redirecting the user to the Stripe Checkout page see: stripe/service/stripe/StripeServices.xml at bf9d4610c0c7d560d4c3df6561a7d30e669ed341 · coarchy/stripe · GitHub
- Code for handling the success or failure of the checkout session see: stripe/service/stripe/StripeServices.xml at bf9d4610c0c7d560d4c3df6561a7d30e669ed341 · coarchy/stripe · GitHub
- Delivering your product based on whether the checkout was successful
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
- Creating a seca for the service before or after the stripe service potential services:
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