gpt4 book ai didi

node.js - 无法使用 Stripe API 更新争议证据

转载 作者:太空宇宙 更新时间:2023-11-04 00:08:58 25 4
gpt4 key购买 nike

我的应用程序使用自定义连接帐户。我在通过 Stripe 的 API 更新争议证据时遇到问题。每次我尝试更新时,它都会说“没有这样的争议:dp_XXXXXX”。

Stripe Docs: Update a dispute

据我了解,我需要传递我的 strip key 、争议 ID 以及我想要更新为 evidence 对象的任何详细信息。

我没能将表单中收集的数据传递给 Stripe。因此,我尝试使用从 Stripe disputes list endpoint 返回的几个不同的争议 ID 对来自 Stripe 文档的示例请求进行硬编码。 。再次没有运气。

当前 Node 设置:

export async function update(data): Promise<any> {
return await stripe.disputes.update(data.id, { evidence: data.evidence })
.then((response) => {
return {
type: 'success',
message: 'Dispute updated.'
};
}).catch((error) => {
return {
type: 'error',
message: error.message,
errors: error
};
});
}

使用文档中的示例:

export async function update(): Promise<any> {
return await stripe.disputes.update(
'dp_XXXXXXXXXXXXXXX',
{
evidence: {
customer_name: 'Natalie Thomas',
product_description: 'Comfortable cotton t-shirt'
}
}
);
}

我也尝试使用curl来测试这不是我在Node中做错的事情。

curl https://api.stripe.com/v1/disputes/dp_XXXXXXX \
-u sk_test_XXXXXX: \
-d evidence[customer_name]="Jacob Garcia" \
-d evidence[product_description]="Comfortable cotton t-shirt"

目前正在开发中,因此我正在使用所有测试 key /测试环境。这是我在使用 API 时遇到的第一个问题。

这些争议是使用 Stripe 的测试卡 4000000000000259 创建的。

有什么想法吗?

更新:

我还测试了通过curl 检索特定争议并结束特定争议。我对这两个问题都遇到相同的错误。

最佳答案

在这里解决了我的问题。

尝试更新关联帐户时,您还必须将关联帐户的 ID 传递到 API 调用中。所以对于我原来的问题,它是:

stripe.disputes.update(
data.id,
{ evidence: data.evidence },
{ stripe_account: data.accountId }
)

如果不是关联帐户,那么您只需传递争议 ID 就可以了。

关于node.js - 无法使用 Stripe API 更新争议证据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50878127/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com