Customer Service
Overview
The Customer Service enables you to create and manage customer profiles at payment processors using the Node.js SDK. Storing customer details with connectors streamlines future transactions and improves authorization rates.
Business Use Cases:
- E-commerce accounts - Save customer profiles for faster checkout on return visits
- SaaS platforms - Associate customers with subscription payments and billing histories
- Recurring billing - Link customers to stored payment methods for automated billing
- Fraud prevention - Consistent customer identity improves risk scoring accuracy
Operations
| Operation | Description | Use When |
|---|---|---|
create | Create customer record in the payment processor system. Stores customer details for future payment operations without re-sending personal information. | First-time customer checkout, account registration, subscription signup |
SDK Setup
const { CustomerClient } = require('hyperswitch-prism');
const customerClient = new CustomerClient({
connector: 'stripe',
apiKey: 'YOUR_API_KEY',
environment: 'SANDBOX'
});
Common Patterns
New Customer Checkout Flow
Create a customer profile during first-time checkout.
sequenceDiagram
participant App as Your App
participant CS as Prism
participant PP as Payment Provider
Note over App: New customer checkout
App->>CS: 1. create (customer details)
CS->>PP: Create customer profile
PP-->>CS: Return connectorCustomerId
CS-->>App: Return connectorCustomerId (cus_xxx)
Note over App: Store connectorCustomerId with user account
App->>CS: 2. authorize (with connectorCustomerId)
CS->>PP: Create payment linked to customer
PP-->>CS: Return authorization
CS-->>App: Return connectorTransactionId (AUTHORIZED)
Flow Explanation:
-
Create customer - Send customer details to the Customer Service. The connector creates a profile at the payment processor and returns a
connectorCustomerId. -
Authorize payment - When the customer makes a payment, call the Payment Service's
authorizemethod with theconnectorCustomerId.
Next Steps
- Payment Service - Process payments linked to customers
- Payment Method Service - Store and manage customer payment methods
- Recurring Payment Service - Set up recurring billing for customers