-
-
Notifications
You must be signed in to change notification settings - Fork 116
/
gatsby-node.js
46 lines (45 loc) · 1.58 KB
/
gatsby-node.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Current API
// mode,
// cartMode,
// stripePublicKey,
// successUrl,
// cancelUrl,
// currency,
// allowedCountries,
// billingAddressCollection
exports.pluginOptionsSchema = ({ Joi }) => {
return Joi.object({
mode: Joi.string()
.default(`payment`)
.description(`Mode should be "payment"`),
cartMode: Joi.string()
.default(`client-only`)
.description(`Cart mode can be 'client-only' or 'checkout-session'.`),
stripePublicKey: Joi.string()
.required()
.description(`Public key from your Stripe dashboard.`)
.messages({
// Override the error message if the .required() call fails
"any.required": `"Stripe Public Key" needs to be provided. Get the correct value from your Stripe dashboard`,
}),
successUrl: Joi.string()
.default(`https://useshoppingcart.com/`)
.description(`Url redirect on a successful purchase.`),
cancelUrl: Joi.string()
.default(`https://stripe.com/`)
.description(`Url redirect on a cancelled purchase.`),
// allowedCountries: ["US", "GB", "CA"],
allowedCountries: Joi.array()
.items(Joi.string())
.default(["US", "GB", "CA"])
.description(
`Array of allowed countries for Stripe purchases, use international two letter country codes. `
),
currency: Joi.string()
.default(`USD`)
.description(`Currency for transaction, see Stripe docs for details.`),
billingAddressCollection: Joi.boolean()
.default(true)
.description(`Boolean to enable billing address collection.`),
})
}