@cliniq360/ondc-credit-cli
v1.0.0
Published
Official CLI for the ONDC credit and loan API workflow.
Readme
ondc-credit CLI
CLI for the ONDC credit and loan API workflow.
Features
- Calls the ONDC credit backend APIs directly
- Preserves the same CLI structure and error handling pattern as the base ONDC CLI
- Validates the credit payloads used by the existing ONDC and haqdarshak flows
- Supports human-readable and JSON output
- Includes a raw tool caller for the built-in ONDC credit API tool set
- Uses
https://prod.cliniq360.comas the default API base URL - Uses the same
ONDC_API_BASE_URLandONDC_API_KEYconfiguration pattern - Can print the strict credit AI workflow prompt via
ondc-credit workflow prompt
Installation
Install globally:
npm install -g @cliniq360/ondc-credit-cliOr run without installing:
npx @cliniq360/ondc-credit-cli --helpQuick Start
# 1. Inspect the strict workflow before calling tools
ondc-credit workflow prompt
# 2. Start a credit journey
ondc-credit journey start --user-id 1
# 3. Submit the base loanForm payload
ondc-credit forms application \
--txn-id <TXN_ID> \
--first-name Jane \
--last-name Doe \
--dob 1992-01-15 \
--gender female \
--pan ABCDE1234F \
--contact-number 9876543210 \
--email [email protected] \
--official-email [email protected] \
--employment-type salaried \
--end-use Education \
--income 50000 \
--company-name ExampleCorp \
--address-l1 "12 MG Road" \
--address-l2 "Near Metro" \
--city Bengaluru \
--state Karnataka \
--pincode 560001
# 4. Move to approved offers
ondc-credit offers select-application --txn-id <TXN_ID>
ondc-credit offers approved --txn-id <TXN_ID>
# 5. Submit amount for a chosen offer
ondc-credit forms loan-amount \
--txn-id <TXN_ID> \
--request-amount 250000 \
--request-term "24 months" \
--form-id <FORM_ID>Use A Different API Endpoint
Override the default hosted API base URL with a shell environment variable:
ONDC_API_BASE_URL=http://localhost:7600 ondc-credit tools listOr export it for the current shell session:
export ONDC_API_BASE_URL=http://localhost:7600
export ONDC_API_KEY=your_api_key_if_required
ondc-credit config showYou can also place these values in a .env file in the directory where you run ondc-credit:
ONDC_API_BASE_URL=http://localhost:7600
ONDC_API_KEY=your_api_key_if_requiredCommand Groups
ondc-credit config
ondc-credit config set-format <pretty|json>ondc-credit config show
ondc-credit workflow
ondc-credit workflow listondc-credit workflow promptondc-credit workflow happy-pathondc-credit workflow aa-fallbackondc-credit workflow show <NAME>
ondc-credit journey
ondc-credit journey start [--user-id <USER_ID>]
ondc-credit forms
ondc-credit forms application ...ondc-credit forms loan-amount ...ondc-credit forms bank-details ...
ondc-credit offers
ondc-credit offers select-application --txn-id <TXN_ID>ondc-credit offers approved [--txn-id <TXN_ID> | --user-id <USER_ID> | --customer-id <CUSTOMER_ID> | --mobile-number <PHONE>]ondc-credit offers aa-url --txn-id <TXN_ID> --aa-id <AA_ID>ondc-credit offers aa-consent --txn-id <TXN_ID>ondc-credit offers detailed --txn-id <TXN_ID>ondc-credit offers select --txn-id <TXN_ID> --offer-item-id <OFFER_ID>
ondc-credit orders
ondc-credit orders transaction-status --txn-id <TXN_ID>ondc-credit orders form-url --txn-id <TXN_ID> --offer-item-id <OFFER_ID>ondc-credit orders init --txn-id <TXN_ID> --offer-item-id <OFFER_ID>ondc-credit orders confirm --txn-id <TXN_ID> --offer-item-id <OFFER_ID>ondc-credit orders status --txn-id <TXN_ID> --offer-item-id <OFFER_ID>ondc-credit orders loan-document --txn-id <TXN_ID> --offer-item-id <OFFER_ID>
ondc-credit policy
ondc-credit policy notify --order-id <ORDER_ID> --channel <whatsapp|sms> --mobile-number <PHONE>
ondc-credit tools
ondc-credit tools listondc-credit tools inspect <NAME>ondc-credit tools call <NAME> --input '{...}'
Validated Payloads
The CLI validates the same request shapes used by the current credit flows in ONDC and haqdarshak.
loanFormrequired fields:firstName,lastName,dob,gender,pan,contactNumber,email,officialEmail,employmentType,endUse,income,companyName,addressL1,addressL2,city,state,pincodeloanFormoptional fields:udyamNumberloanFormrequired fields also includeaa_idloanAmountFormrequired fields:requestAmount,requestTerm,form_idaccountDetailsrequired fields:accHolderName,acctype,accNo,ifscCodeaccountDetailsoptional fields:aaMonitoringConsent
The CLI also validates common field formats:
- PAN:
AAAAA9999A - mobile number: 10 digits without country code
- pincode: 6 digits
- IFSC: Indian IFSC pattern
- date of birth:
YYYY-MM-DD - booleans passed as strings:
trueorfalse bureauConsentis always sent astruefor base application submission
Notes
ondc-credit-clicalls the ONDC backend REST APIs directly.- The default base URL and API key behavior remain the same as the existing ONDC CLI implementation.
ondc-credit workflow promptprints the strictCREDIT_WORKFLOW_TEMPLATEguidance for AI-assisted execution.- The CLI prints parsed tool payloads by default. Use
--jsonfor clean automation output. - For raw tool execution, use
ondc-credit tools inspect <NAME>beforeondc-credit tools call <NAME>.
