Overview
Opigno Enterprise API allows learners to purchase access to a Learning Path through Stripe Checkout. A Learning Path becomes purchasable once it is enabled for commercial use in the backoffice and has an associated Stripe product.Currently,
LearningPath is the only entity type that can be purchased through Stripe. Other purchasable
entity types may be added in the future — the API exposes this as the PurchasableEntity union.StripeProduct— describes the product being sold (name, description, images, price, currency) and the entity it unlocks.StripeCheckoutSession— represents a single checkout attempt: it holds the hosted Stripe checkout URL and tracks both the session and payment status.
1
Fetch the product information
Call
getLearningPathProductInfo to display the price, currency, name and description of the Learning Path to the learner before checkout.2
Create a checkout session
Call
createLearningPathStripeCheckoutSession to obtain a checkoutUrl, then redirect the learner to it.3
Redirect to Stripe
The learner completes (or abandons) the payment on the Stripe-hosted checkout page.
4
Confirm the result
After Stripe redirects the learner back to
successRedirectUrl, call getLearningPathStripeCheckoutSession (or rely on your own webhook/backoffice flow) to confirm that sessionStatus is COMPLETED and paymentStatus is PAID before granting access.Learning Path CTA
When Stripe integration is enabled and a Learning Path has an associated Stripe product, the Learning Path CTAs returned by the API change to reflect that the Learning Path must be purchased before it can be accessed:These CTAs replace
ENROLL_LP / LOGIN_AND_ENROLL_LP only for Learning Paths that have a Stripe product ID configured.
Learning Paths without Stripe integration keep the standard enrollment CTAs described in the
Learning Path CTA reference.Enrollment access with Stripe
For Learning Paths with Stripe integration enabled, enrollment gets an additional access layer on top of the standard rules:- The learner is automatically enrolled into the Learning Path once their Stripe checkout session reaches
sessionStatus: COMPLETEDandpaymentStatus: PAID. There’s no need to callcreateLpIndividualMembershipafter a successful payment — the membership is created automatically. - Enrollment into a commercial Learning Path is available only for authenticated user contexts. Anonymous user contexts can no longer be enrolled into a Learning Path that requires a Stripe payment; the learner must authenticate before purchasing, as reflected by the
LOGIN_AND_PURCHASE_LPCTA above.
Retrieve product information
Use thegetLearningPathProductInfo query to fetch the Stripe product details attached to a Learning Path,
so pricing information can be displayed to the learner ahead of the checkout.
Access Policy:
- The API user context must be present, be valid, not blocked and associated with an authenticated scope.
- The requested Learning Path should exist, be published and have a Stripe product ID.
- The API user must have permission to view the specified Learning Path; otherwise, access is denied.
As a result, a
StripeProduct object will be returned:
Retrieve an existing checkout session
Use thegetLearningPathStripeCheckoutSession query to retrieve the current Stripe checkout session for a Learning Path,
for example to resume checking a payment status after the learner returns from Stripe, or to check whether a session already exists.
Access Policy:
- The API user context must be present, be valid and not blocked.
- The API user must have permission to view the specified Learning Path; otherwise, access is denied.
- The requested Learning Path should exist, be published and have a Stripe product ID.
If no checkout session exists yet for the given Learning Path and user context, the query returns
null.
Create a checkout session
Once the learner is ready to pay, use thecreateLearningPathStripeCheckoutSession mutation to create a Stripe checkout session and
redirect the learner to the returned checkoutUrl.
Access Policy:
- The API user context must be present, be valid and not blocked.
- Stripe checkout session creation is only available for Learning Paths enabled for commercial use.
- The API user must have permission to view the specified Learning Path; otherwise, access is denied.
If a non-expired checkout session already exists for the given Learning Path and user context, the mutation returns
that existing session instead of creating a new one, unless
forceNew is set to true.CreateStripeCheckoutSessionResponse object will be returned:
StripeCheckoutSession object
StripeCheckoutSessionStatus can be one of:
StripePaymentStatus can be one of:
Below is an example of creating a checkout session for the Learning Path with ID 40: