For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Dev Portal
DocsAPI ReferenceLearnCommunityChangelog
DocsAPI ReferenceLearnCommunityChangelog
    • Overview
  • Learning Plans
    • Developer Foundations
    • Composable Developer
    • Stencil Developer
    • B2B Developer
  • Courses
        • Companies and Addresses
        • Users
        • Credit and Payment Terms
        • Lab - Postman Registration/Login Workflow
        • Lab - Postman Company Management Workflow
      • Conclusion
    • Learning Changelog
Dev Portal
LogoLogo
On this page
  • Introduction
  • Fetching Credit Configuration
  • Example Query and Response:
  • Fetching Payment Terms
  • Example Query and Response:
CoursesB2B GraphQL APIModule 2: Company Management

Credit and Payment Terms

Was this page helpful?
Previous

Users

Next

Lab - Postman Registration/Login Workflow

Built with

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
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
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.