django-oscar-api-checkout


Namedjango-oscar-api-checkout JSON
Version 3.6.1 PyPI version JSON
download
home_pageNone
SummaryAn extension on top of django-oscar-api providing a more flexible checkout API with a pluggable payment methods interface.
upload_time2025-01-23 18:34:33
maintainerNone
docs_urlNone
authorthelab
requires_python<4.0,>=3.12
licenseISC
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =========================
django-oscar-api-checkout
=========================

|  |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.

.. |build| image:: https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout/badges/master/pipeline.svg
    :target: https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout/commits/master
.. |coverage| image:: https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout/badges/master/coverage.svg
    :target: https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout/commits/master
.. |license| image:: https://img.shields.io/pypi/l/django-oscar-api-checkout.svg
    :target: https://pypi.python.org/pypi/django-oscar-api-checkout
.. |kit| image:: https://badge.fury.io/py/django-oscar-api-checkout.svg
    :target: https://pypi.python.org/pypi/django-oscar-api-checkout
.. |format| image:: https://img.shields.io/pypi/format/django-oscar-api-checkout.svg
    :target: https://pypi.python.org/pypi/django-oscar-api-checkout


Compatible Payment Plugins
==========================

- `django-oscar-cybersource <https://gitlab.com/thelabnyc/django-oscar/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 <https://gitlab.com/thelabnyc/django-oscar/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 <https://django-oscar-api.readthedocs.io/en/latest/#installation>`_.

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/


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-oscar-api-checkout",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.12",
    "maintainer_email": null,
    "keywords": null,
    "author": "thelab",
    "author_email": "thelabdev@thelab.co",
    "download_url": "https://files.pythonhosted.org/packages/26/9e/08b967686458cf28381e8582efe2019a8b5c43b13e22e712371c84025099/django_oscar_api_checkout-3.6.1.tar.gz",
    "platform": null,
    "description": "=========================\ndjango-oscar-api-checkout\n=========================\n\n|  |build| |coverage| |license| |kit| |format|\n\nAn extension on top of django-oscar-api providing a more flexible checkout API with a pluggable payment methods interface.\n\n.. |build| image:: https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout/badges/master/pipeline.svg\n    :target: https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout/commits/master\n.. |coverage| image:: https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout/badges/master/coverage.svg\n    :target: https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout/commits/master\n.. |license| image:: https://img.shields.io/pypi/l/django-oscar-api-checkout.svg\n    :target: https://pypi.python.org/pypi/django-oscar-api-checkout\n.. |kit| image:: https://badge.fury.io/py/django-oscar-api-checkout.svg\n    :target: https://pypi.python.org/pypi/django-oscar-api-checkout\n.. |format| image:: https://img.shields.io/pypi/format/django-oscar-api-checkout.svg\n    :target: https://pypi.python.org/pypi/django-oscar-api-checkout\n\n\nCompatible Payment Plugins\n==========================\n\n- `django-oscar-cybersource <https://gitlab.com/thelabnyc/django-oscar/django-oscar-cybersource>`_: Provides order payment using Cybersource Secure Acceptance Silent Order POST for PCI SAQ A-EP compliant credit card processing.\n- `django-oscar-wfrs <https://gitlab.com/thelabnyc/django-oscar/django-oscar-wfrs>`_: Provides order payment using financing via the Wells Fargo Retail Services SOAP API.\n\n\nInstallation\n============\n\n1. Install `django-oscar-api` using the `documentation <https://django-oscar-api.readthedocs.io/en/latest/#installation>`_.\n\n2. Install the `django-oscar-api-checkout` package.::\n\n    $ pip install django-oscar-api-checkout\n\n3. Add `oscarapicheckout` to your `INSTALLED_APPS`::\n\n    # myproject/settings.py\n    ...\n    INSTALLED_APPS = [\n        ...\n        'oscarapicheckout',\n    ] + get_core_apps([])\n    ...\n\n4. Configure Oscar's order status pipeline.::\n\n    # myproject/settings.py\n    ...\n    # Needed by oscarapicheckout\n    ORDER_STATUS_PENDING = 'Pending'\n    ORDER_STATUS_PAYMENT_DECLINED = 'Payment Declined'\n    ORDER_STATUS_AUTHORIZED = 'Authorized'\n\n    # Other statuses\n    ORDER_STATUS_SHIPPED = 'Shipped'\n    ORDER_STATUS_CANCELED = 'Canceled'\n\n    # Pipeline Config\n    OSCAR_INITIAL_ORDER_STATUS = ORDER_STATUS_PENDING\n    OSCARAPI_INITIAL_ORDER_STATUS = ORDER_STATUS_PENDING\n    OSCAR_ORDER_STATUS_PIPELINE = {\n        ORDER_STATUS_PENDING: (ORDER_STATUS_PAYMENT_DECLINED, ORDER_STATUS_AUTHORIZED, ORDER_STATUS_CANCELED),\n        ORDER_STATUS_PAYMENT_DECLINED: (ORDER_STATUS_AUTHORIZED, ORDER_STATUS_CANCELED),\n        ORDER_STATUS_AUTHORIZED: (ORDER_STATUS_SHIPPED, ORDER_STATUS_CANCELED),\n        ORDER_STATUS_SHIPPED: (),\n        ORDER_STATUS_CANCELED: (),\n    }\n\n    OSCAR_INITIAL_LINE_STATUS = ORDER_STATUS_PENDING\n    OSCAR_LINE_STATUS_PIPELINE = {\n        ORDER_STATUS_PENDING: (ORDER_STATUS_SHIPPED, ORDER_STATUS_CANCELED),\n        ORDER_STATUS_SHIPPED: (),\n        ORDER_STATUS_CANCELED: (),\n    }\n\n5. Configure what payment methods are enabled and who can use them.::\n\n    # myproject/settings.py\n    ...\n    API_ENABLED_PAYMENT_METHODS = [\n        {\n            'method': 'oscarapicheckout.methods.Cash',\n            'permission': 'oscarapicheckout.permissions.StaffOnly',\n        },\n        {\n            'method': 'some.other.methods.CreditCard',\n            'permission': 'oscarapicheckout.permissions.Public',\n        },\n    ]\n\n6. Add `oscarapicheckout` to your root URL configuration directly before oscarapi.::\n\n    # myproject/urls.py\n    ...\n    from django.apps import apps\n    from oscarapi.app import application as oscar_api\n    from oscarapicheckout.app import application as oscar_api_checkout\n\n    urlpatterns = patterns('',\n        ...\n        url(r'^api/', include(apps.get_app_config(\"oscarapicheckout\").urls[0])), # Must be before oscar_api.urls\n        url(r'^api/', include(oscar_api.urls)),\n        ...\n    )\n\n\nUsage\n=====\n\nThese are the basic steps to add an item to the basket and checkout using the API.\n\n1. Add an item to the basket.::\n\n    POST /api/basket/add-product/\n\n    {\n        \"url\": \"/api/products/1/\",\n        \"quantity\": 1\n    }\n\n\n2. List the payment methods available to the current user.::\n\n    GET /api/checkout/payment-methods/\n\n3. Submit the order, specifying which payment method(s) to use.::\n\n    POST /api/checkout/\n\n    {\n        \"guest_email\": \"joe@example.com\",\n        \"basket\": \"/api/baskets/1/\",\n        \"shipping_address\": {\n            \"first_name\": \"Joe\",\n            \"last_name\": \"Schmoe\",\n            \"line1\": \"234 5th Ave\",\n            \"line4\": \"Manhattan\",\n            \"postcode\": \"10001\",\n            \"state\": \"NY\",\n            \"country\": \"/api/countries/US/\",\n            \"phone_number\": \"+1 (717) 467-1111\",\n        },\n        \"billing_address\": {\n            \"first_name\": \"Joe\",\n            \"last_name\": \"Schmoe\",\n            \"line1\": \"234 5th Ave\",\n            \"line4\": \"Manhattan\",\n            \"postcode\": \"10001\",\n            \"state\": \"NY\",\n            \"country\": \"/api/countries/US/\",\n            \"phone_number\": \"+1 (717) 467-1111\",\n        },\n        \"payment\": {\n            \"cash\": {\n                \"enabled\": true,\n                \"amount\": \"10.00\",\n            },\n            \"creditcard\": {\n                \"enabled\": true,\n                \"pay_balance\": true,\n            }\n        }\n    }\n\n4. Check the status of each enabled payment option.::\n\n    GET /api/checkout/payment-states/\n\n",
    "bugtrack_url": null,
    "license": "ISC",
    "summary": "An extension on top of django-oscar-api providing a more flexible checkout API with a pluggable payment methods interface.",
    "version": "3.6.1",
    "project_urls": {
        "Homepage": "https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout",
        "Repository": "https://gitlab.com/thelabnyc/django-oscar/django-oscar-api-checkout"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2078d2971ad64aba0a4936522c3bc6fc0a7813703d5faed108018056b2340dc5",
                "md5": "95a2cb79d023819bb0fc5919f817d3ba",
                "sha256": "8de49385472524469064a9dd2f768cafe125783124bdd761f13fcb3c2671307d"
            },
            "downloads": -1,
            "filename": "django_oscar_api_checkout-3.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "95a2cb79d023819bb0fc5919f817d3ba",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.12",
            "size": 42763,
            "upload_time": "2025-01-23T18:34:30",
            "upload_time_iso_8601": "2025-01-23T18:34:30.707933Z",
            "url": "https://files.pythonhosted.org/packages/20/78/d2971ad64aba0a4936522c3bc6fc0a7813703d5faed108018056b2340dc5/django_oscar_api_checkout-3.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "269e08b967686458cf28381e8582efe2019a8b5c43b13e22e712371c84025099",
                "md5": "266fa9cf1c0a86261ebd768570de96c7",
                "sha256": "ea550b03674a0b6e159cb30e22c3ed37b3e7b5f41817fc3888d3f74a88857895"
            },
            "downloads": -1,
            "filename": "django_oscar_api_checkout-3.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "266fa9cf1c0a86261ebd768570de96c7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.12",
            "size": 34248,
            "upload_time": "2025-01-23T18:34:33",
            "upload_time_iso_8601": "2025-01-23T18:34:33.203974Z",
            "url": "https://files.pythonhosted.org/packages/26/9e/08b967686458cf28381e8582efe2019a8b5c43b13e22e712371c84025099/django_oscar_api_checkout-3.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-23 18:34:33",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "thelabnyc",
    "gitlab_project": "django-oscar",
    "lcname": "django-oscar-api-checkout"
}
        
Elapsed time: 0.42556s