Python SDK

The Buckaroo Python SDK is an open source library that connects a Python application to the Buckaroo API.

It handles authentication, request signing and response parsing, so you can start payments, verify push messages and refund transactions with a few lines of code.


Running a store on an e-commerce platform? Use one of our ready-made plugins and apps instead. This SDK is for custom applications.


Requirements

RequirementDetails
Buckaroo accountCreate an account if you do not have one yet
Python3.9 or higher
OpenSSLAn up-to-date SSL/TLS toolkit

Installation

Install the SDK with pip:

pip install buckaroo-sdk

The source code is on GitHub.


Quick start

Create the client with your store key and secret key, then start a payment and send the customer to the payment page:

from buckaroo import BuckarooClient
from buckaroo.services.payment_service import PaymentService

client = BuckarooClient("STORE_KEY", "SECRET_KEY", mode="test")
payments = PaymentService(client)

response = payments.create_payment(
    "ideal",
    {
        "currency": "EUR",
        "amount": 10.00,
        "invoice": "INV-1001",  # must be unique per payment
        "description": "Order #1001",
        "return_url": "https://example.com/buckaroo/return",
        "return_url_cancel": "https://example.com/buckaroo/cancel",
        "return_url_error": "https://example.com/buckaroo/error",
        "return_url_reject": "https://example.com/buckaroo/reject",
        "push_url": "https://example.com/buckaroo/push",
    },
).pay()

if response.requires_action():
    redirect_url = response.get_redirect_url()  # send the customer here

That starts an iDEAL | Wero payment in test mode. The result of the payment arrives on your push URL, so continue with these pages in order:

  1. Configuration: credentials, test and live mode, timeouts and environment variables
  2. Payments: start a payment, read the response and handle errors
  3. Push messages: receive and verify the payment result
  4. Order management: refunds, captures and cancellations
  5. Test and go live: what to test and how to switch to production

What you can build

The SDK covers the Buckaroo payment methods and the additional services iDIN, eMandates, Split Payments, Credit Management, PayPerEmail and Subscriptions. Every payment method is called the same way, with its own service code.


Versioning

The SDK follows semantic versioning:

PartMeaning
MAJORBreaking changes that require additional testing and caution
MINORNew functionality with limited impact
PATCHBug fixes and hotfixes only

Every change is recorded in the changelog and on the releases page.


Contribute

The SDK is open source under the MIT license, and contributions are welcome. Read the contribution guidelines before you open a pull request.



Did this page help you?