Pay vendors with BILL

Use /v2/PayBills.json to pay a vendor with BILL for one or more bills. You can also pay multiple vendors with a single /v2/PayBills.json request. See the PayBills API for more information.

📘

NOTE

With the /PayBills.json API, you cannot pay a vendor without linking it to a bill. This feature is available only with the BILL web app.

Prerequisites

There are two prerequisites for using /v2/PayBills.json.

  • This is an MFA protected endpoint. Create an MFA-protected API session with /v2/Login.json before using /v2/PayBills.json. See the Login API for more information.
  • The user paying a bill must have either the Administrator, Payer, or another user role profile that has the permission to pay bills.

Paying a single vendor

In your request, the billPays information is required.

  • In the billPays array, set billId and amount for each bill to be paid.
  • You can set vendorId as the ID of the vendor you want to pay. If you do not set the vendorId, the vendorId is automatically set for each bill to be paid.

In this cURL example, the vendor (vendorId) is paid $100 and $50 as payments for two bills.

curl --request POST \
--url 'https://api-sandbox.bill.com/api/v2/PayBills.json' \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'devKey={developer_key}' \
--data 'sessionId={session_id}' \
--data 'data={
  "vendorId":"{vendor_id}",
  "billPays":[{
    "billId":"{bill01_id}",
    "amount":100
  },
  {
    "billId":"{bill02_id}",
    "amount":50
  }]
}'

Combining payments made to the same vendor

You can combine payments for multiple bills to the same vendor into one payment if you pay from a bank account.

Ensure that you set enableCombinePayments as true for the vendor (with /v2/Crud/Create/Vendor.json or /v2/Crud/Updated/Vendor.json) before paying for multiple bills as one combined payment. See the Create a vendor API for more information.

In the above cURL example, if enableCombinePayments is true for a vendor, the vendor receives one combined $150 payment for two bills.

📘

NOTE

Payments can be combined only when they have the same process date, the same arrives-by date, and are scheduled to be paid at the same time.

Paying multiple vendors

In your request, the billPays information is required.

  • In the billPays array, set billId and amount for each bill to be paid.
  • Do not set the vendorId. The vendorId is automatically set for each bill to be paid.

In this cURL example, two bill payments of $100 and $50 are sent to their respective vendors.

curl --request POST \
--url 'https://api-sandbox.bill.com/api/v2/PayBills.json' \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data 'devKey={developer_key}' \
--data 'sessionId={session_id}' \
--data 'data={
  "billPays":[{
    "billId":"{bill01_id}",
    "amount":100
  },
  {
    "billId":"{bill02_id}",
    "amount":50
  }]
}'