Skip to main content

An Open edX plugin to add API for external checkouts

Project description

A django app plugin to add a new API to Open edX for external checkouts. The plugin redirects the user the desired external ecommerce service upon clicking the Upgrade button in LMS dashboard or Learning MFE.

Installation

For detailed installation instructions, please refer to the plugin installation guide.

Installation required in:

  • LMS

Configuration

1) edx-platform configuration (Environment/Settings)

  • You might need to add the following configuration values to the config file in Open edX. For any release after Juniper, that config file is /edx/etc/lms.yml. If you’re using private.py, add these values to lms/envs/private.py. These should be added to the top level. Ask a fellow developer or devops for these values.

    MARKETING_SITE_CHECKOUT_URL = <MARKETING_SITE_CHECKOUT_URL>  # The URL of checkout/cart API in your marketing site
    ECOMMERCE_PUBLIC_URL_ROOT = <LMS_BASE_URL>  # Because we want to use external ecommerce using this API plugin for redirection
  • For Tutor installations, these values can also be managed through a custom tutor plugin.

2) edx-platform configuration (Django Admin)

1. Create a new ecommerce configuration in http://<LMS_BASE>/admin/commerce/commerceconfiguration with following values:

    a. Set value for "Basket checkout page" to "/checkout-external/". (When set, the ecommerce will redirect the `Upgrade Course` requests to this plugin)

    b. "Enabled" checked.

    c. "Checkout on ecommerce service" checked.

    d. Other values are arbitrary, but you can fill them out as per your need.

2. Make sure to create CourseModes(e.g. "Verified") for the courses with non-empty and unique SKU value.

How To Use

The API supports a GET call with SKU as query parameter.

API Request

To manually call the API, Send a GET request to <LMS_BASE>/checkout-external?sku=<sku_id>:

A sample request looks like below:

http://local.openedx.io:8000/checkout-external?sku=ABC45F

API Response

The successful response would be a redirect to the marketing site with 302 status code and a failure response would be a 400 status code with basic error fields.

With 302 status code (If your marketing checkout URL is "https://<marketing_site_base>/checkout") the resulting redirect would be:

https://<marketing_site_base>/checkout/?course_id=<course_id against the sku in CourseMode>
With 400 status code

{
    "developer_message": "<Message for the developer>",
    "error_code": "internal_error"
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ol_openedx_checkout_external-0.2.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ol_openedx_checkout_external-0.2.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file ol_openedx_checkout_external-0.2.0.tar.gz.

File metadata

File hashes

Hashes for ol_openedx_checkout_external-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4fa146b8986240f469747db7d521029bb775a9dd2658ab76cd26e00ac0b8ce93
MD5 3cb33126290b280415f84aca79c8b8bb
BLAKE2b-256 a49dad5b9950233ed96613b694454df7491b71a22d4b5b9e0dbe0b0cb756bcc4

See more details on using hashes here.

File details

Details for the file ol_openedx_checkout_external-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ol_openedx_checkout_external-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8958c067af325b5b41019262efcabbdb4e6bf529e712488b5c1bfc97ed0f2c7a
MD5 8934e296692be1d7af389e3e351b79cb
BLAKE2b-256 97348c0ac768b16271d5b597480624364ce37ace4d36c88cb66dc92cc7d4a02b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page