5. Provided backends¶
5.1. Dummy¶
-
class
payments.dummy.
DummyProvider
¶ 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¶
This backend implements payments using the Advanced Integration Method (AIM) from Authorize.Net.
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'})}
This backend does not support fraud detection.
5.3. Braintree¶
-
class
payments.braintree.
BraintreeProvider
(merchant_id, public_key, private_key[, sandbox=True])¶ This backend implements payments using Braintree.
Parameters: - merchant_id – Merchant ID assigned by Braintree
- public_key – Public key assigned by Braintree
- private_key – Private key assigned by Braintree
- sandbox – Whether to use a sandbox environment for testing
Example:
# use sandbox
PAYMENT_VARIANTS = {
'braintree': ('payments.braintree.BraintreeProvider', {
'merchant_id': '112233445566',
'public_key': '1234567890abcdef',
'private_key': 'abcdef123456',
'sandbox': True})}
This backend does not support fraud detection.
5.4. Coinbase¶
-
class
payments.coinbase.
CoinbaseProvider
(key, secret[, endpoint='sandbox.coinbase.com'])¶ This backend implements payments using Coinbase.
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
Example:
# use sandbox
PAYMENT_VARIANTS = {
'coinbase': ('payments.coinbase.CoinbaseProvider', {
'key': '123abcd',
'secret': 'abcd1234',
'endpoint': 'sandbox.coinbase.com'})}
This backend does not support fraud detection.
5.5. Cybersource¶
-
class
payments.cybersource.
CyberSourceProvider
(merchant_id, password[, org_id=None, fingerprint_url='https://h.online-metrix.net/fp/', sandbox=True, capture=True])¶ This backend implements payments using Cybersource.
Parameters: - merchant_id – Your Merchant ID
- password – Generated transaction security key for the SOAP toolkit
- org_id – Provide this parameter to enable Cybersource Device Fingerprinting
- fingerprint_url – Address of the fingerprint server
- sandbox – Whether to use a sandbox environment for testing
- capture – Whether to capture the payment automatically. See Authorization and capture for more details.
Example:
# use sandbox
PAYMENT_VARIANTS = {
'cybersource': ('payments.cybersource.CyberSourceProvider', {
'merchant_id': 'example',
'password': '1234567890abcdef',
'capture': False,
'sandbox': True})}
This backend supports fraud detection.
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[, channel=0, lock=False, lang='pl', endpoint='https://ssl.dotpay.pl/test_payment/'])¶ This backend implements payments using a popular Polish gateway, Dotpay.pl.
Due to API limitations there is no support for transferring purchased items.
Parameters: - seller_id – Seller ID assigned by Dotpay
- pin – PIN assigned by Dotpay
- channel – Default payment channel (consult reference guide)
- 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
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/'})}
This backend does not support fraud detection.
5.7. Google Wallet¶
-
class
payments.wallet.
GoogleWalletProvider
(seller_id, seller_secret[, library='https://sandbox.google.com/checkout/inapp/lib/buy.js'])¶ This backend implements payments using Google Wallet for digital goods API.
Parameters: - seller_id – Seller ID assigned by Google Wallet
- seller_secret – Seller secret assigned by Google Wallet
- library – The API library to use. For the production environment, use
'https://wallet.google.com/inapp/lib/buy.js'
instead
Example:
# use sandbox
PAYMENT_VARIANTS = {
'wallet': ('payments.wallet.GoogleWalletProvider', {
'seller_id': '112233445566',
'seller_secret': '1234567890abcdef',
'library': 'https://sandbox.google.com/checkout/inapp/lib/buy.js'})}
This backend requires js files that should be added to the template using {{ form.media }}
e.g:
<!-- templates/payment.html -->
<form action="{{ form.action }}" method="{{ form.method }}">
{{ form.as_p }}
<p><input type="submit" value="Proceed" /></p>
</form>
{{ form.media }}
To specify the postback URL at the Merchant Settings page use direct url to process payment view in conjunction with your variant name:
E.g: https://example.com/payments/process/wallet
This backend does not support fraud detection.
5.8. PayPal¶
-
class
payments.paypal.
PaypalProvider
(client_id, secret[, endpoint='https://api.sandbox.paypal.com', capture=True])¶ 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'])¶ This backend implements payments using PayPal.com but the credit card data is collected by your site.
Parameters are identical to those of
payments.paypal.PaypalProvider
.
Example:
PAYMENT_VARIANTS = {
'paypal': ('payments.paypal.PaypalCardProvider', {
'client_id': 'user@example.com',
'secret': 'iseedeadpeople'})}
This backend does not support fraud detection.
5.9. Sage Pay¶
-
class
payments.sagepay.
SagepayProvider
(vendor, encryption_key[, endpoint='https://test.sagepay.com/Simulator/VSPFormGateway.asp'])¶ This backend implements payments using SagePay.com Form API.
Purchased items are not currently transferred.
Parameters: - vendor – Your vendor code
- encryption_key – Encryption key assigned by Sage Pay
- endpoint – The API endpoint to use. For the production environment, use
'https://live.sagepay.com/gateway/service/vspform-register.vsp'
instead
Example:
# use simulator
PAYMENT_VARIANTS = {
'sage': ('payments.sagepay.SagepayProvider', {
'vendor': 'example',
'encryption_key': '1234567890abcdef',
'endpoint': 'https://test.sagepay.com/Simulator/VSPFormGateway.asp'})}
This backend does not support fraud detection.
5.10. Sofort.com¶
-
class
payments.sofort.
SofortProvider
(key, id, project_id[, endpoint='https://api.sofort.com/api/xml'])¶ This backend implements payments using sofort.com <https://www.sofort.com/> API.
Parameters: - id – Your sofort.com user id
- key – Your secret key
- project_id – Your sofort.com project id
- endpoint – The API endpoint to use.
Example:
PAYMENT_VARIANTS = {
'sage': ('payments.sofort.SofortProvider', {
'id': '123456',
'key': '1234567890abcdef',
'project_id': '654321',
'endpoint': 'https://api.sofort.com/api/xml'})}
This backend does not support fraud detection.
5.11. Stripe¶
-
class
payments.stripe.
StripeProvider
(secret_key, public_key)¶ This backend implements payments using Stripe.
Parameters: - secret_key – Secret key assigned by Stripe.
- public_key – Public key assigned by Stripe.
- name – A friendly name for your store.
- image – Your logo.
Example:
# use sandbox
PAYMENT_VARIANTS = {
'stripe': ('payments.stripe.StripeProvider', {
'secret_key': 'sk_test_123456',
'public_key': 'pk_test_123456'})}
This backend does not support fraud detection.