Skip to content
/ stripe Public

Stripe Component for Moqui based on Coarchy code written by Michael Jones

License

Notifications You must be signed in to change notification settings

coarchy/stripe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is an Easy Stripe component for Moqui

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:

  • Setting up the stripe account with your business profile and tax information
  • Receive payouts from Stripe
  • Inserting publishable key, secret key from the stripe dashboard to your SystemMessageRemote see:
    <!-- TODO: Configure this here: http://localhost:8080/qapps/system/SystemMessage/Remote/MessageRemoteDetail?systemMessageRemoteId=DemoStripe
  • Creating a checkout.session.completed and checkout.session.expired to be added to the webhook configuration screen in Stripe for production here to yourdomain.com/rest/sm/StripeWebhookEvent/YourProductionStripeSystemMessageRemoteId and adding the webhook signing secret as the shared secret to your SystemMessageRemote
  • Create a PaymentGatewayConfig calling the stripe services see: https://github.com/coarchy/stripe/blob/bf9d4610c0c7d560d4c3df6561a7d30e669ed341/data/StripeDemoData.xml#L25C28-L25C48
  • Create a ProductStore attached to the PaymentGatewayConfig with appropriate settings for approving Orders see:
    <productStores productStoreId="DemoProductStore" systemMessageRemoteId="DemoStripe">
  • 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:
    <parameter name="checkoutUrl"/>
  • Code for handling the success or failure of the checkout session see:
    <parameter name="cancelUrl" required="true" default-value="${ec.web.getWebappRootUrl(false,true)}"/>
  • 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 component://yourcomponent/service/stripe/StripeServices.xml with the same name as the service overriding

Things not considered:

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

Useful Resources

stripe listen --forward-to kinginsuranceagency.localhost:8080/rest/sm/StripeWebhookEvent/DemoStripe stripe listen --events checkout.session.completed,checkout.session.expired --forward-to kinginsuranceagency.localhost:8080/rest/sm/StripeWebhookEvent/DemoStripe stripe events resend evt_1PH9HU2eZvKYlo2CrSrLx8y1

Credit Card Testing

See:https://docs.stripe.com/testing#declined-payments Succeed: 4242424242424242 Fail: 4000000000000002

About

Stripe Component for Moqui based on Coarchy code written by Michael Jones

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published