mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-10 02:43:24 +00:00
fix: remove non-existent defaultCustomerInfoExtractor from README
Replace defaultCustomerInfoExtractor import and usage with a proper working example that shows how to define a CustomerInfoExtractor function. Co-authored-by: Bas <bvdaakster@users.noreply.github.com>
This commit is contained in:
21
README.md
21
README.md
@@ -77,7 +77,24 @@ export default buildConfig({
|
|||||||
### With Customer Management
|
### With Customer Management
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import { billingPlugin, defaultCustomerInfoExtractor } from '@xtr-dev/payload-billing'
|
import { billingPlugin, CustomerInfoExtractor } from '@xtr-dev/payload-billing'
|
||||||
|
|
||||||
|
// Define how to extract customer info from your customer collection
|
||||||
|
const customerExtractor: CustomerInfoExtractor = (customer) => ({
|
||||||
|
name: customer.name,
|
||||||
|
email: customer.email,
|
||||||
|
phone: customer.phone,
|
||||||
|
company: customer.company,
|
||||||
|
taxId: customer.taxId,
|
||||||
|
billingAddress: {
|
||||||
|
line1: customer.address.line1,
|
||||||
|
line2: customer.address.line2,
|
||||||
|
city: customer.address.city,
|
||||||
|
state: customer.address.state,
|
||||||
|
postalCode: customer.address.postalCode,
|
||||||
|
country: customer.address.country,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
billingPlugin({
|
billingPlugin({
|
||||||
// ... providers
|
// ... providers
|
||||||
@@ -87,7 +104,7 @@ billingPlugin({
|
|||||||
refunds: 'refunds',
|
refunds: 'refunds',
|
||||||
},
|
},
|
||||||
customerRelationSlug: 'customers', // Enable customer relationships
|
customerRelationSlug: 'customers', // Enable customer relationships
|
||||||
customerInfoExtractor: defaultCustomerInfoExtractor, // Auto-sync customer data
|
customerInfoExtractor: customerExtractor, // Auto-sync customer data
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user