Creates a single use token that wraps the details of personally identifiable information (PII). This token can be used in place of a personal_id_number in the Account Update API method. These tokens can only be used once.
curl https://api.stripe.com/v1/tokens \
-u STRIPE_SECRET_KEY: \
-d pii[personal_id_number]=000000000 \
-X POST
<?php
// The version number (9_5_0) should match version of the Chilkat extension used, omitting the micro-version number.
// For example, if using Chilkat v9.5.0.48, then include as shown here:
include("chilkat_9_5_0.php");
$rest = new CkRest();
// URL: https://api.stripe.com/v1/tokens
$bTls = true;
$port = 443;
$bAutoReconnect = true;
$success = $rest->Connect('api.stripe.com',$port,$bTls,$bAutoReconnect);
if ($success != true) {
print 'ConnectFailReason: ' . $rest->get_ConnectFailReason() . "\n";
print $rest->lastErrorText() . "\n";
exit;
}
$rest->SetAuthBasic('STRIPE_SECRET_KEY','');
$rest->AddQueryParam('pii[personal_id_number]','000000000');
$strResponseBody = $rest->fullRequestFormUrlEncoded('POST','/v1/tokens');
if ($rest->get_LastMethodSuccess() != true) {
print $rest->lastErrorText() . "\n";
exit;
}
$jsonResponse = new CkJsonObject();
$jsonResponse->Load($strResponseBody);
$id = $jsonResponse->stringOf('id');
$object = $jsonResponse->stringOf('object');
$client_ip = $jsonResponse->IsNullOf('client_ip');
$created = $jsonResponse->IntOf('created');
$livemode = $jsonResponse->BoolOf('livemode');
$type = $jsonResponse->stringOf('type');
$used = $jsonResponse->BoolOf('used');
?>
{
"id": "pii_1BnETKGswQrCoh0XMUBp4DiD",
"object": "token",
"client_ip": null,
"created": 1516662782,
"livemode": false,
"type": "pii",
"used": false
}