Create Invoice
BudPay's Invoice API allows you to create and send professional invoices to your customers. Customers can pay the invoice using various payment methods supported by BudPay.
Quick Overview
- Create Invoice: Call the create invoice API with customer and invoice details.
- Share Payment Link: Send the generated redirect link to your customer.
- Customer Pays: Customer uses the link to view and pay the invoice.
- Receive Notification: Get webhook notification when payment is completed.
Step 1: Creating a New Invoice
Use the create_invoice endpoint to generate a new invoice with customer details and line items.
Sample Request
curl https://api.budpay.com/api/v2/create_invoice \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "Test Invoice",
"duedate": "2023-12-30",
"currency": "NGN",
"invoicenumber": "",
"reminder": "",
"email": "customer@email.com",
"first_name": "John",
"last_name": "Doe",
"billing_address": "Carlton Gate estate, Akobo",
"billing_city": "Ibadan",
"billing_state": "Oyo",
"billing_country": "Nigeria",
"billing_zipcode": "234",
"items": [
{
"description": "Professional Services",
"quantity": "1",
"unit_price": "1000",
"meta_data": ""
}
]
}' \
-X POSTSample Response
{
"success": true,
"message": "Invoice created successfully",
"data": [
{
"invoice_id": 1,
"ref_id": "ovgsfdsfvsd",
"paycode": "2542jkdhdsioewewew",
"redirect_link": "https://budpay.com/invoice/payment/2542jkdhdsioewewew"
}
]
}Try it out
Parameters
This section details the header and request parameters required for creating an invoice.
Header Parameters
| Field Name | Description |
|---|---|
| URL | https://api.budpay.com/api/v2/create_invoice |
| Method | POST |
| Authorization | Bearer YOUR_SECRET_KEY (Replace with your actual BudPay secret key) |
| Content-Type | application/json |
Request Parameters
| Parameter | Description | Required |
|---|---|---|
title | Invoice title/subject | Yes |
duedate | Invoice due date (YYYY-MM-DD format) | Yes |
currency | Currency code (NGN, USD, GHS, KES) | Yes |
email | Customer's email address | Yes |
first_name | Customer's first name | Optional (but recommended) |
last_name | Customer's last name | Optional (but recommended) |
billing_address | Customer's billing address | Yes |
billing_city | Customer's city | Yes |
billing_state | Customer's state/province | Yes |
billing_country | Customer's country | Yes |
billing_zipcode | Customer's zip/postal code | Yes |
invoicenumber | Custom invoice number | Optional |
reminder | Reminder settings | Optional |
items | Array of invoice line items | Yes |
Items Array Parameters
| Parameter | Description | Required |
|---|---|---|
description | Item description | Yes |
quantity | Item quantity | Yes |
unit_price | Price per unit | Yes |
meta_data | Additional metadata | Optional |
You can add multiple items to an invoice by including additional objects in the items array.
Step 2: Share Payment Link
After creating the invoice, share the redirect_link from the response with your customer. The customer can use this link to view the invoice details and make payment.
Response Data
| Field | Description |
|---|---|
invoice_id | Unique invoice identifier in the BudPay system |
ref_id | Invoice reference ID |
paycode | Unique payment code for the invoice |
redirect_link | Payment link to share with customer |
Step 3: Customer Makes Payment
When the customer visits the redirect link, they will see the invoice details and can pay using any of BudPay's supported payment methods:
- Card payments
- Bank transfer
- Mobile money (where available)
Step 4: Receive Notifications
Once the customer completes payment:
- Webhook Notification: BudPay will send a webhook notification to your configured webhook URL with the invoice payment details.
- Email Notification: Both you and your customer will receive email confirmations.
Always verify invoice payment status using the transaction verification API before giving value to ensure the payment was successful.
Best Practices
- Invoice Numbers: Use the
invoicenumberfield to maintain your own invoice numbering system for better tracking. - Due Dates: Set realistic due dates to give customers adequate time to pay.
- Item Details: Provide clear, detailed descriptions in the items array for better transparency.
- Customer Information: Include complete customer details (first_name, last_name) for professional invoices.
- Currency: Ensure the currency matches your business location and customer preference.