Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 1.34 KB

README.md

File metadata and controls

30 lines (19 loc) · 1.34 KB

django-bitpay

A class to use the BitPay Payment Gateway API in a django project.

Read the BitPay API documentation (PDF).

New Invoices with new Bitcoin addresses are created each time the CreateInvoice method is called. BitPay links these addresses with your BitPay account and payments are stored in your BitPay balance. You can set up BitPay to pay out to your bank account daily, or split your incoming payments into Bitcoins and your desired currency (more info).

###Note

I only used two optional fields, redirectURL and itemDesc in the code. There are lots more available in the BitPay API docs (PDF).

Install

  • Add the bitpay.py file to your project (anywhere you want)
  • Apply for a new API key from https://bitpay.com/api-keys
  • Add BITPAY_API_KEY = 'yourkey' to settings.py

Usage

from bitpay import BitPay

bp = BitPay()
response = bp.CreateInvoice(total, currency, return_url, description)

You can then use response['url'] to redirect the user to the invoice page, or alternatively show an Embedded Invoice on your page.

Todo

  • Write a view that handles IPNs from BitPay