Skip to content
Developer docs
⌘ K
Dashboard ↗

HTTP endpoints

recoverPartnerDebt

Mark a partner's delivery debt as recovered outside a delivery.

POST /api/v1/partners/by-external-id/{externalId}/debts/{debtId}/recover

Requires rewards:deliver. Keep the Bearer key on your server.

SDK

ts
grizzlee.recoverPartnerDebt(externalId: string, debtId: string, input: RecoverPartnerDebtInput): Promise<PartnerDeliveryDebt>

HTTP

Use your backend's HTTP client. The cURL request shows the wire format. Replace path parameters and example values.

sh
curl --fail-with-body --request POST \
  'https://app.grizzlee.ca/api/v1/partners/by-external-id/{externalId}/debts/{debtId}/recover' \
  -H "Authorization: Bearer $GRIZZLEE_SERVER_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"externalReference":"externalReference-example","amountCents":10000}'

Request body

FieldTypeRequiredDetails
externalReferencestringYes
amountCentsintegerNominimum 0. maximum 1000000000000

Request schema

json
{
  "type": "object",
  "properties": {
    "externalReference": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "amountCents": {
      "type": "integer",
      "minimum": 0,
      "maximum": 1000000000000
    }
  },
  "required": [
    "externalReference"
  ],
  "additionalProperties": false
}

Response

HTTP responses wrap this value in data. The SDK returns the value directly unless the note above describes a wrapper.

FieldTypeRequiredDetails
outstandingCentsnumberYesamountCents minus every settlement.
settlementsarrayYes
idstringYes
companyIdstringYes
partnerIdstringYes
rewardIdstringYes
deliveryIdstringYesThe delivered record the reversal applies to.
eventIdstringYesRefund event that reversed the delivered amount.
currencyunionYes
rewardTypeunionYes
amountCentsnumberYes
createdAtstringYes

settlements[]

FieldTypeRequiredDetails
settlements.idstringYes
settlements.companyIdstringYes
settlements.debtIdstringYes
settlements.partnerIdstringYes
settlements.kindunionYes
settlements.amountCentsnumberYes
settlements.externalReferencestringNoPresent on recovered settlements.
settlements.deliveryIdstringNoPresent on netted settlements.
settlements.eventIdstringNoReward restoration or transfer reversal event. Present on restored settlements.
settlements.createdAtstringYes

settlements.kind

Variant 1

Type: string.

Variant 2

Type: string.

Variant 3

Type: string.

currency

Variant 1

Type: string.

Variant 2

Type: string.

Variant 3

Type: string.

Variant 4

Type: string.

rewardType

Variant 1

Type: string.

Variant 2

Type: string.

Response schema

json
{
  "type": "object",
  "properties": {
    "outstandingCents": {
      "type": "number",
      "description": "amountCents minus every settlement."
    },
    "settlements": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "companyId": {
            "type": "string"
          },
          "debtId": {
            "type": "string"
          },
          "partnerId": {
            "type": "string"
          },
          "kind": {
            "anyOf": [
              {
                "type": "string",
                "const": "restored"
              },
              {
                "type": "string",
                "const": "netted"
              },
              {
                "type": "string",
                "const": "recovered"
              }
            ]
          },
          "amountCents": {
            "type": "number"
          },
          "externalReference": {
            "type": "string",
            "description": "Present on recovered settlements."
          },
          "deliveryId": {
            "type": "string",
            "description": "Present on netted settlements."
          },
          "eventId": {
            "type": "string",
            "description": "Reward restoration or transfer reversal event. Present on restored settlements."
          },
          "createdAt": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "companyId",
          "debtId",
          "partnerId",
          "kind",
          "amountCents",
          "createdAt"
        ]
      }
    },
    "id": {
      "type": "string"
    },
    "companyId": {
      "type": "string"
    },
    "partnerId": {
      "type": "string"
    },
    "rewardId": {
      "type": "string"
    },
    "deliveryId": {
      "type": "string",
      "description": "The delivered record the reversal applies to."
    },
    "eventId": {
      "type": "string",
      "description": "Refund event that reversed the delivered amount."
    },
    "currency": {
      "anyOf": [
        {
          "type": "string",
          "const": "CAD"
        },
        {
          "type": "string",
          "const": "USD"
        },
        {
          "type": "string",
          "const": "EUR"
        },
        {
          "type": "string",
          "const": "GBP"
        }
      ]
    },
    "rewardType": {
      "anyOf": [
        {
          "type": "string",
          "const": "cash"
        },
        {
          "type": "string",
          "const": "credit"
        }
      ]
    },
    "amountCents": {
      "type": "number"
    },
    "createdAt": {
      "type": "string"
    }
  },
  "required": [
    "outstandingCents",
    "settlements",
    "id",
    "companyId",
    "partnerId",
    "rewardId",
    "deliveryId",
    "eventId",
    "currency",
    "rewardType",
    "amountCents",
    "createdAt"
  ]
}

Errors

Failures return { "error": { "code": "...", "message": "...", "details": {} } }. Details are optional. See error statuses. Reuse an unchanged event payload when retrying.