Skip to main content

create Method

Overview

The create method creates a customer record in the payment processor system. Storing customer details streamlines future transactions and can improve authorization rates.

Business Use Case: A new user signs up for your e-commerce platform. Create their customer profile to enable faster checkout on future purchases.

Purpose

ScenarioBenefit
Faster checkoutReturning customers skip entering details
Payment historyTrack all payments by customer
Fraud scoringEstablished customers have better risk profiles
SubscriptionsRequired for recurring billing setup

Request Fields

FieldTypeRequiredDescription
merchantCustomerIdstringYesYour unique customer reference
emailstringNoCustomer email address
namestringNoCustomer full name
phonestringNoCustomer phone number
descriptionstringNoInternal description
metadataobjectNoAdditional data (max 20 keys)

Response Fields

FieldTypeDescription
merchantCustomerIdstringYour customer reference
connectorCustomerIdstringConnector's customer ID (e.g., Stripe's cus_xxx)
statusCustomerStatusACTIVE
statusCodenumberHTTP status code

Example

SDK Setup

const { CustomerClient } = require('hyperswitch-prism');

const customerClient = new CustomerClient({
connector: 'stripe',
apiKey: 'YOUR_API_KEY',
environment: 'SANDBOX'
});

Request

const request = {
merchantCustomerId: "cust_user_12345",
name: "John Doe",
phone: "+1-555-123-4567",
description: "Premium plan subscriber"
};

const response = await customerClient.create(request);

Response

{
merchantCustomerId: "cust_user_12345",
connectorCustomerId: "cus_xxx",
status: "ACTIVE",
statusCode: 200
}

Best Practices

  • Create customers at account signup, not first purchase
  • Use consistent merchantCustomerId format
  • Store connectorCustomerId for future reference
  • Include email for processor communications

Next Steps