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 by establishing a payment history.

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

Purpose

Why create customer records?

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

Key outcomes:

  • Customer ID for future transactions
  • Stored customer profile at processor
  • Foundation for payment method storage

Request Fields

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

Response Fields

FieldTypeDescription
merchant_customer_idstringYour customer reference (echoed back)
connector_customer_idstringConnector's customer ID (e.g., Stripe's cus_xxx)
statusCustomerStatusCurrent status: ACTIVE
status_codeintHTTP-style status code (200, 422, etc.)

Example

SDK Setup

from orchestratorx_prism import CustomerClient

customer_client = CustomerClient(
connector='stripe',
api_key='YOUR_API_KEY',
environment='SANDBOX'
)

Request

request = {
"merchant_customer_id": "cust_user_12345",
"email": "[email protected]",
"name": "John Doe",
"phone": "+1-555-123-4567",
"description": "Premium plan subscriber"
}

response = await customer_client.create(request)

Response

{
"merchant_customer_id": "cust_user_12345",
"connector_customer_id": "cus_xxx",
"status": "ACTIVE",
"status_code": 200
}

Common Patterns

Customer Onboarding Flow

sequenceDiagram
participant App as Your App
participant CS as Prism
participant PP as Payment Provider

Note over App: User signs up
App->>CS: 1. create customer
CS->>PP: Create customer record
PP-->>CS: Return connector_customer_id
CS-->>App: Return customer ID
Note over App: Store customer ID

Flow Explanation:

  1. Create customer - When a user creates an account, call create with their profile information.

  2. Store IDs - Save both merchant_customer_id and connector_customer_id in your database.

  3. Use for payments - Reference this customer in future payment operations.

Best Practices

  • Create customers at account signup, not first purchase
  • Use consistent merchant_customer_id format
  • Store connector_customer_id for future reference
  • Include email to enable customer communications from processor

Error Handling

Error CodeMeaningAction
409Customer existsUse existing customer or update instead
422Invalid dataCheck email format, name length, etc.

Next Steps