Skip to content

Commit

Permalink
Merge branch 'release/1.2.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
DominusKelvin committed Mar 18, 2024
2 parents f0de977 + aaea3cb commit de369ee
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 18 deletions.
8 changes: 5 additions & 3 deletions docs/mail/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 7 additions & 3 deletions docs/mail/resend-transport.md
Original file line number Diff line number Diff line change
Expand Up @@ -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',
}
}
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/mail/send-helper.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 10 additions & 6 deletions docs/mail/smtp-transport.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/sails-pay/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
95 changes: 92 additions & 3 deletions docs/sails-pay/lemonsqueezy.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,103 @@ 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
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.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit de369ee

Please sign in to comment.