Customers
Customer creation, updates, and address/payment method relationships.
The customer model is the primary reference layer for payment history, recurring transactions, and risk/analytics workflows.
Create customer
const customer = await hsrcpay.customers.create({
email: "customer@example.com",
name: "HsrcPay Demo User",
phone: "+905551112233",
});Update customer
await hsrcpay.customers.update(customer.id, {
name: "Updated Name",
metadata: {
segment: "vip",
},
});Address management
- Store shipping/billing addresses in a separate model.
- Use an idempotent endpoint when selecting a primary address.
- Complete address updates at the profile step rather than at order time.
Data hygiene
- Use normalized formats for email and phone.
- Control duplicate records for the same customer with a merge strategy.
- Manage personal data under a KVKK/GDPR compliant retention policy.