add server url

This commit is contained in:
tolu-paystack
2023-03-30 10:00:06 -05:00
parent ced02740bb
commit cfe94fc0b5
3 changed files with 5 additions and 3 deletions
+1
View File
@@ -1,3 +1,4 @@
STATIC_DIR='./client'
PAYSTACK_SECRET_KEY=
PORT='5000'
SERVER_URL='http://localhost:5000'
+2 -1
View File
@@ -26,10 +26,11 @@ git clone https://github.com/PaystackOSS/sample-subscriptions-app
npm install
```
3. Rename the `.env.example` file to `.env` and add your Paystack secret key. You can also change the default port from 5000 to a port of your choosing:
3. Rename the `.env.example` file to `.env` and add your Paystack secret key, and your server's URL including the port. This is necessary for the callback URL you'll be redirected to after completing a transaction. You can also change the default port from 5000 to a port of your choosing:
```
PAYSTACK_SECRET_KEY=sk_domain_xxxxxx
SERVER_URL=http://localhost:5000
```
4. Start the application
+1 -1
View File
@@ -81,7 +81,7 @@ app.post('/initialize-transaction-with-plan', async (req, res) => {
amount,
plan,
channels: ['card'], // limiting the checkout to show card, as it's the only channel that subscriptions are currently available through
callback_url: 'http://localhost:5000/account.html',
callback_url: `${process.env.SERVER_URL}/account.html`,
});
if (initializeTransactionResponse.status === false) {