简体   繁体   English

如何从Stripe检索身份证件?

[英]How to retrieve identity documents from Stripe?

I can successfully upload identification for Stripe connect accounts via the Stripe provided PHP library. 我可以通过Stripe提供的PHP库成功上传Stripe连接帐户的标识。 In turn, this correctly verifies the user. 反过来,这可以正确验证用户。

This is done in a snippet not unlike the following: 这是在一个片段中完成的,与以下内容不同:

    $result = FileUpload::create([
        'purpose' => 'identity_document',
        'file' => fopen($filePath, 'r')
    ], [
        'stripe_account' => $accountStripeId
    ]);

From this request, I do get the following: 从此请求中,我得到以下信息:

  • A valid response, including the file ID (though as noted in the documentation, I receive null for the url because the type is identity_document ) 有效的响应,包括文件ID(尽管如文档中所述,但我收到的URL为null,因为类型为identity_document

  • The connected account is marked as verified in the stripe system. 在条带系统中, verified连接的帐户被标记为verified

I should be content with this, as technically it's working, but it's hard to verify. 我应该对此感到满意,因为从技术上讲它正在工作,但是很难验证。 I can't: 我不能:

  • See the uploaded ID in the dashboard (either as myself or when viewing the dashboard as the connected user) 在仪表板中查看上载的ID(以我本人或以已连接用户的身份查看仪表板时)

  • Can't retrieve the file upload via the returned File ID. 无法通过返回的文件ID检索文件上传。

So.. Is there a way to retrieve the file upload via the upload ID for an identity_document type document? 所以..是否有一种方法可以通过identity_document类型文档的上载ID来检索文件上载?

EDIT 编辑

When trying to access a file via the Stripe provided PHP library, I receive the following message: 当尝试通过Stripe提供的PHP库访问文件时,我收到以下消息:

{
  "error": {
    "type": "invalid_request_error",
    "message": "No such file upload: file_XXXXXXXXXXXXXXXXXXXXXXXX",
    "param": "id"
  }
}

You can retrieve an uploaded file by making a GET request to the uploads.stripe.com/v1/files endpoint. 您可以通过对uploads.stripe.com/v1/files端点发出GET请求来检索上传的文件。

curl https://uploads.stripe.com/v1/files/fil_15BZxW2eZvKYlo2CvQbrn9dc \
  -u sk_test_BQokikJOvBiI2HlWgH4olfQ2:

Currently, the official Stripe PHP SDK does not have this facility implemented. 当前,官方的Stripe PHP SDK尚未实现此功能。

You can do it like so: 您可以这样做:

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_URL => 'https://uploads.stripe.com/v1/files/' . $fileId,
    CURLOPT_HTTPHEADER => array('Authorization: ' . $apiKey)
));
$file = curl_exec($curl);

我相信对此的简单答案是,这是设计使然,一旦上传,您将无法检索到所述文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM