dimanche 5 janvier 2020

Only plainfile resource streams are supported

I am trying to upload identity document to stripe,

I have basic authorization in my server as well, here is code

$b64 = base64_encode("$username:$password");
$auth = "Authorization: Basic $b64";
$opts = array(
    'http' => array(
        'method' => "GET",
        'header' => $auth,
        'user_agent' => 'bob',
    )
);
$context = stream_context_create($opts);
$fp = fopen($url, 'r', false, $context);

I have following code for uploading file to stripe

 \Stripe\FileUpload::create(
 array(
 "purpose" => "identity_document",
 "file" => $fp
 )
 );

but when i am trying to open file it is giving me following error

Api in ApiRequestor.php line 249:
Only plainfile resource streams are supported
in ApiRequestor.php line 249
at ApiRequestor->_processResourceParam(resource, true) in ApiRequestor.php line 210
at ApiRequestor->_requestRaw('post', '/v1/files', array('purpose' => 'identity_document', 'file' => resource), array()) in ApiRequestor.php line 64
at ApiRequestor->request('post', '/v1/files', array('purpose' => 'identity_document', 'file' => resource), array()) in ApiResource.php line 119
at ApiResource::_staticRequest('post', '/v1/files', array('purpose' => 'identity_document', 'file' => resource), null) in ApiResource.php line 158
at ApiResource::_create(array('purpose' => 'identity_document', 'file' => resource), null) in FileUpload.php line 49
at FileUpload::create(array('purpose' => 'identity_document', 'file' => resource)) in ProfileController.php line 959


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire