Skip to main content
build coverage license kit format

An extension on top of django-oscar-api providing a more flexible checkout API with a pluggable payment methods interface.

Compatible Payment Plugins

  • django-oscar-cybersource: Provides order payment using Cybersource Secure Acceptance Silent Order POST for PCI SAQ A-EP compliant credit card processing.

  • django-oscar-wfrs: Provides order payment using financing via the Wells Fargo Retail Services SOAP API.

Installation

  1. Install django-oscar-api using the documentation.

  2. Install the django-oscar-api-checkout package.:

    $ pip install django-oscar-api-checkout
  3. Add oscarapicheckout to your INSTALLED_APPS:

    # myproject/settings.py
    ...
    INSTALLED_APPS = [
        ...
        'oscarapicheckout',
    ] + get_core_apps([])
    ...
  4. Configure Oscar’s order status pipeline.:

    # myproject/settings.py
    ...
    # Needed by oscarapicheckout
    ORDER_STATUS_PENDING = 'Pending'
    ORDER_STATUS_PAYMENT_DECLINED = 'Payment Declined'
    ORDER_STATUS_AUTHORIZED = 'Authorized'
    
    # Other statuses
    ORDER_STATUS_SHIPPED = 'Shipped'
    ORDER_STATUS_CANCELED = 'Canceled'
    
    # Pipeline Config
    OSCAR_INITIAL_ORDER_STATUS = ORDER_STATUS_PENDING
    OSCARAPI_INITIAL_ORDER_STATUS = ORDER_STATUS_PENDING
    OSCAR_ORDER_STATUS_PIPELINE = {
        ORDER_STATUS_PENDING: (ORDER_STATUS_PAYMENT_DECLINED, ORDER_STATUS_AUTHORIZED, ORDER_STATUS_CANCELED),
        ORDER_STATUS_PAYMENT_DECLINED: (ORDER_STATUS_AUTHORIZED, ORDER_STATUS_CANCELED),
        ORDER_STATUS_AUTHORIZED: (ORDER_STATUS_SHIPPED, ORDER_STATUS_CANCELED),
        ORDER_STATUS_SHIPPED: (),
        ORDER_STATUS_CANCELED: (),
    }
    
    OSCAR_INITIAL_LINE_STATUS = ORDER_STATUS_PENDING
    OSCAR_LINE_STATUS_PIPELINE = {
        ORDER_STATUS_PENDING: (ORDER_STATUS_SHIPPED, ORDER_STATUS_CANCELED),
        ORDER_STATUS_SHIPPED: (),
        ORDER_STATUS_CANCELED: (),
    }
  5. Configure what payment methods are enabled and who can use them.:

    # myproject/settings.py
    ...
    API_ENABLED_PAYMENT_METHODS = [
        {
            'method': 'oscarapicheckout.methods.Cash',
            'permission': 'oscarapicheckout.permissions.StaffOnly',
        },
        {
            'method': 'some.other.methods.CreditCard',
            'permission': 'oscarapicheckout.permissions.Public',
        },
    ]
  6. Add oscarapicheckout to your root URL configuration directly before oscarapi.:

    # myproject/urls.py
    ...
    from django.apps import apps
    from oscarapi.app import application as oscar_api
    from oscarapicheckout.app import application as oscar_api_checkout
    
    urlpatterns = patterns('',
        ...
        url(r'^api/', include(apps.get_app_config("oscarapicheckout").urls[0])), # Must be before oscar_api.urls
        url(r'^api/', include(oscar_api.urls)),
        ...
    )

Usage

These are the basic steps to add an item to the basket and checkout using the API.

  1. Add an item to the basket.:

    POST /api/basket/add-product/
    
    {
        "url": "/api/products/1/",
        "quantity": 1
    }
  2. List the payment methods available to the current user.:

    GET /api/checkout/payment-methods/
  3. Submit the order, specifying which payment method(s) to use.:

    POST /api/checkout/
    
    {
        "guest_email": "joe@example.com",
        "basket": "/api/baskets/1/",
        "shipping_address": {
            "first_name": "Joe",
            "last_name": "Schmoe",
            "line1": "234 5th Ave",
            "line4": "Manhattan",
            "postcode": "10001",
            "state": "NY",
            "country": "/api/countries/US/",
            "phone_number": "+1 (717) 467-1111",
        },
        "billing_address": {
            "first_name": "Joe",
            "last_name": "Schmoe",
            "line1": "234 5th Ave",
            "line4": "Manhattan",
            "postcode": "10001",
            "state": "NY",
            "country": "/api/countries/US/",
            "phone_number": "+1 (717) 467-1111",
        },
        "payment": {
            "cash": {
                "enabled": true,
                "amount": "10.00",
            },
            "creditcard": {
                "enabled": true,
                "pay_balance": true,
            }
        }
    }
  4. Check the status of each enabled payment option.:

    GET /api/checkout/payment-states/

Download files

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

Source Distribution

django_oscar_api_checkout-3.10.0.tar.gz (127.9 kB view details)

Uploaded Source

Built Distribution

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

django_oscar_api_checkout-3.10.0-py3-none-any.whl (44.6 kB view details)

Uploaded Python 3

File details

Details for the file django_oscar_api_checkout-3.10.0.tar.gz.

File metadata

File hashes

Hashes for django_oscar_api_checkout-3.10.0.tar.gz
Algorithm Hash digest
SHA256 4c49eb62e07bddce433d86435af20bd7480bddad8211db8ba6319f31d193a838
MD5 f6ffb69f1ddf241d847093be8bf4c41b
BLAKE2b-256 e7d5c9b55cd314a8e28999a150de12ba8e4565cee18a00367cc0320a91582863

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_oscar_api_checkout-3.10.0.tar.gz:

Publisher: .gitlab-ci.yml on thelabnyc/django-oscar/django-oscar-api-checkout

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_oscar_api_checkout-3.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_oscar_api_checkout-3.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b63a8ecff4ea8ea54e9250b4fdd1fd2d9d899b0910f0422af96e425b26fdc558
MD5 23c872cb8231d36f28c9527ccb775b5f
BLAKE2b-256 213ffc05212ff058324fb62f7dce393ba1d99ea6f3ddc67eaf5a9b1f69b5f0a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_oscar_api_checkout-3.10.0-py3-none-any.whl:

Publisher: .gitlab-ci.yml on thelabnyc/django-oscar/django-oscar-api-checkout

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

3.10.1

2 files

This release

3.10.0 This release

2 files

3.9.1

2 files

3.9.0

2 files

3.8.1

2 files

3.8.0

2 files

3.7.0

2 files

3.6.3

2 files

3.6.2

2 files

3.6.1

2 files

3.5.1

2 files

3.5.0

2 files

3.4.1

2 files

3.4.0

2 files

3.3.1

2 files

3.3.0

2 files

3.2.0.post2

2 files

3.2.0

2 files

3.1.1

2 files

3.1.0

2 files

3.0.0

2 files

2.0.0

2 files

1.1.0

2 files

1.0.0

2 files

0.6.0

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page