chore(plugin-stripe)!: disables rest proxy by default (#6230)
This commit is contained in:
@@ -85,7 +85,7 @@ The following custom endpoints are automatically opened for you:
|
||||
|
||||
##### Stripe REST Proxy
|
||||
|
||||
If `rest` is true, proxies the [Stripe REST API](https://stripe.com/docs/api) behind [Payload access control](https://payloadcms.com/docs/access-control/overview) and returns the result. If you need to proxy the API server-side, use the [stripeProxy](#node) function.
|
||||
If `rest` is true, proxies the [Stripe REST API](https://stripe.com/docs/api) behind [Payload access control](https://payloadcms.com/docs/access-control/overview) and returns the result. This flag should only be used for local development, see the security note below for more information.
|
||||
|
||||
```ts
|
||||
const res = await fetch(`/api/stripe/rest`, {
|
||||
@@ -106,6 +106,8 @@ const res = await fetch(`/api/stripe/rest`, {
|
||||
})
|
||||
```
|
||||
|
||||
If you need to proxy the API server-side, use the [stripeProxy](#node) function.
|
||||
|
||||
<Banner type="info">
|
||||
<strong>Note:</strong>
|
||||
<br />
|
||||
@@ -113,6 +115,12 @@ const res = await fetch(`/api/stripe/rest`, {
|
||||
config.
|
||||
</Banner>
|
||||
|
||||
<Banner type="warning">
|
||||
<strong>Warning:</strong>
|
||||
<br />
|
||||
Opening the REST proxy endpoint in production is a potential security risk. Authenticated users will have open access to the Stripe REST API. In production, open your own endpoint and use the [stripeProxy](#node) function to proxy the Stripe API server-side.
|
||||
</Banner>
|
||||
|
||||
## Webhooks
|
||||
|
||||
[Stripe webhooks](https://stripe.com/docs/webhooks) are used to sync from Stripe to Payload. Webhooks listen for events on your Stripe account so you can trigger reactions to them. Follow the steps below to enable webhooks.
|
||||
|
||||
@@ -20,8 +20,7 @@ export const stripePlugin =
|
||||
// set config defaults here
|
||||
const pluginConfig: SanitizedStripePluginConfig = {
|
||||
...incomingStripeConfig,
|
||||
// TODO: in the next major version, default this to `false`
|
||||
rest: incomingStripeConfig?.rest ?? true,
|
||||
rest: incomingStripeConfig?.rest ?? false,
|
||||
sync: incomingStripeConfig?.sync || [],
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ export type SyncConfig = {
|
||||
export type StripePluginConfig = {
|
||||
isTestKey?: boolean
|
||||
logs?: boolean
|
||||
// @deprecated this will default as `false` in the next major version release
|
||||
/** @default false */
|
||||
rest?: boolean
|
||||
stripeSecretKey: string
|
||||
stripeWebhooksEndpointSecret?: string
|
||||
|
||||
Reference in New Issue
Block a user