Create a bill
Bills are payment requests addressed to specific buyers. Bill line items have fixed prices, typically denominated in fiat currency.
POST /bills
Facade MERCHANT
// Create a list of items to add in the bill
List<Item> items = new List<Item>();
items.Add(new Item(){Price = 30.0, Quantity = 9, Description = "product-a"});
items.Add(new Item(){Price = 14.0, Quantity = 16, Description = "product-b"});
items.Add(new Item(){Price = 3.90, Quantity = 42, Description = "product-c"});
items.Add(new Item(){Price = 6.99, Quantity = 12, Description = "product-d"});
// create a bill and make sure we receive an id - which means it has been successfully submitted
var bill = new Bill()
{
Number = "1",
Currency = Currency.USD,
Email = "", //email address mandatory
Items = items
};
var basicBill = bitpay.CreateBill(bill);
HTTP Response
{
"facade": "merchant/bill",
"data": {
"status": "draft",
"url": "https://bitpay.com/bill?id=3Zpmji8bRKxWJo2NJbWX5H&resource=bills",
"number": "bill1234-EFGH",
"createdDate": "2021-05-21T09:51:04.126Z",
"dueDate": "2021-05-31T00:00:00.000Z",
"currency": "USD",
"name": "John Doe",
"address1": "2630 Hegal Place",
"address2": "Apt 42",
"city": "Alexandria",
"state": "VA",
"zip": "23242",
"country": "US",
"email": "[email protected]",
"cc": [
"[email protected]"
],
"phone": "555-123-456",
"passProcessingFee": true,
"emailBill": true,
"id": "3Zpmji8bRKxWJo2NJbWX5H",
"merchant": "7HyKWn3d4xdhAMQYAEVxVq",
"items": [
{
"id": "NV35GRWtrdB2cmGEjY4LKY",
"description": "Test Item 1",
"price": 6,
"quantity": 1
},
{
"id": "Apy3i2TpzHRYP8tJCkrZMT",
"description": "Test Item 2",
"price": 4,
"quantity": 1
}
],
"token": "6EBQR37MgDJPfEiLY3jtRq7eTP2aodR5V5wmXyyZhru5FM5yF4RCGKYQtnT7nhwHjA"
}
}