> ## Documentation Index
> Fetch the complete documentation index at: https://devzone.nayax.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 上传退款文件

export const EndpointCard = ({method = "API", title, children, href, arrow = true}) => {
  const METHOD_STYLES = {
    GET: {
      bg: "mint-bg-green-400/20 dark:mint-bg-green-400/20",
      text: "mint-text-green-700 dark:mint-text-green-400",
      border: "mint-border-green-300 dark:mint-border-green-700"
    },
    POST: {
      bg: "mint-bg-blue-400/20 dark:mint-bg-blue-400/20",
      text: "mint-text-blue-700 dark:mint-text-blue-400"
    },
    PUT: {
      bg: "mint-bg-yellow-400/20 dark:mint-bg-yellow-400/20",
      text: "mint-text-yellow-700 dark:mint-text-yellow-400"
    },
    PATCH: {
      bg: "mint-bg-orange-400/20 dark:mint-bg-orange-400/20",
      text: "mint-text-orange-700 dark:mint-text-orange-400"
    },
    DELETE: {
      bg: "mint-bg-red-400/20 dark:mint-bg-red-400/20",
      text: "mint-text-red-700 dark:mint-text-red-400"
    },
    API: {
      bg: "mint-bg-black",
      text: "mint-text-white"
    }
  };
  const MethodBadge = ({method}) => {
    const style = METHOD_STYLES[method?.toUpperCase()] ?? METHOD_STYLES.GET;
    return <span className={`
          method-pill rounded-lg font-bold px-1.5 py-0.5 text-xs leading-5 ${style.bg} ${style.text}`}>
        {method?.toUpperCase()}
      </span>;
  };
  const content = <div className="group flex items-center gap-4 border border-gray-200 dark:border-gray-700 rounded-xl p-5 bg-white dark:bg-[#1e1e1e] hover:border-gray-400 dark:hover:border-gray-500 hover:shadow-md transition-all cursor-pointer">
      {}
      <div className="flex-1 min-w-0">
        <p className="font-semibold text-gray-900 dark:text-white text-sm leading-snug">{title}</p>
        {children && <p className="mt-1 text-sm text-gray-500 dark:text-gray-400 line-clamp-2">{children}</p>}
      </div>

      {}
      <div className="shrink-0">
        <MethodBadge method={method} />
      </div>
    </div>;
  if (!href) return content;
  return <a href={href} className="block no-underline border-b-0 mb-2">
      {content}
    </a>;
};

如果客户直接联系账单提供商申请退款，则在接受退款时必须将 `IsRefundedExternally` 设置为 `true`，并将账单提供商收到的文件添加到 `RefundedDocumentUrl` 中。

在 Nayax Core 中，选择\*\*“外部退款”\*\*接受或拒绝退款时，即可设置此项。您可以上传退款文件。参见下图：

<Frame>
  <img src="https://mintcdn.com/nayax-44d6e37b/gp-udlFbAMEECcYg/images/docs/upload-refund-document/image1.png?fit=max&auto=format&n=gp-udlFbAMEECcYg&q=85&s=02fb6b19423025ae920aa4049deeac68" width="1600" height="824" data-path="images/docs/upload-refund-document/image1.png" />
</Frame>

## Lynx API

使用 Lynx API，您还可以上传退款文档以获取 `RefundedDocumentUrl`。以下端点用于此目的：

<EndpointCard title="上传退款文件" href="/reference/lynx/payment/upload-refund-documentation" method="post" />

<Warning>
  验证

  请参阅本文档的[“安全和令牌”](/docs/manage-data-operations/lynx-api/security)页面，了解如何访问您的令牌以及如何正确使用它们来验证您的 API 请求。
</Warning>

使用[“上传退款文档”](/reference/lynx/payment/upload-refund-documentation)端点上传账单提供商收到的文件。请参阅以下请求示例：

```sh Request theme={null}
curl --request POST \
     --url https://qa-lynx.nayax.com/operational/v1/payment/upload-refund \
     --header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "FileName": "string",
  "FileData": "string",
  "TransactionId": 0,
  "SiteId": 0,
  "MachineAuTime": "2024-10-10T16:30:37.179Z"
}
'
```

下表详细说明了请求的主体参数。

| 姓名 | 类型 | 描述 |
| - | - | - |
| 文件名 | string | 正在上传的文件的名称。 |
| 文件数据 | base64 | 正在上传的文件的 base64 编码内容。您可以使用[PDF 到 base 64 在线转换器](https://base64.guru/converter/encode/pdf)。 |
| 交易ID | int64 | 与文件关联的交易的唯一标识符。 |
| 站点编号 | int32 | 发生交易的站点的唯一标识符。 |
| 机器AuTime | 日期时间 | 机器的授权时间与交易相关联。 |

<Note>
  `TransactionId`、`SiteId` 和 `MachineAuTime` 必须与退款请求中发送的值相同。
</Note>

一旦请求成功完成，响应将包含上传文档的 URL。

```json Response theme={null}
{
  "FileURL": "string"
}
```

Now you can add this URL to the `RefundedDocumentUrl` flag when using the [Approve Refund](/docs/manage-data-operations/lynx-api/refunds/approve-or-decline-a-refund) endpoint.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.