diff --git a/docs/mail/configuration.md b/docs/mail/configuration.md index 1c8c849..02edd8f 100644 --- a/docs/mail/configuration.md +++ b/docs/mail/configuration.md @@ -31,11 +31,13 @@ You can also set the `default` mailer with the `MAIL_MAILER` environment variabl This is handy for specifying different default mailers in different environments your application will be running in. -Also in `config/local.js` you specify a `mailer` which will be used as the default mailer in development. +Also in `config/local.js` you specify a `mail` object with the `default` property which will be used as the default mailer in development. ```js //config/local.js -mailer: 'nodemailer' +mail: { + default: 'nodemailer' +} ``` ## mailers @@ -58,7 +60,7 @@ The `mailers` configuration object contains :::info What's a mailer? -In Mail, a mailer is a configuration object that is registered in the `mailers` object in `config/mails.js` that specifies at the very least a transport that Mail will use in sending your emails. +In Mail, a mailer is a configuration object that is registered in the `mailers` object in `config/mails.js` or in a `mail` object in `local.js` that specifies at the very least a transport that Mail will use in sending your emails. ::: ## from diff --git a/docs/mail/resend-transport.md b/docs/mail/resend-transport.md index e98b43c..6c3eb0c 100644 --- a/docs/mail/resend-transport.md +++ b/docs/mail/resend-transport.md @@ -53,12 +53,16 @@ RESEND_API_KEY=re_skskagnagnak ## local.js -Set an object in `config/local.js` matching the mailer you've set in `config/mails.js`: +In development, you can specify a mailer of the same name in `local.js` so as to override the credentials like `apiKey` specified in `config/mail.js` ```js // config/local.js -resend: { - apiKey: 're_skskagnagnak', +mail: { + mailers: { + resend: { + apiKey: 're_skskagnagnak', + } + } } ``` diff --git a/docs/mail/send-helper.md b/docs/mail/send-helper.md index f4c1cb7..b1e5c39 100644 --- a/docs/mail/send-helper.md +++ b/docs/mail/send-helper.md @@ -20,7 +20,7 @@ Mail provides a `send` helper that is used to send your emails within your Sails The mailer to use for sending the email. This is optional because by default Mail will look for the mailer to use by checking for it in the following places: - an environment variable called `MAIL_MAILER`, -- a config in `config/local.js` called `mailer`, +- a `default` property in a `mail` object in `config/local.js`, - and finally the `default` mailer set in `config/mail.js` ```js diff --git a/docs/mail/smtp-transport.md b/docs/mail/smtp-transport.md index 6ef3ca4..f137ccd 100644 --- a/docs/mail/smtp-transport.md +++ b/docs/mail/smtp-transport.md @@ -56,15 +56,19 @@ MAIL_PASSWORD=password ## local.js -Set an object in `config/local.js` matching the mailer you've set in `config/mails.js`: +In development, you can specify a mailer of the same name in local.js so as to override the credentials like `username`, `port` etc specified in config/mail.js ```js // config/local.js -smtp: { - host: 'sandbox.smtp.mailtrap.io', - username: 'username', - password: 'password', - port: 2525 +mail: { + mailers: { + smtp: { + host: 'sandbox.smtp.mailtrap.io', + username: 'username', + password: 'password', + port: 2525 + } + } } ``` diff --git a/docs/sails-pay/getting-started.md b/docs/sails-pay/getting-started.md index c3cd240..c1c8b9a 100644 --- a/docs/sails-pay/getting-started.md +++ b/docs/sails-pay/getting-started.md @@ -41,7 +41,7 @@ npm i @sails-pay/lemonsqueezy ::: ::: tip -If you can't find your payment provider, consider [sponsoring Kelvin's time](https://github.com/sponsors/DominusKelvin). He can work on an adapter for you. Visit . +If you can't find your payment provider, consider [sponsoring Kelvin's time](https://github.com/sponsors/DominusKelvin). He can work on an adapter for you. ::: Next, follow the instructions below to setup your preferred payment provider. diff --git a/docs/sails-pay/lemonsqueezy.md b/docs/sails-pay/lemonsqueezy.md index 21e1a86..d098a64 100644 --- a/docs/sails-pay/lemonsqueezy.md +++ b/docs/sails-pay/lemonsqueezy.md @@ -3,9 +3,9 @@ head: - - meta - property: 'og:image' content: https://docs.sailscasts.com/sails-pay-social.png -title: Getting started +title: Lemon Squeezy titleTemplate: Sails Pay -description: Getting started with Sails Pay in a Sails application +description: Learn how to use the Lemon Squeezy adapter for Sails Pay prev: text: Getting started link: /sails-pay/getting-started @@ -13,4 +13,93 @@ next: false editLink: true --- -# coming soon 🥱 +# Lemon Squeezy + +### Specifying the adapter + +In `config/pay.js` create a `default` payment provider and set the `adapter` property to `@sails-pay/lemonsqueezy`. + +```js +module.exports.pay = { + providers: { + default: { + adapter: '@sails-pay/lemonsqueezy' + } + } +} +``` + +::: tip +Do well to run `npm i @sails-pay/lemonsqueezy` if you haven't installed the adapter previously. +::: + +## Configuration + +You can configure the Lemon Squeezy adapter for both production and local development. + +### Local development + +In your `config/local.js` specify the following object: + +```js +module.exports = { + pay: { + providers: { + default: { + apiKey: 'iQtuubSnpmDLj62HjyjCSbvPIv2AixLKkG4cWGudptk_LT', + store: '12055', + redirectUrl: 'http://localhost:1337', + signingSecret: '8WCUCGNLi+2mqc+AF/QT6DidAA8GhV8=' + } + } + } +} +``` + +### Production + +For production set same properties in the `default` provider but in `config/pay.js`: + +```js +module.exports.pay = { + providers: { + default: { + adapter: '@sails-pay/lemonsqueezy', + store: process.env.LEMON_SQUEEZY_STORE, + apiKey: process.env.LEMON_SQUEEZY_API_KEY, + redirectUrl: process.env.LEMON_SQUEEZY_REDIRECT_URL, + signingSecret: process.env.LEMON_SQUEEZY_SIGNING_SECRET + } + } +} +``` + +::: tip +Note we are using environment variables in production as you don't want to commit those credentials to source control. +::: + +## Configuring values + +If you're unsure how to obtain the configuration values shown above, please refer to the links and instructions provided below: + +### **`apiKey`** + +Check out how to [create an API key](https://docs.lemonsqueezy.com/guides/developer-guide/getting-started#create-an-api-key) on your Lemon Squeezy dashboard. + +### **`store`** + +To find your Lemon Squeezy Store ID, go to your Lemon Squeezy dashboard's [Stores settings page](https://app.lemonsqueezy.com/settings/stores). + +The ID is the number next to your store's name. + +### **`redirectUrl`** + +Redirect URL is a custom URL to redirect to after a successful purchase. + +You can set this to redirect users to any page within your app after they've successfully completed their purchase. + +### **`signingSecret`** + +This is a secret (usually a random string) between 6 and 40 characters that will be used to sign each request. + +You should validate against this secret on each incoming webhook so you can verify that the request came from Lemon Squeezy. diff --git a/package.json b/package.json index 7a611bc..1bea37b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sailscasts-docs", - "version": "1.2.7", + "version": "1.2.8", "private": true, "description": "The official docs hub for Sailscasts", "scripts": {