B2B Onboarding Guide
Step-by-step guide to onboard new B2B customers with KYC verification.
Overview
The B2B onboarding process involves:
- User registration with company details
- KYC document submission
- Credit assessment
- Shopify B2B company creation
- Account approval
Step 1: User Registration
Register a new user with company information:
response = requests.post(
"https://api.huntrecht.com/api/v1/auth/register",
json={
"email": "buyer@company.com",
"password": "secure_password",
"company_name": "Acme Corporation",
"contact_name": "John Buyer",
"phone": "+1-555-123-4567",
"tax_id": "12-3456789",
"address": {
"street": "123 Business Ave",
"city": "Commerce City",
"state": "CA",
"postal_code": "90210",
"country": "US"
}
}
)
user = response.json()
print(f"User ID: {user['id']}")
print(f"Status: {user['status']}")
Step 2: Submit KYC Information
2a: Company Information
kyc = requests.post(
"https://api.huntrecht.com/api/v1/kyc/company",
headers={"Authorization": f"Bearer {access_token}"},
json={
"customer_id": user['id'],
"company_name": "Acme Corporation",
"tax_id": "12-3456789",
"business_type": "LLC",
"date_of_incorporation": "2018-03-15",
"address": {
"street": "123 Business Ave",
"city": "Commerce City",
"state": "CA",
"postal_code": "90210",
"country": "US"
}
}
)
2b: Upload Documents
import requests
files = {
'document': ('business_license.pdf', open('license.pdf', 'rb'), 'application/pdf')
}
response = requests.post(
"https://api.huntrecht.com/api/v1/kyc/documents",
files=files,
data={
'customer_id': user['id'],
'document_type': 'business_license'
},
headers={"Authorization": f"Bearer {access_token}"}
)
2c: Submit Identity
kyc = requests.post(
"https://api.huntrecht.com/api/v1/kyc/identity",
headers={"Authorization": f"Bearer {access_token}"},
json={
"customer_id": user['id'],
"first_name": "John",
"last_name": "Buyer",
"date_of_birth": "1985-06-15",
"nationality": "US",
"document_type": "passport",
"document_number": "123456789",
"document_expiry": "2030-06-15"
}
)
2d: Link Bank Account
kyc = requests.post(
"https://api.huntrecht.com/api/v1/kyc/bank",
headers={"Authorization": f"Bearer {access_token}"},
json={
"customer_id": user['id'],
"bank_name": "First National Bank",
"account_name": "Acme Corporation",
"account_number": "XXXX1234",
"routing_number": "021000021",
"account_type": "checking",
"verification_method": "plaid"
}
)
Step 3: Check KYC Status
kyc_status = requests.get(
"https://api.huntrecht.com/api/v1/kyc/status",
params={"customer_id": user['id']},
headers={"Authorization": f"Bearer {access_token}"}
)
status = kyc_status.json()
print(f"Status: {status['data']['status']}")
Expected Status Flow
pending → documents_submitted → in_review → verified
Step 4: Credit Assessment
Request initial credit assessment:
assessment = requests.post(
"https://api.huntrecht.com/api/v1/credit-risk/assess",
headers={"Authorization": f"Bearer {access_token}"},
json={
"customer_id": user['id'],
"amount": 10000.00,
"purpose": "initial_assessment"
}
)
credit = assessment.json()
print(f"Score: {credit['data']['score']}")
print(f"Max Credit: {credit['data']['max_credit_limit']}")
Step 5: Shopify B2B Company Sync
Once KYC is verified, a Shopify B2B Company is automatically created:
# Check Shopify company link
user = requests.get(
"https://api.huntrecht.com/api/v1/users/me",
headers={"Authorization": f"Bearer {access_token}"}
)
print(f"Shopify Company ID: {user['data']['shopify_company_id']}")
Full Onboarding Script
#!/usr/bin/env python3
"""
Complete B2B Customer Onboarding Script
"""
import requests
import time
BASE_URL = "https://api.huntrecht.com/api/v1"
CLIENT_ID = "hnt_your_client_id"
CLIENT_SECRET = "your_secret"
def authenticate():
"""Get access token."""
response = requests.post(
f"{BASE_URL}/auth/token",
json={
"grant_type": "client_credentials",
"client_id": CLIENT_ID,
"client_secret": CLIENT_SECRET
}
)
return response.json()["access_token"]
def register_customer(token, customer_data):
"""Register new customer."""
response = requests.post(
f"{BASE_URL}/auth/register",
headers={"Authorization": f"Bearer {token}"},
json=customer_data
)
return response.json()
def submit_kyc(token, customer_id):
"""Submit KYC information."""
# Company info
requests.post(
f"{BASE_URL}/kyc/company",
headers={"Authorization": f"Bearer {token}"},
json={
"customer_id": customer_id,
"company_name": "Acme Corporation",
"tax_id": "12-3456789",
"business_type": "LLC",
"date_of_incorporation": "2018-03-15",
"address": {
"street": "123 Business Ave",
"city": "Commerce City",
"state": "CA",
"postal_code": "90210",
"country": "US"
}
}
)
# Identity
requests.post(
f"{BASE_URL}/kyc/identity",
headers={"Authorization": f"Bearer {token}"},
json={
"customer_id": customer_id,
"first_name": "John",
"last_name": "Buyer",
"date_of_birth": "1985-06-15",
"nationality": "US",
"document_type": "passport",
"document_number": "123456789",
"document_expiry": "2030-06-15"
}
)
# Bank
requests.post(
f"{BASE_URL}/kyc/bank",
headers={"Authorization": f"Bearer {token}"},
json={
"customer_id": customer_id,
"bank_name": "First National Bank",
"account_name": "Acme Corporation",
"account_number": "XXXX1234",
"routing_number": "021000021",
"account_type": "checking",
"verification_method": "plaid"
}
)
return {"status": "documents_submitted"}
def check_kyc_status(token, customer_id):
"""Check KYC verification status."""
response = requests.get(
f"{BASE_URL}/kyc/status",
params={"customer_id": customer_id},
headers={"Authorization": f"Bearer {token}"}
)
return response.json()["data"]
def request_credit_assessment(token, customer_id):
"""Request credit assessment."""
response = requests.post(
f"{BASE_URL}/credit-risk/assess",
headers={"Authorization": f"Bearer {token}"},
json={
"customer_id": customer_id,
"amount": 10000.00,
"purpose": "initial_assessment"
}
)
return response.json()["data"]
def main():
token = authenticate()
# Step 1: Register customer
print("1. Registering customer...")
customer_data = {
"email": "buyer@company.com",
"password": "secure_password",
"company_name": "Acme Corporation",
"contact_name": "John Buyer",
"phone": "+1-555-123-4567"
}
customer = register_customer(token, customer_data)
print(f" Customer ID: {customer['id']}")
# Step 2: Submit KYC
print("\n2. Submitting KYC information...")
kyc = submit_kyc(token, customer['id'])
print(f" KYC Status: {kyc['status']}")
# Step 3: Check KYC status
print("\n3. Checking KYC status...")
status = check_kyc_status(token, customer['id'])
print(f" Current Status: {status['status']}")
print(f" Steps: {[s['step'] for s in status['steps']]}")
# Step 4: Request credit assessment
print("\n4. Requesting credit assessment...")
credit = request_credit_assessment(token, customer['id'])
print(f" Score: {credit['score']}")
print(f" Risk Level: {credit['risk_level']}")
print(f" Max Credit: ${credit['max_credit_limit']}")
print("\n✓ Onboarding initiated! Complete KYC verification for full access.")
if __name__ == "__main__":
main()