Square Payment triggers new Member in LifterLMS

Hi everyone,

I am a beginner developer helping a friend setup an online course and membership platform on his existing Wordpress Elementor website. We have set up an Ecwid store on the site which uses Square as the payment gateway, And we also have a square terminal to be set up in the physical space.

Two items available in both the Ecwid store and the physical store will be:

  1. An online course and,
  2. A yearly membership,

Which when purchased, we wish for a new member to be created in the LifterLMS plugin we are using for the course and membership content - I am trying to set this up.

The logic would be something like:

  • When Square payment == 'confirmed' for ProductID_COURSE OR ProductID_MEMBERSHIP, createNewEnrollment() in LifterLMS with the email used for the payment for the relevant product
    ie.
  • when payment == confirmed for productID_COURSE OR ProductID_MEMBERSHIP (LifterLMS.createNewEnrollment(customerEmail, productID)

For now I vaguely see this possibility:

  • when or after Update payment (PUT /v2/payments/{payment_id}) is called to make a payment approved:
  • get the Customer’s email via payment:id:customer:email__address
  • and get the product’s name via payment:id:order:id:line_items:name
  • Send this data to LifterLMS API to create a new member or new enrollment.

Am I on the right track?

And aside from the above logic, how do I actually go about setting up such a trigger? Where would the code live? is it

  • The code would live in the wordpress back-end in PHP / Javascript, and the Square API would be called there?
  • Or can it be set such that when a payment is updated for ProductID_Course or ProductID_Membership that the code lives with Square somewhere to pass the relevant email__address and productName to LifterLMS?

Hope this makes sense,
I appreciate any feedback or redirection here.

Thank you for taking the time.

:wave: Since the payments are coming from two different sources you will want to make sure that the Ecwid integration is collecting the customer information and associating that to the payment.

Also payments that are collected on the Terminal in the physical space you will need to make sure that the customer email is collected in the customer profile. Having a customer enter their email to receive a digital receipt won’t guarantee that the email is returned in the customer profile.

Once you know that you have the customer information and the order information you can use the Payments API, Orders API and the Customers API to get the information to push to LifterLMS.

The triggers for this can be webhooks or syncs that call our APIs on a scheduled cadence. The code will need to live in your back-end PHP/ Javascript. Let us know if you have any additional questions. We’re happy to help. :slightly_smiling_face:

1 Like