Edit in GitHubLog an issue
Adobe Commerce only. Learn more

Manage company credit

The company credit entity operates with the following attributes:

  • Credit limit
  • Available credit
  • Outstanding balance

The credit limit is allocated by seller, while available credit and outstanding balance are automatically calculated by the system based on the buyer transactions (place an order, return) and seller's transactions (refund, reimburse, update credit limit, cancel order).

Manage company credit limits

When you create a company, the credit limit is set to 0. Use the PUT /V1/companyCredits/:id call to change this value and perform other updates to the company's credit settings.

REST Endpoints:

Copied to your clipboard
PUT /V1/companyCredits/:id
GET /V1/companyCredits/:creditId
GET /V1/companyCredits/company/:companyId
GET /V1/companyCredits/

Company credit parameters:

NameDescriptionFormatRequirements
id
The credit ID generated by the system
Integer
Required
company_id
Company ID
Integer
Required
credit_limit
The amount of credit granted to the company
Float
Required
balance
The amount the company currently owes the seller
Float
Optional
currency_code
The currency code for the company's credit, such as USD
String
Required
exceed_limit
Indicates whether the company can exceed their credit limit
Boolean
Optional
available_limit
The amount of credit currently available to the company
Float
Optional
credit_comment
Describes the change being made
String
Optional

Update a company credit limit

This call changes the company's credit limit to $1000. The available_limit parameter is calculated, so you cannot specify the value.

Service Name:

companyCreditCreditLimitRepositoryV1

Sample Usage:

PUT <host>/rest/<store_code>/V1/companyCredits/2

Copied to your clipboard
{
"creditLimit": {
"id": 2,
"company_id": 2,
"credit_limit": 1000,
"currency_code": "USD"
}
}

Get details about a company's credit limit using credit ID

This call returns data on the credit limit for the specified credit ID.

Service Name:

companyCreditCreditLimitRepositoryV1

Sample Usage:

GET <host>/rest/<store_code>/V1/companyCredits/2

Copied to your clipboard
// Not applicable

Get details about a company's credit limit using company ID

This call returns information about the credit limit for a specified company.

Service Name:

companyCreditCreditLimitManagementV1

Sample Usage:

GET <host>/rest/<store_code>/V1/companyCredits/company/2

Copied to your clipboard
// Not applicable

Search credit IDs

The following call returns information for all companies whose credit balance is 0.

See Search using REST APIs for information about constructing a search query.

Sample Usage:

GET <host>/rest/<store_code>/V1/companyCredits?searchCriteria[filter_groups][0][filters][0][field]=balance&searchCriteria[filter_groups][0][filters][0][value]=0&searchCriteria[filter_groups][0][filters][0][condition_type]=eq

Copied to your clipboard
// Not applicable

Balance operations

The company's outstanding balance can be updated as the buyer makes payments, purchases, and other transactions.

Service Name:

companyCreditCreditBalanceManagementV1

REST Endpoints:

Copied to your clipboard
POST /V1/companyCredits/:creditId/decreaseBalance
POST /V1/companyCredits/:creditId/increaseBalance

Balance Parameters:

NameDescriptionFormatRequirements
value
Indicates how much money is involved in this company credit balance operation.
Number
Required
currency
The currency of the transaction, such as USD
String
Required
operationType
Must be one of the following: 1 - Allocated; 2 - Updated; 3 - Purchased; 4 - Reimbursed; 5 - Refunded; 6 - Reverted
Integer
Required
comment
Describers the operation
String
Optional
options
An object that provides additional information for increasing or decreasing the credit balance
Object
Optional

options parameters:

NameDescriptionFormatRequirements
purchase_order
The company's purchase order number
String
Optional
order_increment
Order increment
String
Optional
currency_display
Currency code for displaying the operation
String
Optional
currency_base
The base currency
String
Optional

Increase the company credit balance

This call increases the company credit with an Allocate, Update, Refund, Revert, or Reimburse transaction. (You cannot specify the Purchased (3) operation type.) This call also decreases the company's outstanding balance.

Sample Usage:

POST <host>/rest/<store_code>/V1/companyCredits/2/increaseBalance

Copied to your clipboard
{
"value": 250,
"currency": "USD",
"operationType": 2,
"comment": "update limit"
}

Decrease the balance

This call decreases the company credit with an Update (operation type = 2), Purchased (3), or Reimbursed (4) transaction. (You cannot specify the other operation types.) This call also increases company's outstanding balance.

Sample Usage:

POST <host>/rest/<store_code>/V1/companyCredits/2/decreaseBalance

Copied to your clipboard
{
"value": 250,
"currency": "USD",
"operationType": 4,
"comment": "issue refund"
}

Credit history

A Reimburse transaction can be updated to include a purchase order and comment.

Service Name: companyCreditCreditHistoryManagementV1

REST Endpoints:

Copied to your clipboard
GET /V1/companyCredits/history
PUT /V1/companyCredits/history/:historyId

Save the credit history

This call updates the credit history to specify a purchase order number.

Sample Usage:

PUT <host>/rest/<store_code>/V1/companyCredits/history/6

Copied to your clipboard
{
"purchaseOrder": "A12345",
"comment": "Adding PO info"
}

Search credit history IDs

The following call returns a list instances in which the credit limit was set to a value higher than $500.

See Search using REST APIs for information about constructing a search query.

Sample Usage:

GET <host>/rest/<store_code>/V1/companyCredits/history?searchCriteria[filter_groups][0][filters][0][field]=credit_limit&searchCriteria[filter_groups][0][filters][0][value]=500&searchCriteria[filter_groups][0][filters][0][condition_type]=gt

Copied to your clipboard
// Not applicable
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.