@stripe402/client-fetch
Installation
pnpm add @stripe402/client-fetchExports
export { createStripe402Fetch } from './wrapper'Quick Example
import { createStripe402Fetch } from '@stripe402/client-fetch'
const fetchWithPayment = createStripe402Fetch({
onPaymentRequired: async (requirements) => {
return {
paymentMethodId: 'pm_...',
topUpAmount: requirements.minTopUp,
}
},
})
// Automatically handles 402 → payment → retry
const response = await fetchWithPayment('https://api.example.com/api/weather')
const data = await response.json()
console.log(data) // => { temperature: 72, conditions: 'Sunny' }Sub-Pages
Last updated