Checkout & payment

To enable basket checkout you need to define a payment method in SALESMAN_PAYMENT_METHODS setting which accepts a list of dotted paths to salesman.checkout.payment.PaymentMethod classes.


For this example, we assume your custom app is named shop.

1. Create payment method

First create your custom payment method. Payment methods are required to specify a label and a unique identifier property on class. To enable payment for the basket you should also override the salesman.checkout.payment.PaymentMethod.basket_payment() method. Eg:

from django.urls import reverse

from salesman.checkout.payment import PaymentMethod
from shop.models import Order

class PayInAdvance(PaymentMethod):
    Payment method that requires advance payment via bank account.

    identifier = "pay-in-advance"
    label = "Pay in advance"

    def basket_payment(self, basket, request):
        Create a new order and mark it on-hold. Reserve items from stock and await
        manual payment from customer via back account. When paid order status should be
        changed to `PROCESSING`, `SHIPPED` or `COMPLETED` and a new payment should be
        added to order.
        order = Order.objects.create_from_basket(basket, request, status="HOLD")
        url = reverse("salesman-order-last") + f"?token={order.token}"
        return request.build_absolute_uri(url)

2. Register payment method

Then register your payment method in


Now you can make a basket purchase through the POST /checkout/ request with payment_method set to pay-in-advance.

For more information about payment methods see Payment methods.

Anonymous checkout

By default anonymous users can checkout. To prevent this behavior set SALESMAN_ALLOW_ANONYMOUS_USER_CHECKOUT = False.