Credit and Payment Terms

Plan: B2B Developer

Lesson 7 of 18 · 15 min

Introduction

A capability of B2B Edition is to set individualized credit restrictions and payment terms per company, and it’s useful to be able to inspect these company details from a storefront perspective.

The GraphQL queries explained here require only a valid Bearer token after a login operation and will return the correct details for the corresponding company.

Fetching Credit Configuration

The companyCreditConfig query can be used to fetch the details of the credit limit or hold applied to the current user’s company.

Example Query and Response:

query GetCreditConfig {
companyCreditConfig {
creditEnabled
creditCurrency
availableCredit
limitPurchases
creditHold
}
}
  • availableCredit contains the dollar amount of the company’s limit for PO payment on an order.
  • When limitPurchases is TRUE, the PO payment method will be disabled for any orders exceeding availableCredit.
  • When creditHold is TRUE, no transactions except invoice payments will be allowed for any of the company’s users.

Note that the available credit value for a company only affects the maximum amount allowed in a single order. Existing orders and open invoices will not affect the availableCredit value returned or the user’s checkout experience for lower amounts.

Fetching Payment Terms

The companyPaymentTerms query can be used to fetch details of a company’s payment terms.

Example Query and Response:

query GetPaymentTerms(
$companyId: Int!
) {
companyPaymentTerms(
companyId: $companyId
) {
isEnabled
paymentTerms
}
}
  • isEnabled indicates whether custom payment terms are set for the company. If FALSE, this means the store’s default payment terms will apply.
  • If custom terms are set for the company, paymentTerms will return that value. If not, it will return the store’s default terms.

A value of 30 for paymentTerms, for example, indicates Net 30 terms, meaning that the company’s invoices will be due 30 days after they are created.