Playground API
DocsStatsBlogStudio
Documentation Tree
Technical BlogFeature Deep Dives
  • Introduction
  • Quickstart
    5 min
  • How It Works
  • Recipes & Cookbooks
  • Platform Comparisons
  • Real-World Showcase
  • Interactive Studio
    Studio
  • GraphiQL IDE
    IDE
  • Session Quotas & Activity
  • Network Chaos Simulator
  • Atomic Sandbox Reset
  • Overview & Models
    Hub
  • Users Resource
  • Posts Resource
  • Comments Resource
  • Todos Resource
  • Custom Collections
    Custom
  • Multipart File Uploads
    Upload
  • Dynamic SVG Avatars
    SVG
  • Image Thumbnails
    CDN
  • Relational Filtering
  • Full-Text Search
  • Dynamic Sorting
  • Offset Pagination
  • Cursor Pagination
    Scroll
  • CSV & Excel Export & Import
    IO
  • Custom Collections
    CRUD
  • Overview & Architecture
    Hub
  • JWT Auth Flow
  • Refresh Token Rotation
    Mutex
  • RBAC Permission Matrix
    Roles
  • Expiry Simulation
  • Clock Skew Drift
  • Password Recovery Loop
  • Dual-Mode Sandboxing
  • GraphiQL IDE
    IDE
  • Relational Queries
  • Stateful Mutations
  • Realtime Subscriptions
  • Overview & Flowcharts
    Hub
  • Hosted Checkout
    Stripe
  • Payment Intents API
  • 3DS Challenge Modal
    Modal
  • Customers Vault
  • Charges & Refunds
  • Test Cards Catalog
  • Overview & Channels
    Hub
  • Virtual Email Mailbox
    Mailtrap
  • Virtual SMS Terminal
    Phone
  • In-App Notifications
  • Message Dispatcher
  • Realtime Studio
    Studio
  • Native WebSocket (/ws)
  • Socket.io Gateway
  • Presence & Echo Bot
  • Server-Sent Events (SSE)
    SSE
  • Analytics Telemetry
  • Webhook Subscriptions
  • HMAC SHA-256 Signatures
  • Delivery Logs
  • Manual Retry Simulator
  • Network Latency Delay
  • HTTP Status Codes
  • Rate-Limit Simulator
    429
  • Flaky Network & Jitter
    Chaos
  • Session Quotas & Activity
  • JSON Snapshots
    JSON
  • Headless CI/CD Testing
    CI
  • Mobile QR Code Sync
  • System Metrics & Health
  • Atomic Sandbox Reset
  • Official TypeScript SDK
  • Multi-Language Generators
  • DevTools Extension
  • OpenAPI 3.1 Spec
    JSON
  • Postman Collection v2.1
  • Bruno Collection
  • Insomnia Workspace
  • TypeScript .d.ts
    .d.ts
  • AI Prompt Rules
    Rules
  • Context Index (llms.txt)
  • Full Schema (llms-full.txt)
  • Manifest (product.json)
  • All Feature Articles
    Blog
  • React CRUD Without Backend
    Deep Dive
  • Why Static APIs Fail
  • Mocking Stateful Auth
  • WebSockets & SSE Guide
Technical Blog
Articles

In-depth articles explaining stateful mock APIs, WebSockets, payments, and frontend resilience.

Read Articles
Previous3DS Challenge Modal
NextCharges & Refunds
Mock Commerce & Billing

Customer Vault & Tokenized Instruments

Store buyer identities, tokenized payment instruments, billing preferences, and custom customer metadata. Attach customer records to Payment Intents and Checkout Sessions for recurring SaaS subscriptions and 1-click checkout experiences.

Vaulted Profiles PreviewAPI ConsolesZero-PCI Tokenization

Active Customer Vault Profiles

Click any profile to pre-fill the customer ID across query consoles.

SC

Sarah Connor

cus_test_9fa2b41c0e

Enterprise
sarah.connor@cyberdyne.io
+1 (555) 019-2834
Default Payment Method
•••• 4242
MH

Marcus Holloway

cus_test_88d103fa7e

Pro Builder
marcus@dedsec.net
+1 (555) 014-9921
Default Payment Method
•••• 5555

Customer Vault Endpoints

Create and query customer profiles directly within your isolated sandbox ledger.

1. Create Customer Profile

Create Vault Customer

POST
response.json
1
{
2
// Click "Send" above to execute this request against the live server.
3
}

2. Retrieve Customer by ID

Get Customer by ID

GET
response.json
1
{
2
// Click "Send" above to execute this request against the live server.
3
}

3. List All Saved Customers

List Sandbox Customers

GET
response.json
1
{
2
// Click "Send" above to execute this request against the live server.
3
}

Zero-PCI Tokenization Architecture

How modern commerce gateways isolate cardholder data to achieve SAQ-A PCI compliance.

1. Client Tokenization

Card numbers are submitted directly from the user browser or mobile SDK to the gateway vault. Your servers never see, transmit, or store unencrypted Primary Account Numbers (PANs).

2. Token Assignment

The gateway returns a non-sensitive payment method token (pm_test_...) or links the instrument to a Customer ID (cus_test_...).

3. Off-Session Billing

Your backend cron jobs or billing workers pass { customer: 'cus_...' } to charge subscriptions off-session without requiring cardholder presence.

Production Integration Recipes

Customer onboarding and recurring subscription billing patterns.

Customer Onboarding & Card Attachment (Node.js)

javascript
1
import axios from 'axios';
2
3
// Create customer and charge their first invoice
4
export async function onboardCustomerAndBill(userData, amountCents) {
5
// 1. Create vaulted customer profile
6
const custRes = await axios.post('https://playground.nileslabs.com/api/v1/customers', {
7
name: userData.fullName,
8
email: userData.email,
9
metadata: { appUserId: userData.id },
10
});
11
const customerId = custRes.data.id;
12
13
// 2. Create intent bound to customer
14
const intentRes = await axios.post('https://playground.nileslabs.com/api/v1/payments/intents', {
15
amount: amountCents,
16
currency: 'usd',
17
customer: customerId,
18
description: 'Initial SaaS subscription charge',
19
});
20
21
return { customerId, clientSecret: intentRes.data.client_secret };
22
}

Nightly Subscription Worker (Python)

python
1
import requests
2
3
def charge_subscription(customer_id: str, plan_amount_cents: int):
4
# Charge existing customer off-session
5
url = "https://playground.nileslabs.com/api/v1/payments/intents"
6
payload = {
7
"amount": plan_amount_cents,
8
"currency": "usd",
9
"customer": customer_id,
10
"description": "Monthly recurring plan renewal",
11
"capture_method": "automatic"
12
}
13
14
res = requests.post(url, json=payload)
15
intent = res.json()
16
print(f"Created renewal intent {intent['id']} for customer {customer_id}")
17
return intent