PHP ActiveX Stripe: Retrieve a File Upload

Back to Index

Retrieves the details of an existing file object. Supply the unique file upload ID from a file creation request, and Stripe will return the corresponding transfer information.

Documentation: https://stripe.com/docs/api/curl#retrieve_file_upload

CURL Command

curl https://files.stripe.com/v1/files/file_1BnEEuGswQrCoh0XqB3XkqAg \
   -u STRIPE_SECRET_KEY:

PHP ActiveX Example

<?php

$rest = new COM("Chilkat_9_5_0.Rest");

//  URL: https://files.stripe.com/v1/files/file_1BnEEuGswQrCoh0XqB3XkqAg
$bTls = 1;
$port = 443;
$bAutoReconnect = 1;
$success = $rest->Connect('files.stripe.com',$port,$bTls,$bAutoReconnect);
if ($success != 1) {
    print 'ConnectFailReason: ' . $rest->ConnectFailReason . "\n";
    print $rest->LastErrorText . "\n";
    exit;
}

$rest->SetAuthBasic('STRIPE_SECRET_KEY','');

$sbResponseBody = new COM("Chilkat_9_5_0.StringBuilder");
$success = $rest->FullRequestNoBodySb('GET','/v1/files/file_1BnEEuGswQrCoh0XqB3XkqAg',$sbResponseBody);
if ($success != 1) {
    print $rest->LastErrorText . "\n";
    exit;
}

$jsonResponse = new COM("Chilkat_9_5_0.JsonObject");
$jsonResponse->LoadSb($sbResponseBody);

$id = $jsonResponse->stringOf('id');
$object = $jsonResponse->stringOf('object');
$created = $jsonResponse->IntOf('created');
$filename = $jsonResponse->stringOf('filename');
$purpose = $jsonResponse->stringOf('purpose');
$size = $jsonResponse->IntOf('size');
$type = $jsonResponse->stringOf('type');
$url = $jsonResponse->stringOf('url');

?>

Sample JSON Response Body

{
  "id": "file_1BnEEuGswQrCoh0XqB3XkqAg",
  "object": "file_upload",
  "created": 1516661888,
  "filename": "path",
  "purpose": "sigma_scheduled_query",
  "size": 500,
  "type": "csv",
  "url": "https://stripe-upload-api.s3.amazonaws.com/uploads/file_1BnEEuGswQrCoh0XqB3XkqAg?AWSAccessKeyId=KEY_ID\u0026Expires=TIMESTAMP\u0026Signature=SIGNATURE"
}