<!-- ZenPays documentation · https://docs.zenpayz.com/docs/rest-api/endpoints/vendors/update-vendor -->

# Update Vendor

Update an existing vendor's information. All fields are optional; only provided fields will be updated.

<EndpointHeader verb="PUT" path="/merchant/api/v1/vendors/:id" />

## Request

### Headers

<ParamTable
  label="Header"
  rows={[
    { name: "Authorization", required: true, desc: "`Bearer {api_key}`" },
    { name: "X-Signature", required: true, desc: "HMAC-SHA256 signature" },
    { name: "X-Timestamp", required: true, desc: "ISO 8601 timestamp" },
    { name: "X-Secret-Salt", required: true, desc: "Secret salt for HMAC validation" },
    { name: "Content-Type", required: true, desc: "`application/json`" },
  ]}
/>

### Path Parameters

<ParamTable
  rows={[
    { name: "id", type: "string", required: true, desc: "Vendor ID (e.g., `vnd_a1b2c3d4e5f6g7h8`)" },
  ]}
/>

### Body Parameters

<ParamTable
  rows={[
    { name: "name", type: "string", desc: "Vendor display name" },
    { name: "description", type: "string", desc: "Vendor description" },
    { name: "email", type: "string", desc: "Vendor email address (must be valid email)" },
    { name: "phone", type: "string", desc: "Vendor phone number" },
    { name: "website", type: "string", desc: "Vendor website URL" },
    { name: "status", type: "string", desc: "Status (`active`, `inactive`, `suspended`, `pending`)" },
    {
      name: "contactInfo",
      type: "object",
      desc: "Contact information object",
      nested: [
        {
          name: "contactInfo.primaryContact",
          type: "object",
          desc: "Primary contact details",
          nested: [
            { name: "contactInfo.primaryContact.firstName", type: "string", desc: "Contact first name" },
            { name: "contactInfo.primaryContact.lastName", type: "string", desc: "Contact last name" },
            { name: "contactInfo.primaryContact.email", type: "string", desc: "Contact email address" },
            { name: "contactInfo.primaryContact.phone", type: "string", desc: "Contact phone number" },
            { name: "contactInfo.primaryContact.designation", type: "string", desc: "Contact job title / designation" },
          ],
        },
        {
          name: "contactInfo.address",
          type: "object",
          desc: "Business address",
          nested: [
            { name: "contactInfo.address.street", type: "string", desc: "Street address" },
            { name: "contactInfo.address.city", type: "string", desc: "City" },
            { name: "contactInfo.address.state", type: "string", desc: "State or province" },
            { name: "contactInfo.address.postalCode", type: "string", desc: "Postal / ZIP code" },
            { name: "contactInfo.address.country", type: "string", desc: "Country" },
          ],
        },
      ],
    },
    {
      name: "businessInfo",
      type: "object",
      desc: "Business information",
      nested: [
        { name: "businessInfo.registrationNumber", type: "string", desc: "Business registration number" },
        { name: "businessInfo.taxId", type: "string", desc: "Tax identification number" },
        { name: "businessInfo.businessType", type: "string", desc: "Type of business" },
        { name: "businessInfo.incorporationDate", type: "string", desc: "Date of incorporation (ISO 8601)" },
        { name: "businessInfo.monthlyVolume", type: "number", desc: "Expected monthly transaction volume" },
      ],
    },
    { name: "commissionRate", type: "number", desc: "Commission rate (0-100)" },
    { name: "commissionType", type: "string", desc: "Commission model (`percentage`, `fixed`, `tiered`)" },
    { name: "commissionConfig", type: "object", desc: "Additional commission configuration" },
    { name: "riskLevel", type: "string", desc: "Risk classification (`low`, `medium`, `high`, `critical`)" },
    { name: "payoutFrequency", type: "string", desc: "Payout schedule (`weekly`, `monthly`, `quarterly`)" },
    {
      name: "bankDetails",
      type: "object",
      desc: "Bank account for payouts",
      nested: [
        { name: "bankDetails.accountNumber", type: "string", desc: "Bank account number" },
        { name: "bankDetails.routingNumber", type: "string", desc: "Routing number (US)" },
        { name: "bankDetails.ifscCode", type: "string", desc: "IFSC code (India)" },
        { name: "bankDetails.iban", type: "string", desc: "International Bank Account Number" },
        { name: "bankDetails.bankName", type: "string", desc: "Name of the bank" },
        { name: "bankDetails.swiftCode", type: "string", desc: "SWIFT / BIC code" },
        { name: "bankDetails.beneficiaryName", type: "string", desc: "Name on the bank account" },
        { name: "bankDetails.accountType", type: "string", desc: "Account type (`savings`, `current`)" },
        { name: "bankDetails.payoutType", type: "string", desc: "Preferred payout type" },
      ],
    },
    { name: "environment", type: "string", desc: "Environment identifier" },
    { name: "metadata", type: "object", desc: "Custom key-value pairs" },
  ]}
/>

## Response

### Success (200 OK)

```json
{
  "success": true,
  "data": {
    "vendorId": "vnd_a1b2c3d4e5f6g7h8",
    "name": "Acme Referrals",
    "description": "Updated partner description",
    "email": "partners@acmereferrals.com",
    "phone": "+14155559999",
    "website": "https://acmereferrals.com",
    "status": "active",
    "contactInfo": {
      "primaryContact": {
        "firstName": "Sarah",
        "lastName": "Chen",
        "email": "sarah.chen@acmereferrals.com",
        "phone": "+14155551235",
        "designation": "VP of Partnerships"
      },
      "address": {
        "street": "100 Market Street",
        "city": "San Francisco",
        "state": "CA",
        "postalCode": "94105",
        "country": "US"
      }
    },
    "businessInfo": {
      "registrationNumber": "REG-2024-78901",
      "taxId": "87-6543210",
      "businessType": "LLC",
      "incorporationDate": "2020-03-15",
      "monthlyVolume": 750000
    },
    "commissionRate": 15.0,
    "commissionType": "percentage",
    "commissionConfig": null,
    "riskLevel": "low",
    "payoutFrequency": "monthly",
    "bankDetails": {
      "accountNumber": "****6789",
      "routingNumber": "****4321",
      "bankName": "First National Bank",
      "swiftCode": "FNBKUS33",
      "beneficiaryName": "Acme Referrals LLC",
      "accountType": "current",
      "payoutType": "wire"
    },
    "environment": "production",
    "metadata": {},
    "createdAt": "2024-01-15T10:30:00.000Z",
    "updatedAt": "2024-03-21T11:00:00.000Z"
  },
  "message": "Vendor updated successfully",
  "error": null,
  "meta": {
    "request_id": "req_xxxxx",
    "timestamp": "2024-03-21T11:00:00.000Z",
    "processing_time_ms": 110,
    "api_version": "v1",
    "endpoint": "PUT /vendors/:id",
    "user_type": "merchant"
  }
}
```

### Error Responses

<ErrorTable
  rows={[
    { code: "VALIDATION_ERROR", status: "400", message: "Invalid request parameters" },
    { code: "UNAUTHORIZED", status: "401", message: "Invalid API key" },
    { code: "VENDOR_NOT_FOUND", status: "404", message: "Vendor with specified ID does not exist" },
    { code: "DUPLICATE_VENDOR", status: "409", message: "Another vendor with this email already exists" },
  ]}
/>

<CodeRail>

## Examples

<Tabs groupId="language">
  <TabItem value="curl" label="cURL" default>

```bash
curl -X PUT https://api.zenpayz.com/merchant/api/v1/vendors/vnd_a1b2c3d4e5f6g7h8 \
  -H "Authorization: Bearer zp_test_xxxxx" \
  -H "X-Timestamp: 2024-03-21T11:00:00.000Z" \
  -H "X-Signature: a1b2c3d4e5f6..." \
  -H "X-Secret-Salt: your_secret_salt" \
  -H "Content-Type: application/json" \
  -d '{
    "commissionRate": 15.0,
    "phone": "+14155559999",
    "businessInfo": {
      "monthlyVolume": 750000
    },
    "contactInfo": {
      "primaryContact": {
        "designation": "VP of Partnerships"
      }
    }
  }'
```

  </TabItem>
  <TabItem value="javascript" label="JavaScript">

```javascript
const response = await fetch('https://api.zenpayz.com/merchant/api/v1/vendors/vnd_a1b2c3d4e5f6g7h8', {
  method: 'PUT',
  headers: {
    'Authorization': `Bearer ${apiKey}`,
    'X-Timestamp': timestamp,
    'X-Signature': signature,
    'X-Secret-Salt': secretSalt,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    commissionRate: 15.0,
    phone: '+14155559999',
    businessInfo: {
      monthlyVolume: 750000,
    },
    contactInfo: {
      primaryContact: {
        designation: 'VP of Partnerships',
      },
    },
  }),
});

const result = await response.json();
console.log(result.data.commissionRate); // 15.0
```

  </TabItem>
  <TabItem value="sdk" label="SDK">

```javascript
const vendor = await zenpays.vendors.update('vnd_a1b2c3d4e5f6g7h8', {
  commissionRate: 15.0,
  phone: '+14155559999',
  businessInfo: {
    monthlyVolume: 750000,
  },
  contactInfo: {
    primaryContact: {
      designation: 'VP of Partnerships',
    },
  },
});

console.log(vendor.commissionRate); // 15.0
```

  </TabItem>
</Tabs>

</CodeRail>

## Related Endpoints

- [Get Vendor](/docs/rest-api/endpoints/vendors/get-vendor)
- [Update Vendor Status](/docs/rest-api/endpoints/vendors/update-vendor-status)
- [Update Vendor KYC](/docs/rest-api/endpoints/vendors/update-vendor-kyc)
- [Delete Vendor](/docs/rest-api/endpoints/vendors/delete-vendor)
