Package: django-oscar-api-checkout
An extension on top of django-oscar-api providing a more flexible checkout API with a pluggable payment methods interface.Compatible Payment Pluginsdjango-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.InstallationInstalldjango-oscar-apiusing thedocumentation.Install thedjango-oscar-api-checkoutpackage.:$ pip install django-oscar-api-checkoutAddoscarapicheckoutto yourINSTALLED_APPS:# myproject/settings.py
...
INSTALLED_APPS = [
    ...
    'oscarapicheckout',
] + get_core_apps([])
...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: (),
}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',
    },
]Addoscarapicheckoutto 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)),
    ...
)UsageThese are the basic steps to add an item to the basket and checkout using the API.Add an item to the basket.:POST /api/basket/add-product/

{
    "url": "/api/products/1/",
    "quantity": 1
}List the payment methods available to the current user.:GET /api/checkout/payment-methods/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,
        }
    }
}Check the status of each enabled payment option.:GET /api/checkout/payment-states/Changelog3.2.0Add support for django-oscar 3.2.2Add support for django 4.23.1.1Fix bug where, on occasion,OrderUpdaterwould try to decrementVoucher.num_ordersbelow 0.3.1.0Add new “Pay Later” deferred payment functionality.3.0.0Oscar 3.0 Compatibility2.0.01.1.0Add support for calculating taxes on shipping charges.Fix bug withVoucher.num_ordersvalue when retrying payment declined orders.1.0.0Remove direct dependency onphonenumberslitesince it’s actually a dependency ofdjango-oscar.0.6.0Add support for django-oscar 2.x.Drop support for django-oscar 1.x.0.5.2Internationalization0.5.1Add new permission:oscarapicheckout.permissions.CustomerOnly0.5.0Make payment methods create separatepayment.Sourceobjects per Reference number (!6).Delete Voucher applications upon payment decline, rather than waiting for an order placement retry. This fixes issues associated with payment declined orders consuming vouchers.0.4.1Fixed bug that prevented transitioning an order fromPayment DeclinedtoAuthorizedif the payment type was changed.0.4.0Improved split-pay support by allowing multiple payments of the same type. E.g. two credit cards, etc.[Important]To accomplish this, the payment provider plug-in interface changed slightly. Plugins must be updated to support the new interface. The REST API front-end added parameters, but retained backwards compatibility with0.3.x.Fixed bug caused by changing the status of a Payment Declined order (e.g. to Canceled) caused checkout to break for the customer, because they were now editable a basket connected to a non-payment-declined order. Fixes the bug by setting a basket to “Submitted” status whenever the order status transitions from “Payment Declined” to another status.0.3.4Fix Django 2.0 Deprecation warnings.0.3.3Add validation to checkout API to prevent placing an order for an item that went out of stock after the item was added to the customer’s basket.0.3.2Fix issue in Python 3 whenOrderCreator.place_orderraises aValueErrorexception.Fix bug occurring in Oscar 1.5 when vouchers can be used by the user placing an order, but not by the order owner.0.3.1Add support for Django 1.11 and Oscar 1.50.3.0Add helper classes for caching structured data during a multi-step checkout process.Seeoscarapicheckout.cachemodule for details.Doesn’t yet include API views for editing or view such data.Currently includes classes for storing email address, shipping address, billing address, and shipping method.Required [Django Cache](https://docs.djangoproject.com/en/dev/topics/cache/) framework to be configured.0.2.7[Important]Fix bug introduced inr0.2.6with multi-step payment methods when retrying a payment decline.0.2.6[Important]Fix bug causing mismatch betweenOrder.userandBasket.ownerwhen, during placement, the order ownership calculator assigns the order to a user other than the basket owner. Now, after creating the order model, the owner of the basket associated with the order is updated to match the order’s owner.Make it possible to set theORDER_OWNERSHIP_CALCULATORto a callable or a string instead of just a string.0.2.5Improve testing by using tox in the CI runner.0.2.4Upgrade dependencies.0.2.3Make the order in which signals are sent during checkout consistent for synchronous and asynchronous payment methods.Previously a synchronous payment method resulted in sendingorder_payment_authorizedbefore sendingorder_placed, but an asynchronous payment method would triggerorder_placedfirst followed byorder_payment_authorized(on a subsequent HTTP request). They are still different in terms of synchronous payment methods firing both signals on the same request and asynchronous payment methods triggering them on different request, but at least now they are always fired in the same order:order_placedfirst followed byorder_payment_authorized.0.2.2Require an email address during checkout0.2.1Explicitly dis-allow cache on API views0.2.0Add setting to allow configuring how many payment types may be used on an orderAdd hook for setting the ownership information on an order during placementPrevent PaymentEvent.reference from ever being None0.1.5Fix bug where order number wouldn’t be recycled for a declined order0.1.4Add context to payment method serializers0.1.3Simplify dependencies0.1.2Allow PaymentMethods to handle 0.00-amount transactions0.1.1Send confirmation message upon order authorizationAdd pep8 linting0.1.0Initial release.