# POST `/merchant/v1/transactions/{transaction_id}/complete`

[Documentation page](/api-reference/transactions/payments.transactions.complete)

## Summary

Complete a transaction

## Description

Tell Recuut whether your work succeeded or failed. Recuut then finishes the payment. A finished successful payment includes a receipt.

## Security requirements

```json
[
  {
    "OrganizationApiKeyAuth": []
  }
]
```

## Operation parameters

### path `transaction_id`

```json
{
  "description": "Server-issued transaction identifier.",
  "example": "txn_00000000000070008000000000000000",
  "in": "path",
  "name": "transaction_id",
  "required": true,
  "schema": {
    "description": "Server-issued transaction identifier.",
    "examples": [
      "txn_00000000000070008000000000000000"
    ],
    "pattern": "^txn_[0-9a-f]{12}7[0-9a-f]{3}[89ab][0-9a-f]{15}$",
    "title": "Transaction Id",
    "type": "string",
    "x-recuut-public-id-prefix": "txn"
  }
}
```

### header `PAYMENT-SIGNATURE`

```json
{
  "description": "Payment proof created by the payer. Forward this base64 text unchanged. It is required to finish this payment. [See the decoded fields](/guides/concepts/x402-payment-retry/#what-the-encoded-headers-contain).",
  "example": "$PAYMENT_SIGNATURE",
  "in": "header",
  "name": "PAYMENT-SIGNATURE",
  "required": true,
  "schema": {
    "$ref": "#/components/schemas/PaymentSignature"
  }
}
```

## Request body

```json
{
  "content": {
    "application/json": {
      "examples": {
        "complete_succeeded": {
          "summary": "Complete a successful transaction",
          "value": {
            "outcome": "succeeded",
            "resource_execution": {
              "duration_ms": 84,
              "response_content_type": "application/json",
              "response_size_bytes": 312,
              "response_status": 200
            },
            "revision_id": "acr_00000000000070008000000000000000",
            "values": {
              "input_tokens": "1000"
            }
          }
        },
        "failed": {
          "summary": "Report a failed merchant operation",
          "value": {
            "failure_code": "merchant_operation_failed",
            "outcome": "failed",
            "resource_execution": {
              "duration_ms": 148,
              "response_content_type": "application/json",
              "response_size_bytes": 96,
              "response_status": 500
            },
            "revision_id": "acr_00000000000070008000000000000000"
          }
        }
      },
      "schema": {
        "$ref": "#/components/schemas/CompleteRequest"
      }
    }
  },
  "required": true
}
```

## Responses

### 200

```json
{
  "content": {
    "application/json": {
      "examples": {
        "merchant_operation_failed": {
          "description": "The work failed, so no payment receipt is returned.",
          "summary": "Merchant operation failed",
          "value": {
            "payment_response": null,
            "receipt": null,
            "status": "failed",
            "transaction_hash": null,
            "transaction_id": "txn_00000000000070008000000000000000"
          }
        },
        "settlement_succeeded": {
          "description": "Payment succeeded. The response includes the payment receipt.",
          "summary": "Settlement succeeded",
          "value": {
            "payment_response": "eyJhbW91bnQiOiIxMDAwMDAwIiwiZXJyb3JSZWFzb24iOm51bGwsImV4dGVuc2lvbnMiOnsicmVjdXV0LXJlY2VpcHQiOnsiZW52aXJvbm1lbnQiOiJ0ZXN0IiwiZW52aXJvbm1lbnRfa2V5IjoidGVzdCIsImlkIjoicmN0XzAwMDAwMDAwMDAwMDcwMDA4MDAwMDAwMDAwMDAwMDAwIiwiaXNzdWVkX2F0IjoiMjAyNi0wOC0xMlQwOTozMDowMC4wMDBaIiwicGF5bWVudCI6eyJhc3NldCI6IlVTREMiLCJhc3NldF9pZCI6IjB4MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMyIsImF1dGhvcml6ZWRfYXRvbWljIjoiMTAwMDAwMCIsIm5ldHdvcmsiOiJlaXAxNTU6ODQ1MzIiLCJwYXllciI6IjB4MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMSIsInJlY2lwaWVudCI6IjB4MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMiIsInNjaGVtZSI6ImV4YWN0Iiwic2V0dGxlZF9hdG9taWMiOiIxMDAwMDAwIiwidHJhbnNhY3Rpb25faGFzaCI6IjB4YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYSJ9LCJwcmljZSI6eyJjYWxjdWxhdGlvbl9tb2RlIjoiZml4ZWQiLCJjdXJyZW5jeSI6IlVTRCIsImlkIjoicHJjXzAwMDAwMDAwMDAwMDcwMDA4MDAwMDAwMDAwMDAwMDAwIiwibGFiZWwiOiJRdWFydGVybHkgcmVwb3J0IGFjY2VzcyJ9LCJyZXNvdXJjZSI6eyJpZCI6InJlc18wMDAwMDAwMDAwMDA3MDAwODAwMDAwMDAwMDAwMDAwMCIsIm5hbWUiOiJRdWFydGVybHkgcmVwb3J0IiwidXJsIjoiaHR0cHM6Ly9tZXJjaGFudC5leGFtcGxlL3JlcG9ydHMvcXVhcnRlcmx5In0sInNjaGVtYV92ZXJzaW9uIjoyLCJzZWxsZXIiOnsiaWQiOiJvcmdfMDAwMDAwMDAwMDAwNzAwMDgwMDAwMDAwMDAwMDAwMDAiLCJuYW1lIjoiQWNtZSBSZXNlYXJjaCJ9LCJ0cmFuc2FjdGlvbl9pZCI6InR4bl8wMDAwMDAwMDAwMDA3MDAwODAwMDAwMDAwMDAwMDAwMCJ9fSwibmV0d29yayI6ImVpcDE1NTo4NDUzMiIsInBheWVyIjoiMHgxMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExIiwic3VjY2VzcyI6dHJ1ZSwidHJhbnNhY3Rpb24iOiIweGFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWEifQ==",
            "receipt": {
              "environment": "test",
              "environment_key": "test",
              "id": "rct_00000000000070008000000000000000",
              "issued_at": "2026-08-12T09:30:00.000Z",
              "payment": {
                "asset": "USDC",
                "asset_id": "0x3333333333333333333333333333333333333333",
                "authorized_atomic": "1000000",
                "network": "eip155:84532",
                "payer": "0x1111111111111111111111111111111111111111",
                "recipient": "0x2222222222222222222222222222222222222222",
                "scheme": "exact",
                "settled_atomic": "1000000",
                "transaction_hash": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
              },
              "price": {
                "calculation_mode": "fixed",
                "currency": "USD",
                "id": "prc_00000000000070008000000000000000",
                "label": "Quarterly report access"
              },
              "resource": {
                "id": "res_00000000000070008000000000000000",
                "name": "Quarterly report",
                "url": "https://merchant.example/reports/quarterly"
              },
              "schema_version": 2,
              "seller": {
                "id": "org_00000000000070008000000000000000",
                "name": "Acme Research"
              },
              "transaction_id": "txn_00000000000070008000000000000000"
            },
            "status": "succeeded",
            "transaction_hash": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
            "transaction_id": "txn_00000000000070008000000000000000"
          }
        }
      },
      "schema": {
        "$ref": "#/components/schemas/CompletionResult"
      }
    }
  },
  "description": "OK",
  "headers": {
    "PAYMENT-RESPONSE": {
      "description": "Proof that payment succeeded. Return this base64 text unchanged. [See the decoded fields](/guides/concepts/x402-payment-retry/#what-the-encoded-headers-contain).",
      "required": false,
      "schema": {
        "contentEncoding": "base64",
        "contentMediaType": "application/json",
        "examples": [
          "eyJhbW91bnQiOiIxMDAwMDAwIiwiZXJyb3JSZWFzb24iOm51bGwsImV4dGVuc2lvbnMiOnsicmVjdXV0LXJlY2VpcHQiOnsiZW52aXJvbm1lbnQiOiJ0ZXN0IiwiZW52aXJvbm1lbnRfa2V5IjoidGVzdCIsImlkIjoicmN0XzAwMDAwMDAwMDAwMDcwMDA4MDAwMDAwMDAwMDAwMDAwIiwiaXNzdWVkX2F0IjoiMjAyNi0wOC0xMlQwOTozMDowMC4wMDBaIiwicGF5bWVudCI6eyJhc3NldCI6IlVTREMiLCJhc3NldF9pZCI6IjB4MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMyIsImF1dGhvcml6ZWRfYXRvbWljIjoiMTAwMDAwMCIsIm5ldHdvcmsiOiJlaXAxNTU6ODQ1MzIiLCJwYXllciI6IjB4MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMSIsInJlY2lwaWVudCI6IjB4MjIyMj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
```

### 202

```json
{
  "content": {
    "application/json": {
      "examples": {
        "settlement_pending": {
          "description": "Payment is still in progress, so no payment receipt is returned yet.",
          "summary": "Settlement pending",
          "value": {
            "payment_response": null,
            "receipt": null,
            "status": "settling",
            "transaction_hash": null,
            "transaction_id": "txn_00000000000070008000000000000000"
          }
        },
        "settlement_reconciling": {
          "description": "Recuut is checking the payment, so no payment receipt is returned yet.",
          "summary": "Settlement reconciling",
          "value": {
            "payment_response": null,
            "receipt": null,
            "status": "reconciling",
            "transaction_hash": null,
            "transaction_id": "txn_00000000000070008000000000000000"
          }
        }
      },
      "schema": {
        "$ref": "#/components/schemas/CompletionResult"
      }
    }
  },
  "description": "Accepted"
}
```

### 400

```json
{
  "content": {
    "application/json": {
      "examples": {
        "invalid_payment_signature": {
          "summary": "Malformed payment signature",
          "value": {
            "code": "invalid_payment_signature",
            "message": "PAYMENT-SIGNATURE is not valid base64-encoded JSON."
          }
        }
      },
      "schema": {
        "additionalProperties": false,
        "description": "Error returned for this endpoint and HTTP status.",
        "properties": {
          "code": {
            "const": "invalid_payment_signature",
            "description": "Stable error code your app can check.",
            "type": "string"
          },
          "message": {
            "description": "Short explanation of what went wrong.",
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      }
    }
  },
  "description": "Bad Request"
}
```

### 401

```json
{
  "content": {
    "application/json": {
      "examples": {
        "unauthenticated": {
          "summary": "API key required",
          "value": {
            "code": "unauthenticated",
            "message": "A valid Recuut API key is required."
          }
        }
      },
      "schema": {
        "additionalProperties": false,
        "description": "Error returned for this endpoint and HTTP status.",
        "properties": {
          "code": {
            "const": "unauthenticated",
            "description": "Stable error code your app can check.",
            "type": "string"
          },
          "message": {
            "description": "Short explanation of what went wrong.",
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      }
    }
  },
  "description": "Unauthorized"
}
```

### 403

```json
{
  "content": {
    "application/json": {
      "examples": {
        "forbidden": {
          "summary": "Capability denied",
          "value": {
            "code": "forbidden",
            "message": "This API key does not allow this operation."
          }
        }
      },
      "schema": {
        "additionalProperties": false,
        "description": "Error returned for this endpoint and HTTP status.",
        "properties": {
          "code": {
            "const": "forbidden",
            "description": "Stable error code your app can check.",
            "type": "string"
          },
          "message": {
            "description": "Short explanation of what went wrong.",
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      }
    }
  },
  "description": "Forbidden"
}
```

### 404

```json
{
  "content": {
    "application/json": {
      "examples": {
        "transaction_not_found": {
          "summary": "Transaction not found",
          "value": {
            "code": "transaction_not_found",
            "message": "Transaction not found."
          }
        }
      },
      "schema": {
        "additionalProperties": false,
        "description": "Error returned for this endpoint and HTTP status.",
        "properties": {
          "code": {
            "const": "transaction_not_found",
            "description": "Stable error code your app can check.",
            "type": "string"
          },
          "message": {
            "description": "Short explanation of what went wrong.",
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      }
    }
  },
  "description": "Not Found"
}
```

### 409

```json
{
  "content": {
    "application/json": {
      "examples": {
        "completion_conflict": {
          "summary": "Completion conflict",
          "value": {
            "code": "completion_conflict",
            "message": "This Transaction was already completed with different input."
          }
        },
        "payment_signature_mismatch": {
          "summary": "Signature mismatch",
          "value": {
            "code": "payment_signature_mismatch",
            "message": "The completion signature does not match the authorized payment."
          }
        },
        "price_not_found": {
          "summary": "Historical price unavailable",
          "value": {
            "code": "price_not_found",
            "message": "The historical payment Price is unavailable."
          }
        },
        "revision_mismatch": {
          "summary": "Revision mismatch",
          "value": {
            "code": "revision_mismatch",
            "message": "The completion revision does not match the authorized Price."
          }
        },
        "transaction_state_conflict": {
          "summary": "Transaction state conflict",
          "value": {
            "code": "transaction_state_conflict",
            "message": "Only an authorized Transaction can be completed."
          }
        }
      },
      "schema": {
        "additionalProperties": false,
        "description": "Error returned for this endpoint and HTTP status.",
        "properties": {
          "code": {
            "description": "Stable error code your app can check.",
            "enum": [
              "completion_conflict",
              "payment_signature_mismatch",
              "price_not_found",
              "revision_mismatch",
              "transaction_state_conflict"
            ],
            "type": "string"
          },
          "message": {
            "description": "Short explanation of what went wrong.",
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      }
    }
  },
  "description": "Conflict"
}
```

### 422

```json
{
  "content": {
    "application/json": {
      "examples": {
        "contract_values_mismatch": {
          "summary": "Contract values mismatch",
          "value": {
            "code": "contract_values_mismatch",
            "message": "Reported values must exactly match the revision contract."
          }
        },
        "invalid_request": {
          "summary": "Invalid request",
          "value": {
            "code": "invalid_request",
            "message": "The request is invalid."
          }
        },
        "invalid_values": {
          "summary": "Invalid completion values",
          "value": {
            "code": "invalid_values",
            "message": "Successful completion requires values and no failure code."
          }
        },
        "maximum_exceeded": {
          "summary": "Authorized maximum exceeded",
          "value": {
            "code": "maximum_exceeded",
            "message": "The calculated charge exceeds the authorized maximum."
          }
        },
        "payment_signature_required": {
          "summary": "Payment signature required",
          "value": {
            "code": "payment_signature_required",
            "message": "PAYMENT-SIGNATURE is required for completion."
          }
        }
      },
      "schema": {
        "additionalProperties": false,
        "description": "Error returned for this endpoint and HTTP status.",
        "properties": {
          "code": {
            "description": "Stable error code your app can check.",
            "enum": [
              "contract_values_mismatch",
              "invalid_request",
              "invalid_values",
              "maximum_exceeded",
              "payment_signature_required"
            ],
            "type": "string"
          },
          "message": {
            "description": "Short explanation of what went wrong.",
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      }
    }
  },
  "description": "Unprocessable Content"
}
```

### 500

```json
{
  "content": {
    "application/json": {
      "examples": {
        "internal_error": {
          "summary": "Internal error",
          "value": {
            "code": "internal_error",
            "message": "The request could not be completed."
          }
        },
        "payment_request_failed": {
          "summary": "Stored requirements invalid",
          "value": {
            "code": "payment_request_failed",
            "message": "The stored payment requirements are invalid."
          }
        }
      },
      "schema": {
        "additionalProperties": false,
        "description": "Error returned for this endpoint and HTTP status.",
        "properties": {
          "code": {
            "description": "Stable error code your app can check.",
            "enum": [
              "internal_error",
              "payment_request_failed"
            ],
            "type": "string"
          },
          "message": {
            "description": "Short explanation of what went wrong.",
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      }
    }
  },
  "description": "Internal Server Error"
}
```

### 503

```json
{
  "content": {
    "application/json": {
      "examples": {
        "live_payments_not_enabled": {
          "summary": "Live payments unavailable",
          "value": {
            "code": "live_payments_not_enabled",
            "message": "Paid live transactions are not enabled yet."
          }
        }
      },
      "schema": {
        "additionalProperties": false,
        "description": "Error returned for this endpoint and HTTP status.",
        "properties": {
          "code": {
            "const": "live_payments_not_enabled",
            "description": "Stable error code your app can check.",
            "type": "string"
          },
          "message": {
            "description": "Short explanation of what went wrong.",
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      }
    }
  },
  "description": "Service Unavailable"
}
```

## First-party examples

### Report a failed merchant operation — cURL

```json
{
  "label": "Report a failed merchant operation — cURL",
  "lang": "shell",
  "source": "curl --request POST \\\n  --url \"$RECUUT_API_URL/merchant/v1/transactions/txn_00000000000070008000000000000000/complete\" \\\n  --header \"Authorization: Bearer $RECUUT_API_KEY\" \\\n  --header 'Content-Type: application/json' \\\n  --header \"PAYMENT-SIGNATURE: $PAYMENT_SIGNATURE\" \\\n  --data '{\"failure_code\":\"merchant_operation_failed\",\"outcome\":\"failed\",\"resource_execution\":{\"duration_ms\":148,\"response_content_type\":\"application/json\",\"response_size_bytes\":96,\"response_status\":500},\"revision_id\":\"acr_00000000000070008000000000000000\"}'\n",
  "x-recuut-request-example": "failed"
}
```

```shell
curl --request POST \
  --url "$RECUUT_API_URL/merchant/v1/transactions/txn_00000000000070008000000000000000/complete" \
  --header "Authorization: Bearer $RECUUT_API_KEY" \
  --header 'Content-Type: application/json' \
  --header "PAYMENT-SIGNATURE: $PAYMENT_SIGNATURE" \
  --data '{"failure_code":"merchant_operation_failed","outcome":"failed","resource_execution":{"duration_ms":148,"response_content_type":"application/json","response_size_bytes":96,"response_status":500},"revision_id":"acr_00000000000070008000000000000000"}'

```

### Complete a successful transaction — cURL

```json
{
  "label": "Complete a successful transaction — cURL",
  "lang": "shell",
  "source": "curl --request POST \\\n  --url \"$RECUUT_API_URL/merchant/v1/transactions/txn_00000000000070008000000000000000/complete\" \\\n  --header \"Authorization: Bearer $RECUUT_API_KEY\" \\\n  --header 'Content-Type: application/json' \\\n  --header \"PAYMENT-SIGNATURE: $PAYMENT_SIGNATURE\" \\\n  --data '{\"outcome\":\"succeeded\",\"resource_execution\":{\"duration_ms\":84,\"response_content_type\":\"application/json\",\"response_size_bytes\":312,\"response_status\":200},\"revision_id\":\"acr_00000000000070008000000000000000\",\"values\":{\"input_tokens\":\"1000\"}}'\n",
  "x-recuut-request-example": "complete_succeeded"
}
```

```shell
curl --request POST \
  --url "$RECUUT_API_URL/merchant/v1/transactions/txn_00000000000070008000000000000000/complete" \
  --header "Authorization: Bearer $RECUUT_API_KEY" \
  --header 'Content-Type: application/json' \
  --header "PAYMENT-SIGNATURE: $PAYMENT_SIGNATURE" \
  --data '{"outcome":"succeeded","resource_execution":{"duration_ms":84,"response_content_type":"application/json","response_size_bytes":312,"response_status":200},"revision_id":"acr_00000000000070008000000000000000","values":{"input_tokens":"1000"}}'

```

## Canonical operation

```json
{
  "description": "Tell Recuut whether your work succeeded or failed. Recuut then finishes the payment. A finished successful payment includes a receipt.",
  "operationId": "payments.transactions.complete",
  "parameters": [
    {
      "description": "Server-issued transaction identifier.",
      "example": "txn_00000000000070008000000000000000",
      "in": "path",
      "name": "transaction_id",
      "required": true,
      "schema": {
        "description": "Server-issued transaction identifier.",
        "examples": [
          "txn_00000000000070008000000000000000"
        ],
        "pattern": "^txn_[0-9a-f]{12}7[0-9a-f]{3}[89ab][0-9a-f]{15}$",
        "title": "Transaction Id",
        "type": "string",
        "x-recuut-public-id-prefix": "txn"
      }
    },
    {
      "description": "Payment proof created by the payer. Forward this base64 text unchanged. It is required to finish this payment. [See the decoded fields](/guides/concepts/x402-payment-retry/#what-the-encoded-headers-contain).",
      "example": "$PAYMENT_SIGNATURE",
      "in": "header",
      "name": "PAYMENT-SIGNATURE",
      "required": true,
      "schema": {
        "$ref": "#/components/schemas/PaymentSignature"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "examples": {
          "complete_succeeded": {
            "summary": "Complete a successful transaction",
            "value": {
              "outcome": "succeeded",
              "resource_execution": {
                "duration_ms": 84,
                "response_content_type": "application/json",
                "response_size_bytes": 312,
                "response_status": 200
              },
              "revision_id": "acr_00000000000070008000000000000000",
              "values": {
                "input_tokens": "1000"
              }
            }
          },
          "failed": {
            "summary": "Report a failed merchant operation",
            "value": {
              "failure_code": "merchant_operation_failed",
              "outcome": "failed",
              "resource_execution": {
                "duration_ms": 148,
                "response_content_type": "application/json",
                "response_size_bytes": 96,
                "response_status": 500
              },
              "revision_id": "acr_00000000000070008000000000000000"
            }
          }
        },
        "schema": {
          "$ref": "#/components/schemas/CompleteRequest"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "examples": {
            "merchant_operation_failed": {
              "description": "The work failed, so no payment receipt is returned.",
              "summary": "Merchant operation failed",
              "value": {
                "payment_response": null,
                "receipt": null,
                "status": "failed",
                "transaction_hash": null,
                "transaction_id": "txn_00000000000070008000000000000000"
              }
            },
            "settlement_succeeded": {
              "description": "Payment succeeded. The response includes the payment receipt.",
              "summary": "Settlement succeeded",
              "value": {
                "payment_response": "eyJhbW91bnQiOiIxMDAwMDAwIiwiZXJyb3JSZWFzb24iOm51bGwsImV4dGVuc2lvbnMiOnsicmVjdXV0LXJlY2VpcHQiOnsiZW52aXJvbm1lbnQiOiJ0ZXN0IiwiZW52aXJvbm1lbnRfa2V5IjoidGVzdCIsImlkIjoicmN0XzAwMDAwMDAwMDAwMDcwMDA4MDAwMDAwMDAwMDAwMDAwIiwiaXNzdWVkX2F0IjoiMjAyNi0wOC0xMlQwOTozMDowMC4wMDBaIiwicGF5bWVudCI6eyJhc3NldCI6IlVT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4NDUzMiIsInBheWVyIjoiMHgxMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExIiwic3VjY2VzcyI6dHJ1ZSwidHJhbnNhY3Rpb24iOiIweGFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWEifQ==",
                "receipt": {
                  "environment": "test",
                  "environment_key": "test",
                  "id": "rct_00000000000070008000000000000000",
                  "issued_at": "2026-08-12T09:30:00.000Z",
                  "payment": {
                    "asset": "USDC",
                    "asset_id": "0x3333333333333333333333333333333333333333",
                    "authorized_atomic": "1000000",
                    "network": "eip155:84532",
                    "payer": "0x1111111111111111111111111111111111111111",
                    "recipient": "0x2222222222222222222222222222222222222222",
                    "scheme": "exact",
                    "settled_atomic": "1000000",
                    "transaction_hash": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  },
                  "price": {
                    "calculation_mode": "fixed",
                    "currency": "USD",
                    "id": "prc_00000000000070008000000000000000",
                    "label": "Quarterly report access"
                  },
                  "resource": {
                    "id": "res_00000000000070008000000000000000",
                    "name": "Quarterly report",
                    "url": "https://merchant.example/reports/quarterly"
                  },
                  "schema_version": 2,
                  "seller": {
                    "id": "org_00000000000070008000000000000000",
                    "name": "Acme Research"
                  },
                  "transaction_id": "txn_00000000000070008000000000000000"
                },
                "status": "succeeded",
                "transaction_hash": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "transaction_id": "txn_00000000000070008000000000000000"
              }
            }
          },
          "schema": {
            "$ref": "#/components/schemas/CompletionResult"
          }
        }
      },
      "description": "OK",
      "headers": {
        "PAYMENT-RESPONSE": {
          "description": "Proof that payment succeeded. Return this base64 text unchanged. [See the decoded fields](/guides/concepts/x402-payment-retry/#what-the-encoded-headers-contain).",
          "required": false,
          "schema": {
            "contentEncoding": "base64",
            "contentMediaType": "application/json",
            "examples": [
              "eyJhbW91bnQiOiIxMDAwMDAwIiwiZXJyb3JSZWFzb24iOm51bGwsImV4dGVuc2lvbnMiOnsicmVjdXV0LXJlY2VpcHQiOnsiZW52aXJvbm1lbnQiOiJ0ZXN0IiwiZW52aXJvbm1lbnRfa2V5IjoidGVzdCIsImlkIjoicmN0XzAwMDAwMDAwMDAwMDcwMDA4MDAwMDAwMDAwMDAwMDAwIiwiaXNzdWVkX2F0IjoiMjAyNi0wOC0xMlQwOTozMDowMC4wMDBaIiwicGF5bWVudCI6eyJhc3NldCI6IlVTREMiLCJhc3NldF9pZCI6IjB4MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMyIsImF1dGhvcml6ZWRfYXRvbWljIjoiMTAwMDAwMCIsIm5ldHdvcmsiOiJlaXAxNTU6ODQ1MzIiLCJwYXllciI6IjB4MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMSIsInJlY2lwaWVudCI6IjB4MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMiIsInNjaGVtZSI6ImV4YWN0Iiwic2V0dGxlZF9hdG9taWMiOiIxMDAwMDAwIiwidHJhbnNhY3Rpb25faGFzaCI6IjB4YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYSJ9LCJwcmljZSI6eyJjYWxjdWxhdGlvbl9tb2RlIjoiZml4ZWQiLCJjdXJyZW5jeSI6IlVTRCIsImlkIjoicHJjXzAwMDAwMDAwMDAwMDcwMDA4MDAwMDAwMDAwMDAwMDAwIiwibGFiZWwiOiJRdWFydGVybHkgcmVwb3J0IGFjY2VzcyJ9LCJyZXNvdXJjZSI6eyJpZCI6InJlc18wMDAwMDAwMDAwMDA3MDAwODAwMDAwMDAwMDAwMDAwMCIsIm5hbWUiOiJRdWFydGVybHkgcmVwb3J0IiwidXJsIjoiaHR0cHM6Ly9tZXJjaGFudC5leGFtcGxlL3JlcG9ydHMvcXVhcnRlcmx5In0sInNjaGVtYV92ZXJzaW9uIjoyLCJzZWxsZXIiOnsiaWQiOiJvcmdfMDAwMDAwMDAwMDAwNzAwMDgwMDAwMDAwMDAwMDAwMDAiLCJuYW1lIjoiQWNtZSBSZXNlYXJjaCJ9LCJ0cmFuc2FjdGlvbl9pZCI6InR4bl8wMDAwMDAwMDAwMDA3MDAwODAwMDAwMDAwMDAwMDAwMCJ9fSwibmV0d29yayI6ImVpcDE1NTo4NDUzMiIsInBheWVyIjoiMHgxMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExIiwic3VjY2VzcyI6dHJ1ZSwidHJhbnNhY3Rpb24iOiIweGFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWEifQ=="
            ],
            "minLength": 1,
            "type": "string"
          }
        }
      }
    },
    "202": {
      "content": {
        "application/json": {
          "examples": {
            "settlement_pending": {
              "description": "Payment is still in progress, so no payment receipt is returned yet.",
              "summary": "Settlement pending",
              "value": {
                "payment_response": null,
                "receipt": null,
                "status": "settling",
                "transaction_hash": null,
                "transaction_id": "txn_00000000000070008000000000000000"
              }
            },
            "settlement_reconciling": {
              "description": "Recuut is checking the payment, so no payment receipt is returned yet.",
              "summary": "Settlement reconciling",
              "value": {
                "payment_response": null,
                "receipt": null,
                "status": "reconciling",
                "transaction_hash": null,
                "transaction_id": "txn_00000000000070008000000000000000"
              }
            }
          },
          "schema": {
            "$ref": "#/components/schemas/CompletionResult"
          }
        }
      },
      "description": "Accepted"
    },
    "400": {
      "content": {
        "application/json": {
          "examples": {
            "invalid_payment_signature": {
              "summary": "Malformed payment signature",
              "value": {
                "code": "invalid_payment_signature",
                "message": "PAYMENT-SIGNATURE is not valid base64-encoded JSON."
              }
            }
          },
          "schema": {
            "additionalProperties": false,
            "description": "Error returned for this endpoint and HTTP status.",
            "properties": {
              "code": {
                "const": "invalid_payment_signature",
                "description": "Stable error code your app can check.",
                "type": "string"
              },
              "message": {
                "description": "Short explanation of what went wrong.",
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        }
      },
      "description": "Bad Request"
    },
    "401": {
      "content": {
        "application/json": {
          "examples": {
            "unauthenticated": {
              "summary": "API key required",
              "value": {
                "code": "unauthenticated",
                "message": "A valid Recuut API key is required."
              }
            }
          },
          "schema": {
            "additionalProperties": false,
            "description": "Error returned for this endpoint and HTTP status.",
            "properties": {
              "code": {
                "const": "unauthenticated",
                "description": "Stable error code your app can check.",
                "type": "string"
              },
              "message": {
                "description": "Short explanation of what went wrong.",
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        }
      },
      "description": "Unauthorized"
    },
    "403": {
      "content": {
        "application/json": {
          "examples": {
            "forbidden": {
              "summary": "Capability denied",
              "value": {
                "code": "forbidden",
                "message": "This API key does not allow this operation."
              }
            }
          },
          "schema": {
            "additionalProperties": false,
            "description": "Error returned for this endpoint and HTTP status.",
            "properties": {
              "code": {
                "const": "forbidden",
                "description": "Stable error code your app can check.",
                "type": "string"
              },
              "message": {
                "description": "Short explanation of what went wrong.",
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        }
      },
      "description": "Forbidden"
    },
    "404": {
      "content": {
        "application/json": {
          "examples": {
            "transaction_not_found": {
              "summary": "Transaction not found",
              "value": {
                "code": "transaction_not_found",
                "message": "Transaction not found."
              }
            }
          },
          "schema": {
            "additionalProperties": false,
            "description": "Error returned for this endpoint and HTTP status.",
            "properties": {
              "code": {
                "const": "transaction_not_found",
                "description": "Stable error code your app can check.",
                "type": "string"
              },
              "message": {
                "description": "Short explanation of what went wrong.",
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        }
      },
      "description": "Not Found"
    },
    "409": {
      "content": {
        "application/json": {
          "examples": {
            "completion_conflict": {
              "summary": "Completion conflict",
              "value": {
                "code": "completion_conflict",
                "message": "This Transaction was already completed with different input."
              }
            },
            "payment_signature_mismatch": {
              "summary": "Signature mismatch",
              "value": {
                "code": "payment_signature_mismatch",
                "message": "The completion signature does not match the authorized payment."
              }
            },
            "price_not_found": {
              "summary": "Historical price unavailable",
              "value": {
                "code": "price_not_found",
                "message": "The historical payment Price is unavailable."
              }
            },
            "revision_mismatch": {
              "summary": "Revision mismatch",
              "value": {
                "code": "revision_mismatch",
                "message": "The completion revision does not match the authorized Price."
              }
            },
            "transaction_state_conflict": {
              "summary": "Transaction state conflict",
              "value": {
                "code": "transaction_state_conflict",
                "message": "Only an authorized Transaction can be completed."
              }
            }
          },
          "schema": {
            "additionalProperties": false,
            "description": "Error returned for this endpoint and HTTP status.",
            "properties": {
              "code": {
                "description": "Stable error code your app can check.",
                "enum": [
                  "completion_conflict",
                  "payment_signature_mismatch",
                  "price_not_found",
                  "revision_mismatch",
                  "transaction_state_conflict"
                ],
                "type": "string"
              },
              "message": {
                "description": "Short explanation of what went wrong.",
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        }
      },
      "description": "Conflict"
    },
    "422": {
      "content": {
        "application/json": {
          "examples": {
            "contract_values_mismatch": {
              "summary": "Contract values mismatch",
              "value": {
                "code": "contract_values_mismatch",
                "message": "Reported values must exactly match the revision contract."
              }
            },
            "invalid_request": {
              "summary": "Invalid request",
              "value": {
                "code": "invalid_request",
                "message": "The request is invalid."
              }
            },
            "invalid_values": {
              "summary": "Invalid completion values",
              "value": {
                "code": "invalid_values",
                "message": "Successful completion requires values and no failure code."
              }
            },
            "maximum_exceeded": {
              "summary": "Authorized maximum exceeded",
              "value": {
                "code": "maximum_exceeded",
                "message": "The calculated charge exceeds the authorized maximum."
              }
            },
            "payment_signature_required": {
              "summary": "Payment signature required",
              "value": {
                "code": "payment_signature_required",
                "message": "PAYMENT-SIGNATURE is required for completion."
              }
            }
          },
          "schema": {
            "additionalProperties": false,
            "description": "Error returned for this endpoint and HTTP status.",
            "properties": {
              "code": {
                "description": "Stable error code your app can check.",
                "enum": [
                  "contract_values_mismatch",
                  "invalid_request",
                  "invalid_values",
                  "maximum_exceeded",
                  "payment_signature_required"
                ],
                "type": "string"
              },
              "message": {
                "description": "Short explanation of what went wrong.",
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        }
      },
      "description": "Unprocessable Content"
    },
    "500": {
      "content": {
        "application/json": {
          "examples": {
            "internal_error": {
              "summary": "Internal error",
              "value": {
                "code": "internal_error",
                "message": "The request could not be completed."
              }
            },
            "payment_request_failed": {
              "summary": "Stored requirements invalid",
              "value": {
                "code": "payment_request_failed",
                "message": "The stored payment requirements are invalid."
              }
            }
          },
          "schema": {
            "additionalProperties": false,
            "description": "Error returned for this endpoint and HTTP status.",
            "properties": {
              "code": {
                "description": "Stable error code your app can check.",
                "enum": [
                  "internal_error",
                  "payment_request_failed"
                ],
                "type": "string"
              },
              "message": {
                "description": "Short explanation of what went wrong.",
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        }
      },
      "description": "Internal Server Error"
    },
    "503": {
      "content": {
        "application/json": {
          "examples": {
            "live_payments_not_enabled": {
              "summary": "Live payments unavailable",
              "value": {
                "code": "live_payments_not_enabled",
                "message": "Paid live transactions are not enabled yet."
              }
            }
          },
          "schema": {
            "additionalProperties": false,
            "description": "Error returned for this endpoint and HTTP status.",
            "properties": {
              "code": {
                "const": "live_payments_not_enabled",
                "description": "Stable error code your app can check.",
                "type": "string"
              },
              "message": {
                "description": "Short explanation of what went wrong.",
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        }
      },
      "description": "Service Unavailable"
    }
  },
  "security": [
    {
      "OrganizationApiKeyAuth": []
    }
  ],
  "summary": "Complete a transaction",
  "tags": [
    "transactions"
  ],
  "x-codeSamples": [
    {
      "label": "Report a failed merchant operation — cURL",
      "lang": "shell",
      "source": "curl --request POST \\\n  --url \"$RECUUT_API_URL/merchant/v1/transactions/txn_00000000000070008000000000000000/complete\" \\\n  --header \"Authorization: Bearer $RECUUT_API_KEY\" \\\n  --header 'Content-Type: application/json' \\\n  --header \"PAYMENT-SIGNATURE: $PAYMENT_SIGNATURE\" \\\n  --data '{\"failure_code\":\"merchant_operation_failed\",\"outcome\":\"failed\",\"resource_execution\":{\"duration_ms\":148,\"response_content_type\":\"application/json\",\"response_size_bytes\":96,\"response_status\":500},\"revision_id\":\"acr_00000000000070008000000000000000\"}'\n",
      "x-recuut-request-example": "failed"
    },
    {
      "label": "Complete a successful transaction — cURL",
      "lang": "shell",
      "source": "curl --request POST \\\n  --url \"$RECUUT_API_URL/merchant/v1/transactions/txn_00000000000070008000000000000000/complete\" \\\n  --header \"Authorization: Bearer $RECUUT_API_KEY\" \\\n  --header 'Content-Type: application/json' \\\n  --header \"PAYMENT-SIGNATURE: $PAYMENT_SIGNATURE\" \\\n  --data '{\"outcome\":\"succeeded\",\"resource_execution\":{\"duration_ms\":84,\"response_content_type\":\"application/json\",\"response_size_bytes\":312,\"response_status\":200},\"revision_id\":\"acr_00000000000070008000000000000000\",\"values\":{\"input_tokens\":\"1000\"}}'\n",
      "x-recuut-request-example": "complete_succeeded"
    }
  ]
}
```
