Advice and answers from the BitPay Team


use Business::BitPay;
my $bitpay = Business::BitPay->new($api_key);# create new invoice
$invoice = $bitpay->create_invoice(price => 10, currency => 'USD');# get invoice data
$invoice = $bitpay->get_invoice($invoice->{id});

New object creation

my $bitpay = Business::BitPay->new($api_key);

Construct Business::BitPay object.

Creating an invoice

my $invoice = $bitpay->create_invoice(price => 10, currency => 'USD');

Creates new invoice. This method will croak in case of error. Full list of fields and their description can be found in Creating an Invoice section of BitPay API documentation.

Returns hashref representing of the invoice object. Description can be found in the BitPay Server Response section of the BitPay API documentation.

Retrieving an invoice

my $invoice = $bitpay->get_invoice($invoice_id);

Returns invoice hashref or croak if error occurred. Returned invoice object has exactly the same format as that which is returned when creating an invoice.

See also

BitPay API v1 documentation:

Did this answer your question?