Jump to content

PaymentStripeIntents


benbyf
 Share

Recommended Posts

@marie.mdna Hi Marie. Sorry for the delay, but if you still need it, here is a bit more info that may help. My site sells educational courses, (not products) and each instructor conducts classes in various locations for various fees. There is a master Stripe account for the website owner and each instructor has their own Stripe account which is set up as a ‘Connected Account’ via the master Stripe account. (For me, getting the Connected Accounts set up (onboarded) was the most confusing part; see the Stripe documentation).

In ProcessWire, I set up pages for instructors, courses, dates (events), etc with the necessary fields to link these. You’ll have to set up your PW for whatever you are trying to sell; make sure you can save an order with at minimum the buyer info, seller name/id (instructors in my case) and seller’s Stripe account number (this will be their ‘connected account’ number), and price.

Then here’s what I did:
- Installed the Stripe PHP Library (via Composer or manually) and set up your Stripe development stuff (secret and publishable keys, web hook endpoints, etc; you’ll have to look up how to do this in the Stripe documentation).

- created a Stripe form processor template and page using code/examples from the Stripe documentation. This page gets my stored API keys and sends the order info to Stripe to create the payment page.

- created a template with a form to collect the buyer’s name, email, etc. and the course info, instructor’s name, etc. This page contains a second Stripe form (essentially one hidden field and a hidden button) that works with the Stripe form processor page. On order submission, the form processes via Ajax: it does some checks for required fields, etc, then saves the order as an unpublished page. On success, js populates the second (Stripe) form with the id of the saved order page then submits it to the Stripe form processor, which fetches all the data to submit what it needs to Stripe.

- created a webhooks.php file to receive data back from Stripe to verify success or failure of an order and do any post-order processing (get and publish the order page, set fields with order confirmation data, send confirmation emails to the customer and store owner, etc). It’s supposedly more reliable to use the web hook data for this rather than rely on the form submission success page. If I recall, you can find an example/template of webhooks.php from Stripe.

I hope this is enough to get you started. - P

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...