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
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.
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
| Field | Type | Required | Details |
|---|---|---|---|
externalReference | string | Yes | |
amountCents | integer | No | minimum 0. maximum 1000000000000 |
Request schema
{
"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.
| Field | Type | Required | Details |
|---|---|---|---|
outstandingCents | number | Yes | amountCents minus every settlement. |
settlements | array | Yes | |
id | string | Yes | |
companyId | string | Yes | |
partnerId | string | Yes | |
rewardId | string | Yes | |
deliveryId | string | Yes | The delivered record the reversal applies to. |
eventId | string | Yes | Refund event that reversed the delivered amount. |
currency | union | Yes | |
rewardType | union | Yes | |
amountCents | number | Yes | |
createdAt | string | Yes |
settlements[]
| Field | Type | Required | Details |
|---|---|---|---|
settlements.id | string | Yes | |
settlements.companyId | string | Yes | |
settlements.debtId | string | Yes | |
settlements.partnerId | string | Yes | |
settlements.kind | union | Yes | |
settlements.amountCents | number | Yes | |
settlements.externalReference | string | No | Present on recovered settlements. |
settlements.deliveryId | string | No | Present on netted settlements. |
settlements.eventId | string | No | Reward restoration or transfer reversal event. Present on restored settlements. |
settlements.createdAt | string | Yes |
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
{
"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.