5. Provided backends

These are the payment provider implementations included in this package. Note that you should not usually instantiate these yourself, but use provider_factory() instead.

5.1. Dummy

class payments.dummy.DummyProvider(capture=True)

Dummy payment provider.

This is a dummy backend suitable for testing your store without contacting any payment gateways. Instead of using an external service it will simply show you a form that allows you to confirm or reject the payment.

Example:

PAYMENT_VARIANTS = {
    'dummy': ('payments.dummy.DummyProvider', {})}

5.2. Authorize.Net

class payments.authorizenet.AuthorizeNetProvider(login_id, transaction_key, endpoint='https://test.authorize.net/gateway/transact.dll', **kwargs)

Payment provider for Authorize.Net.

This backend implements payments using the Advanced Integration Method (AIM) from Authorize.Net.

This backend does not support fraud detection.

Parameters:
  • login_id – Your API Login ID assigned by Authorize.net
  • transaction_key – Your unique Transaction Key assigned by Authorize.net
  • endpoint – The API endpoint to use. For the production environment, use 'https://secure.authorize.net/gateway/transact.dll' instead.

Example:

# use staging environment
PAYMENT_VARIANTS = {
    'authorizenet': ('payments.authorizenet.AuthorizeNetProvider', {
        'login_id': '1234login',
        'transaction_key': '1234567890abcdef',
        'endpoint': 'https://test.authorize.net/gateway/transact.dll'})}

5.3. Braintree

Example:

# use sandbox
PAYMENT_VARIANTS = {
    'braintree': ('payments.braintree.BraintreeProvider', {
        'merchant_id': '112233445566',
        'public_key': '1234567890abcdef',
        'private_key': 'abcdef123456',
        'sandbox': True})}

5.4. Coinbase

class payments.coinbase.CoinbaseProvider(key, secret, endpoint='sandbox.coinbase.com', **kwargs)

Payment provider for coinbase.

This backend implements payments using Coinbase.

This backend does not support fraud detection.

Parameters:
  • key – Api key generated by Coinbase
  • secret – Api secret generated by Coinbase
  • endpoint – Coinbase endpoint domain to use. For the production environment, use 'coinbase.com' instead
__init__(key, secret, endpoint='sandbox.coinbase.com', **kwargs)

Create a new provider instance.

This method should not be called directly; use provider_factory() instead.

Example:

# use sandbox
PAYMENT_VARIANTS = {
    'coinbase': ('payments.coinbase.CoinbaseProvider', {
        'key': '123abcd',
        'secret': 'abcd1234',
        'endpoint': 'sandbox.coinbase.com'})}

5.5. Cybersource

Example:

# use sandbox
PAYMENT_VARIANTS = {
    'cybersource': ('payments.cybersource.CyberSourceProvider', {
        'merchant_id': 'example',
        'password': '1234567890abcdef',
        'capture': False,
        'sandbox': True})}

5.5.1. Merchant-Defined Data

Cybersource allows you to pass Merchant-Defined Data, which is additional information about the payment or the order, such as an order number, additional customer information, or a special comment or request from the customer. This can be accomplished by passing your data to the Payment instance:

>>> payment.attrs.merchant_defined_data = {'01': 'foo', '02': 'bar'}

5.6. Dotpay

class payments.dotpay.DotpayProvider(seller_id, pin, endpoint='https://ssl.dotpay.pl/test_payment/', channel=0, channel_groups=None, ignore_last_payment_channel=False, lang='pl', lock=False, type=2, **kwargs)

Payment provider for dotpay.pl

This backend implements payments using a popular Polish gateway, Dotpay.pl.

Due to API limitations there is no support for transferring purchased items.

This backend does not support fraud detection.

Parameters:
  • seller_id – Seller ID assigned by Dotpay
  • pin – PIN assigned by Dotpay
  • channel – Default payment channel (consult reference guide). Ignored if channel_groups is set.
  • channel_groups – Payment channels to choose from (consult reference guide). Overrides channel.
  • lang – UI language
  • lock – Whether to disable channels other than the default selected above
  • endpoint – The API endpoint to use. For the production environment, use 'https://ssl.dotpay.pl/' instead
  • ignore_last_payment_channel – Display default channel or channel groups instead of last used channel.
  • type – Determines what should be displayed after payment is completed (consult reference guide).

Example:

# use defaults for channel and lang but lock available channels
PAYMENT_VARIANTS = {
    'dotpay': ('payments.dotpay.DotpayProvider', {
        'seller_id': '123',
        'pin': '0000',
        'lock': True,
        'endpoint': 'https://ssl.dotpay.pl/test_payment/'})}

5.7. PayPal

class payments.paypal.PaypalProvider(client_id, secret, endpoint='https://api.sandbox.paypal.com', capture=True)

Payment provider for Paypal, redirection-based.

This backend implements payments using PayPal.com.

Parameters:
  • client_id – Client ID assigned by PayPal or your email address
  • secret – Secret assigned by PayPal
  • endpoint – The API endpoint to use. For the production environment, use 'https://api.paypal.com' instead
  • capture – Whether to capture the payment automatically. See Authorization and capture for more details.

Example:

# use sandbox
PAYMENT_VARIANTS = {
    'paypal': ('payments.paypal.PaypalProvider', {
        'client_id': 'user@example.com',
        'secret': 'iseedeadpeople',
        'endpoint': 'https://api.sandbox.paypal.com',
        'capture': False})}
class payments.paypal.PaypalCardProvider(client_id, secret, endpoint='https://api.sandbox.paypal.com', capture=True)

Payment provider for Paypal, form-based.

This backend implements payments using PayPal.com but the credit card data is collected by your site.

Parameters are the same as PaypalProvider.

This backend does not support fraud detection.

Example:

PAYMENT_VARIANTS = {
    'paypal': ('payments.paypal.PaypalCardProvider', {
        'client_id': 'user@example.com',
        'secret': 'iseedeadpeople'})}

5.8. Sage Pay

Example:

# use simulator
PAYMENT_VARIANTS = {
    'sage': ('payments.sagepay.SagepayProvider', {
        'vendor': 'example',
        'encryption_key': '1234567890abcdef',
        'endpoint': 'https://test.sagepay.com/Simulator/VSPFormGateway.asp'})}

5.9. Sofort / Klarna

Example:

PAYMENT_VARIANTS = {
    'sage': ('payments.sofort.SofortProvider', {
        'id': '123456',
        'key': '1234567890abcdef',
        'project_id': '654321',
        'endpoint': 'https://api.sofort.com/api/xml'})}

5.10. Stripe

Example:

# use sandbox
PAYMENT_VARIANTS = {
    'stripe': ('payments.stripe.StripeProvider', {
        'secret_key': 'sk_test_123456',
        'public_key': 'pk_test_123456'})}

5.11. MercadoPago

Example:

PAYMENT_VARIANTS: = {
    "mercadopago": (
        "payments.mercadopago.MercadoPagoProvider",
        {
            "access_token": "APP_USR-3453454363464444-645434-7f8da79f8da7f98ad7f98ad7f98df78e-454545466",
            "sandbox": DEBUG,
        },
    ),
}

Note that the API sandbox does not return Payment details, so all payments will seem unpaid.