mirror of
https://github.com/xtr-dev/payload-billing.git
synced 2025-12-10 10:53:23 +00:00
fix: add better error handling for uninitialized billing plugin
- Fix TypeError when accessing providerConfig on undefined billing plugin - Add proper type safety: useBillingPlugin now returns BillingPlugin | undefined - Add clear error message when plugin hasn't been initialized - Update README quickstart with concise provider response examples 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
11
README.md
11
README.md
@@ -100,18 +100,21 @@ export default buildConfig({
|
||||
const payment = await payload.create({
|
||||
collection: 'payments',
|
||||
data: {
|
||||
provider: 'stripe',
|
||||
provider: 'stripe', // or 'mollie' or 'test'
|
||||
amount: 5000, // $50.00 in cents
|
||||
currency: 'USD',
|
||||
description: 'Product purchase',
|
||||
status: 'pending',
|
||||
}
|
||||
})
|
||||
|
||||
// Payment is automatically initialized with Stripe
|
||||
console.log(payment.providerId) // Stripe PaymentIntent ID
|
||||
```
|
||||
|
||||
**What you get back:**
|
||||
|
||||
- **Stripe**: `providerId` = PaymentIntent ID, `providerData.raw.client_secret` for Stripe.js
|
||||
- **Mollie**: `providerId` = Transaction ID, `providerData.raw._links.checkout.href` for redirect URL
|
||||
- **Test**: `providerId` = Test payment ID, `providerData.raw.paymentUrl` for interactive test UI
|
||||
|
||||
## Payment Providers
|
||||
|
||||
### Stripe
|
||||
|
||||
Reference in New Issue
Block a user