### Install Stripe Ruby Gem Source: https://docs.stripe.com/identity/handle-verification-outcomes Install the Stripe Ruby gem for server-side API access. Use `sudo gem install stripe` for a system-wide installation or add `gem 'stripe'` to your Gemfile if using bundler. ```bash sudo gem install stripe ``` -------------------------------- ### Install Stripe Ruby Gem Source: https://docs.stripe.com/identity/verify-identity-documents?platform=web&type=modal Install the Stripe Ruby gem for server-side access to the Stripe API. ```bash # Available as a gem sudo gem install stripe ``` -------------------------------- ### VerificationSession Creation Response Source: https://docs.stripe.com/identity/verify-identity-documents?platform=web&type=modal Example response from your server-side endpoint after successfully creating a VerificationSession. This response contains the session ID and the client secret. ```Command Line HTTP/1.1 200 OK Content-Type: application/json { id: "vs_QdfQQ6xfGNJR7ogV6", client_secret: "vs_QdfQQ6xfGNJR7ogV6_secret_live_..." } ``` -------------------------------- ### Node.js Webhook Endpoint for Stripe Events Source: https://docs.stripe.com/identity/handle-verification-outcomes This Node.js example demonstrates how to set up an Express server to receive Stripe webhook events. It includes crucial steps for verifying the event's authenticity using the Stripe signature and secret. Ensure your secret key and endpoint secret are securely managed and not hardcoded. ```javascript // Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. // Find your keys at https://dashboard.stripe.com/apikeys. const stripe = require('stripe')('<>'); // You can find your endpoint's secret in your webhook settings const endpointSecret = 'whsec_...'; // This example uses Express to receive webhooks const express = require('express'); // Use body-parser to retrieve the raw body as a buffer const bodyParser = require('body-parser'); const app = express(); // Use JSON parser for all non-webhook routes app.use((req, res, next) => { if (req.originalUrl === '/webhook') { next(); } else { bodyParser.json()(req, res, next); } }); app.post('/webhook', bodyParser.raw({type: 'application/json'}), (req, res) => { let event; // Verify the event came from Stripe try { const sig = req.headers['stripe-signature']; event = stripe.webhooks.constructEvent(req.body, sig, endpointSecret); } catch (err) { // On error, log and return the error message console.log(`❌ Error message: ${err.message}`); return res.status(400).send(`Webhook Error: ${err.message}`); } // Successfully constructed event res.json({received: true}); }); app.listen(4242, () => { console.log('Running on port 4242'); }); ``` -------------------------------- ### Handle Stripe Identity Verification Webhook Events (Node.js) Source: https://docs.stripe.com/identity/handle-verification-outcomes This Node.js example demonstrates how to set up an Express server to receive and verify Stripe webhook events. It specifically handles the `identity.verification_session.verified` event, which is triggered when all verification checks pass. Ensure your secret keys and endpoint secret are securely managed and not hardcoded. ```javascript // Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. // Find your keys at https://dashboard.stripe.com/apikeys. const stripe = require('stripe')('<>'); // You can find your endpoint's secret in your webhook settings const endpointSecret = 'whsec_...'; // This example uses Express to receive webhooks const express = require('express'); // Use body-parser to retrieve the raw body as a buffer const bodyParser = require('body-parser'); const app = express(); // Use JSON parser for all non-webhook routes app.use((req, res, next) => { if (req.originalUrl === '/webhook') { next(); } else { bodyParser.json()(req, res, next); } }); app.post('/webhook', bodyParser.raw({type: 'application/json'}), (req, res) => { let event; // Verify the event came from Stripe try { const sig = req.headers['stripe-signature']; event = stripe.webhooks.constructEvent(req.body, sig, endpointSecret); } catch (err) { // On error, log and return the error message console.log(`❌ Error message: ${err.message}`); return res.status(400).send(`Webhook Error: ${err.message}`); } // Successfully constructed eventswitch (event.type) { case 'identity.verification_session.verified': { // All the verification checks passed const verificationSession = event.data.object; break; } } res.json({received: true}); }); app.listen(4242, () => { console.log('Running on port 4242'); }); ``` -------------------------------- ### Redacted VerificationSession Response Example Source: https://docs.stripe.com/identity/verification-sessions This JSON shows the structure of a VerificationSession after redaction, with PII fields replaced by placeholders. The `redaction.status` field indicates the redaction state. ```json { "id": "vs_orWziM4j7CiRL8J4vQmXgW2w", "object": "identity.verification_session", "created": 1610744321, "last_error": null, "last_verification_report": "vr_orWziM4j7CiRL8J4vQmXgW2w", "livemode": true, "options": {}, "status": "verified", "type": "document", "url": null, "client_secret": null, "redaction": { "status": "redacted" }, "verified_outputs": { "first_name": "[redacted]", "last_name": "[redacted]", "dob": { "year": 1, "month": 1, "day": 1 }, "address": { "line1": "[redacted]", "city": "[redacted]", "state": "[redacted]", "postal_code": "[redacted]", "country": "US" }, "id_number_type": null }, "metadata": {} // Metadata will also be redacted } ``` -------------------------------- ### Example VerificationReport with Verified Selfie Source: https://docs.stripe.com/identity/verification-checks?type=selfie This JSON object represents a successful VerificationReport, showing that both the document and selfie checks passed. The `selfie` object contains details about the selfie submission, including its status and associated file IDs. ```json { "id": "vr_", "object": "identity.verification_report", "type": "document", "verification_session": "vs_", "created": 1611776872, "livemode": true, "options": { "document": { "require_matching_selfie": true } }, "document": { "status": "verified", "error": null, "first_name": "Jenny", "last_name": "Rosen", "address": { "line1": "1234 Main St.", "city": "San Francisco", "state": "CA", "postal_code": "94111", "country": "US" }, "document_type": "id_card", "expiration_date": { "day": 17, "month": 7, "year": 2024 }, "files": ["file_", "file_"], "issued_date": { "day": 4, "month": 27, "year": 2021 }, "issuing_country": "US" }, "selfie": { "status": "verified", "error": null, "document": "file_", "selfie": "file_" } } ``` -------------------------------- ### Initialize Stripe.js with Publishable Key Source: https://docs.stripe.com/identity/verify-identity-documents?platform=web&type=modal Initialize Stripe.js by passing your publishable API key to the Stripe constructor. Replace 'pk_test_TYooMQauvdEDq54NiTphI7jx' with your actual live publishable key in production. ```html Verify your identity ``` -------------------------------- ### Initialize and Show Verification Modal (HTML/JS) Source: https://docs.stripe.com/identity/verify-identity-documents?platform=web&type=modal Client-side JavaScript to initialize Stripe and display the document upload modal when a button is clicked. It fetches the client secret from your server and uses `stripe.verifyIdentity` to launch the modal. ```html Verify your identity ``` -------------------------------- ### Create VerificationSession Source: https://docs.stripe.com/identity/verification-sessions Creates a VerificationSession to initiate a verification process. You can specify the type of verification check to perform, such as 'document' or 'id_number'. It's recommended to use an idempotency key to prevent duplicate sessions. ```APIDOC ## POST /v1/identity/verification_sessions ### Description Creates a VerificationSession to initiate a verification process. You can specify the type of verification check to perform, such as 'document' or 'id_number'. It's recommended to use an idempotency key to prevent duplicate sessions. ### Method POST ### Endpoint https://api.stripe.com/v1/identity/verification_sessions ### Parameters #### Query Parameters - **type** (string) - Required - Specifies the type of verification check to perform. Supported types include 'document' and 'id_number'. ### Request Example ```curl curl https://api.stripe.com/v1/identity/verification_sessions \ -u "<>:" \ -d type=document ``` ### Response #### Success Response (200) - **id** (string) - The unique ID of the VerificationSession. - **type** (string) - The type of verification check performed. - **status** (string) - The current status of the verification session. - **requires_input** (boolean) - Indicates if further input is required for the verification. #### Response Example { "id": "vs_12345abcde", "type": "document", "status": "requires_input", "requires_input": true } ``` -------------------------------- ### Create a VerificationSession Source: https://docs.stripe.com/identity/verification-sessions Use this cURL command to create a new VerificationSession for document verification. Replace '<>' with your actual Stripe secret key. ```curl curl https://api.stripe.com/v1/identity/verification_sessions \ -u "<>:" \ -d type=document ``` -------------------------------- ### Create Verification Session with User Details (API) Source: https://docs.stripe.com/identity/verification-flows Attach user-specific data like phone, email, and a client reference ID when creating a verification session using a flow. ```curl curl https://api.stripe.com/v1/identity/verification_sessions \ -u "<>:" \ -d "verification_flow={{IDENTITYVERIFICATIONFLOW_ID}}" \ -d "provided_details[phone]=5555551212" \ --data-urlencode "provided_details[email]=user@domain.com" \ -d client_reference_id=reference-token ``` -------------------------------- ### Curl Request to Create VerificationSession Source: https://docs.stripe.com/identity/verify-identity-documents?platform=web&type=modal Use this curl command to test your server-side endpoint for creating a VerificationSession. Ensure your web server is running. ```Command Line curl -X POST -is "http://localhost:4242/create-verification-session" -d "" ``` -------------------------------- ### Include Stripe.js Library Source: https://docs.stripe.com/identity/verify-identity-documents?platform=web&type=modal Add the Stripe.js library to your HTML page by including a script tag. Load Stripe.js directly from the provided URL; do not bundle or self-host it. ```html Verify your identity ``` -------------------------------- ### Create Verification Session with Metadata Source: https://docs.stripe.com/identity/verification-sessions Use this cURL command to create a VerificationSession and attach custom metadata. Metadata is useful for associating your internal IDs or references with a Stripe session. ```curl curl https://api.stripe.com/v1/identity/verification_sessions \ -u "<>:" \ -d type=document \ -d "metadata[user_id]={{USER_ID}}" \ -d "metadata[reference]={{IDENTIFIER}}" ``` -------------------------------- ### Create Verification Session and Return Client Secret (Node.js) Source: https://docs.stripe.com/identity/verification-sessions This Node.js snippet demonstrates how to create a VerificationSession on your server and return only the client secret to the frontend. Ensure your Stripe secret key is securely managed and not hardcoded. ```javascript // Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. // Find your keys at https://dashboard.stripe.com/apikeys. const stripe = require('stripe')('<>'); // In the route handler for /create-verification-session: // Authenticate your user. // Create the session. const verificationSession = await stripe.identity.verificationSessions.create({ type: 'document', provided_details: { email: 'user@example.com', }, metadata: { user_id: '{{USER_ID}}', }, }); // Return only the client secret to the frontend. const clientSecret = verificationSession.client_secret; ``` -------------------------------- ### Retrieve Verification Session with Expanded Verified Outputs Source: https://docs.stripe.com/identity/access-verification-results Use this Node.js snippet to retrieve a VerificationSession and expand the `verified_outputs` field to access PII that only requires a secret key. Ensure you replace placeholder keys and IDs with your actual values. ```javascript // Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. // Find your keys at https://dashboard.stripe.com/apikeys. const stripe = require('stripe')('<>'); const verificationSession = await stripe.identity.verificationSessions.retrieve( '{{SESSION_ID}}', { expand: [ 'verified_outputs', ], } ); const firstName = verificationSession.verified_outputs.first_name; ``` -------------------------------- ### Retrieve Verification Report and Create FileLink (Node.js) Source: https://docs.stripe.com/identity/access-verification-results This Node.js snippet demonstrates how to retrieve a VerificationReport, extract a file ID, create a short-lived FileLink, and obtain its URL for accessing collected images. FileLinks for document and selfie files must expire within 30 seconds. ```javascript // Set your restricted key. Remember to switch to a live restricted key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('rk_test_...'); // Get the VerificationReport const session = await stripe.identity.verificationSessions.retrieve( '{{SESSION_ID}}', { expand: ['last_verification_report'], } ); // Retrieve the File id const report = session.last_verification_report; const documentFrontFile = report.document.files[0]; // Create a short-lived FileLink const fileLink = await stripe.fileLinks.create({ file: documentFrontFile, expires_at: Math.floor(Date.now() / 1000) + 30, // link expires in 30 seconds }); // Access the FileLink URL to download file contents const fileUrl = fileLink.url; ``` -------------------------------- ### Create Verification Session with Flow ID (API) Source: https://docs.stripe.com/identity/verification-flows Use this cURL command to create a verification session and specify the flow ID for the verification process. ```curl curl https://api.stripe.com/v1/identity/verification_sessions \ -u "<>:" \ -d "verification_flow={{IDENTITYVERIFICATIONFLOW_ID}}" ``` -------------------------------- ### Create a webhook endpoint using the API Source: https://docs.stripe.com/identity/handle-verification-outcomes Use this cURL command to programmatically create a webhook endpoint for receiving Stripe Identity events. Ensure you replace placeholder values with your actual secret key and domain. ```bash curl https://api.stripe.com/v1/webhook_endpoints \ -u <>: \ -d "url"="https://{{DOMAIN}}/my/webhook/endpoint" \ -d "enabled_events[]"="identity.verification_session.verified" \ -d "enabled_events[]"="identity.verification_session.requires_input" ``` -------------------------------- ### Basic HTML for Verification Button Source: https://docs.stripe.com/identity/verify-identity-documents?platform=web&type=modal Create a simple HTML button element that will be used to trigger the identity verification process. ```html Verify your identity ``` -------------------------------- ### Enable Selfie Checks in Verification Session (cURL) Source: https://docs.stripe.com/identity/verification-checks?type=selfie Use this cURL command to create a VerificationSession that requires both a document and a matching selfie. This is useful for verifying that the person submitting the document is the same person in the photo. ```curl curl https://api.stripe.com/v1/identity/verification_sessions \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2 :" \ -d type=document \ -d "options[document][require_matching_selfie]=true" ``` -------------------------------- ### Create Verification Session with Verification Flow Source: https://docs.stripe.com/identity/verification-flows Initiates an identity verification using a specified verification flow. The flow ID is passed as the `verification_flow` parameter when creating a verification session. ```APIDOC ## POST /v1/identity/verification_sessions ### Description Creates a verification session using a pre-configured verification flow. This is the primary method for initiating identity verification through the API. ### Method POST ### Endpoint /v1/identity/verification_sessions ### Parameters #### Request Body - **verification_flow** (string) - Required - The ID of the verification flow to use. - **provided_details[phone]** (string) - Optional - The user's phone number. - **provided_details[email]** (string) - Optional - The user's email address. - **client_reference_id** (string) - Optional - A reference ID for the user in your system. ### Request Example ```json { "verification_flow": "{{IDENTITYVERIFICATIONFLOW_ID}}", "provided_details": { "phone": "5555551212", "email": "user@domain.com" }, "client_reference_id": "reference-token" } ``` ### Response #### Success Response (200) (Response details not provided in source) #### Response Example (Response example not provided in source) ``` -------------------------------- ### Create VerificationSession (Node.js) Source: https://docs.stripe.com/identity/verify-identity-documents?platform=web&type=modal Server-side code to create a VerificationSession. This prevents malicious users from overriding verification options. Ensure your endpoint is authenticated and returns only the client secret to the frontend. ```Node.js // Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. // Find your keys at https://dashboard.stripe.com/apikeys. const stripe = require('stripe')( 'sk_test_BQokikJOvBiI2HlWgH4olfQ2' ); // In the route handler for /create-verification-session: // Authenticate your user. // Create the session. const verificationSession = await stripe.identity.verificationSessions. create ({ type : 'document', provided_details : { email : 'user@example.com', }, metadata : { user_id: '{{USER_ID}}', }, }); // Return only the client secret to the frontend. const clientSecret = verificationSession.client_secret; ``` -------------------------------- ### Retrieve Verification Session with Last Report (Node.js) Source: https://docs.stripe.com/identity/verification-checks?type=selfie Retrieve a VerificationSession and expand the `last_verification_report` to access the results of document and selfie checks. Ensure you do not hardcode API keys; use environment variables or secure storage. ```javascript // Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. // Find your keys at https://dashboard.stripe.com/apikeys. const stripe = require('stripe')( 'sk_test_BQokikJOvBiI2HlWgH4olfQ2' ); const verificationSession = await stripe.identity.verificationSessions. retrieve ( '{{SESSION_ID}}', { expand : ['last_verification_report'], } ); const verificationReport = verificationSession.last_verification_report; ``` -------------------------------- ### Retrieve Verification Session with Expanded Sensitive Data Source: https://docs.stripe.com/identity/access-verification-results Use a restricted API key to retrieve a verification session and expand fields to access sensitive outputs like date of birth, ID number, and document details. Remember to switch to a live restricted key in production. ```javascript // Set your restricted key. Remember to switch to a live restricted key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('rk_test_...'); const verificationSession = await stripe.identity.verificationSessions.retrieve( '{{SESSION_ID}}', { expand: [ 'verified_outputs.dob', 'verified_outputs.id_number', 'last_verification_report.document.number', 'last_verification_report.document.expiration_date', ], } ); const dateOfBirth = verificationSession.verified_outputs.dob; const idNumber = verificationSession.verified_outputs.id_number; const documentNumber = verificationSession.last_verification_report.document.number; const documentExpirationDate = verificationSession.last_verification_report.document.expiration_date; ``` -------------------------------- ### Verified VerificationSession Object Source: https://docs.stripe.com/identity/verification-sessions This JSON object represents a VerificationSession that has been successfully verified. It includes the verified outputs such as name and address. ```json { "id": "vs_orWziM4j7CiRL8J4vQmXgW2w", "object": "identity.verification_session", "created": 1610744321, "last_error": null, "last_verification_report": "vr_orWziM4j7CiRL8J4vQmXgW2w", "livemode": true, "metadata": {}, "options": { "document": {}, }, "status": "verified", "type": "document", "redaction": null, "url": null, "verified_outputs": {"first_name": "Jenny", "last_name": "Rosen", "address": { "line1": "1234 Main St.", "city": "San Francisco", "state": "CA", "postal_code": "94111", "country": "US" }, "id_number_type": null } } ``` -------------------------------- ### Node.js Webhook Handler for Stripe Identity Source: https://docs.stripe.com/identity/handle-verification-outcomes This snippet demonstrates how to set up an Express.js server to receive and verify Stripe Identity webhook events. It includes logic for handling both successful verifications and various failure scenarios, such as expired or unsupported documents. ```javascript // Don't put any keys in code. See https://docs.stripe.com/keys-best-practices. // Find your keys at https://dashboard.stripe.com/apikeys. const stripe = require('stripe')('<>'); // You can find your endpoint's secret in your webhook settings const endpointSecret = 'whsec_...'; // This example uses Express to receive webhooks const express = require('express'); // Use body-parser to retrieve the raw body as a buffer const bodyParser = require('body-parser'); const app = express(); // Use JSON parser for all non-webhook routes app.use((req, res, next) => { if (req.originalUrl === '/webhook') { next(); } else { bodyParser.json()(req, res, next); } }); app.post('/webhook', bodyParser.raw({type: 'application/json'}), (req, res) => { let event; // Verify the event came from Stripe try { const sig = req.headers['stripe-signature']; event = stripe.webhooks.constructEvent(req.body, sig, endpointSecret); } catch (err) { // On error, log and return the error message console.log(`❌ Error message: ${err.message}`); return res.status(400).send(`Webhook Error: ${err.message}`); } // Successfully constructed event switch (event.type) { case 'identity.verification_session.verified': { // All the verification checks passed const verificationSession = event.data.object; break; } case 'identity.verification_session.requires_input': { // At least one of the verification checks failed const verificationSession = event.data.object; console.log('Verification check failed: ' + verificationSession.last_error.reason); // Handle specific failure reasons switch (verificationSession.last_error.code) { case 'document_unverified_other': { // The document was invalid break; } case 'document_expired': { // The document was expired break; } case 'document_type_not_supported': { // document type not supported break; } default: { // ... } } } } res.json({received: true}); }); app.listen(4242, () => { console.log('Running on port 4242'); }); ``` -------------------------------- ### Fetch Client Secret on the Client Side (JavaScript) Source: https://docs.stripe.com/identity/verification-sessions This JavaScript snippet shows how to fetch the client secret from your server endpoint using the `fetch` API. The client secret is then used to initiate the Stripe identity verification process. ```javascript (async () => { const response = await fetch('/create-verification-session'); const {client_secret: clientSecret} = await response.json(); // Call stripe.verifyIdentity() with the client secret. })(); ``` -------------------------------- ### Stripe Identity Verification Button Handler Source: https://docs.stripe.com/identity/verify-identity-documents?platform=web&type=modal This script integrates Stripe Identity verification into a web page. It listens for clicks on a 'Verify' button, fetches a client secret from a server-side endpoint, and initiates the Stripe verification modal. It redirects to a confirmation page on success or displays an error. ```html Verify your identity ``` -------------------------------- ### Minimal Confirmation Page HTML Source: https://docs.stripe.com/identity/verify-identity-documents?platform=web&type=modal A basic HTML page to display after a user successfully submits their identity document. This page informs the user that their verification is being processed. ```html Your document was submitted

Thanks for submitting your identity document.

We are processing your verification.

``` -------------------------------- ### Add Stripe Gem to Gemfile Source: https://docs.stripe.com/identity/verify-identity-documents?platform=web&type=modal If using bundler, add the Stripe gem to your Gemfile for dependency management. ```ruby # If you use bundler, you can add this line to your Gemfile gem 'stripe' ``` -------------------------------- ### VerificationSession Object with Errors Source: https://docs.stripe.com/identity/verification-sessions This JSON object represents a VerificationSession that requires input due to a failure. It includes details about the last error, such as the code and reason for the failure. ```json { "id": "vs_orWziM4j7CiRL8J4vQmXgW2w", "object": "identity.verification_session", "created": 1610744321, "last_error": {"code": "document_expired", "reason": "The document is expired.", }, "last_verification_report": "vr_orWziM4j7CiRL8J4vQmXgW2w", "livemode": true, "metadata": {}, "options": {}, "status": "requires_input", "type": "document", "redaction": null, "url": null, } ``` -------------------------------- ### Retrieve VerificationSession Source: https://docs.stripe.com/identity/verification-sessions Retrieves an existing VerificationSession using its unique ID. This is useful for checking the status of a verification if the process was interrupted or to retrieve results upon completion. ```APIDOC ## GET /v1/identity/verification_sessions/{verification_session} ### Description Retrieves an existing VerificationSession using its unique ID. This is useful for checking the status of a verification if the process was interrupted or to retrieve results upon completion. ### Method GET ### Endpoint https://api.stripe.com/v1/identity/verification_sessions/{verification_session} ### Parameters #### Path Parameters - **verification_session** (string) - Required - The unique ID of the VerificationSession to retrieve. ### Response #### Success Response (200) - **id** (string) - The unique ID of the VerificationSession. - **type** (string) - The type of verification check performed. - **status** (string) - The current status of the verification session. #### Response Example { "id": "vs_12345abcde", "type": "document", "status": "verified" } ``` -------------------------------- ### Redact a VerificationSession Source: https://docs.stripe.com/identity/verification-sessions Redact a VerificationSession to remove personally identifiable information (PII). This is useful for data deletion requests. Redaction can take up to 4 days, and a webhook is sent upon completion. ```curl curl -X POST https://api.stripe.com/v1/identity/verification_sessions/{{IDENTITYVERIFICATIONSESSION_ID}}/redact \ -u "<>:" ``` -------------------------------- ### Cancel a VerificationSession Source: https://docs.stripe.com/identity/verification-sessions Use this endpoint to cancel a VerificationSession before it is processed or verified. This action is irreversible and results in a 'canceled' status. ```curl curl -X POST https://api.stripe.com/v1/identity/verification_sessions/{{IDENTITYVERIFICATIONSESSION_ID}}/cancel \ -u "<>:" ``` -------------------------------- ### Redact a VerificationSession Source: https://docs.stripe.com/identity/verification-sessions Redacts a VerificationSession to ensure Stripe deletes personal information. Redacted sessions have placeholder values for PII and a specific redaction status. ```APIDOC ## POST /v1/identity/verification_sessions/{IDENTITYVERIFICATIONSESSION_ID}/redact ### Description Redacts a verification session to ensure Stripe deletes personal information. After redaction, personal information is no longer returned by the Stripe API or visible in the Dashboard. Redacted sessions have placeholder values in all fields that previously contained personally identifiable information (PII) and include a `redaction.status` field. Redaction can take up to 4 days. Redacting a VerificationSession with `requires_action` status automatically cancels it. ### Method POST ### Endpoint /v1/identity/verification_sessions/{{IDENTITYVERIFICATIONSESSION_ID}}/redact ### Parameters #### Path Parameters - **IDENTITYVERIFICATIONSESSION_ID** (string) - Required - The ID of the VerificationSession to redact. ### Request Example ```bash curl -X POST https://api.stripe.com/v1/identity/verification_sessions/{{IDENTITYVERIFICATIONSESSION_ID}}/redact \ -u "<>:" ``` ### Response #### Success Response (200) - **id** (string) - The ID of the verification session. - **object** (string) - The object type, always `identity.verification_session`. - **created** (integer) - Timestamp of creation. - **last_error** (object) - Details about the last error, if any. - **last_verification_report** (string) - The ID of the last verification report. - **livemode** (boolean) - Whether the session is in live mode. - **options** (object) - Options for the verification session. - **status** (string) - The current status of the verification session. - **type** (string) - The type of verification. - **url** (string) - The URL for the verification session (if applicable). - **client_secret** (string) - The client secret for the session (if applicable). - **redaction** (object) - Information about the redaction status. - **status** (string) - The status of the redaction process (`redacted` if completed). - **verified_outputs** (object) - Contains PII that has been verified, with placeholder values if redacted. - **metadata** (object) - User-provided metadata. #### Response Example ```json { "id": "vs_orWziM4j7CiRL8J4vQmXgW2w", "object": "identity.verification_session", "created": 1610744321, "last_error": null, "last_verification_report": "vr_orWziM4j7CiRL8J4vQmXgW2w", "livemode": true, "options": {}, "status": "verified", "type": "document", "url": null, "client_secret": null, "redaction": { "status": "redacted" }, "verified_outputs": { "first_name": "[redacted]", "last_name": "[redacted]", "dob": { "year": 1, "month": 1, "day": 1 }, "address": { "line1": "[redacted]", "city": "[redacted]", "state": "[redacted]", "postal_code": "[redacted]", "country": "US" }, "id_number_type": null }, "metadata": {} } ``` ``` -------------------------------- ### Cancel a VerificationSession Source: https://docs.stripe.com/identity/verification-sessions Cancels a VerificationSession, making it invalid for future submissions. This action cannot be undone and results in a 'canceled' status. ```APIDOC ## POST /v1/identity/verification_sessions/{IDENTITYVERIFICATIONSESSION_ID}/cancel ### Description Cancels a VerificationSession at any point before it is `processing` or `verified`. This invalidates the session for future submission attempts and cannot be undone. The session will have a `canceled` status. ### Method POST ### Endpoint /v1/identity/verification_sessions/{{IDENTITYVERIFICATIONSESSION_ID}}/cancel ### Parameters #### Path Parameters - **IDENTITYVERIFICATIONSESSION_ID** (string) - Required - The ID of the VerificationSession to cancel. ### Request Example ```bash curl -X POST https://api.stripe.com/v1/identity/verification_sessions/{{IDENTITYVERIFICATIONSESSION_ID}}/cancel \ -u "<>:" ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.