Set up your Server

1. Install and Connect to the API

Install the LimePay SDK:

Node.js
Go
npm install limepay

In your code configure the Environment and API Credentials:

const LimePaySDK = require('limepay');
const LimePay = await LimePaySDK.connect({
environment: LimePay.Environment.Sandbox
apiKey: 'YOUR_API_KEY_HERE',
secret: 'YOUR_API_SECRET_HERE'
})
go get github.com/LimePay/go-sdk

In your code configure the Environment and API Credentials:

import (
limePaySDK "github.com/LimePay/go-sdk"
"github.com/LimePay/go-sdk/envs"
"github.com/LimePay/go-sdk/errors"
"github.com/LimePay/go-sdk/types"
)
limePay, err := limePaySDK.Connect(
envs.Sandbox, // environment
'YOUR_API_KEY_HERE', // apiKey
'YOUR_API_SECRET_HERE' // secret
)

2. Create Shopper

You need to create shoppers (your dApp users) in LimePay as prerequisite in order for you to create/process payments for them.

Node.js
Go
LimePay.shoppers.create(shopperData)
.then(shopper => {
const shopperId = shopper._id;
}).catch(error => {});
shopper, err := limePay.Shoppers.Create(shopperData)
if err != nil {
// handle error
}
shopperID := shopper.ID

Using the shopperId you can create/process payments for your users.

NOTE: Detailed information on how to create shoppers can be found in the SDK Documentation

NOTE: You don't have to create shopper, every-time you want to create payment. Shoppers are created only once and you can process unlimited number of payments once they are created.

3. Create Payment

You can create payments for a shopper and get the limeToken by performing:

Node.js
Go
LimePay.fiatPayment.create(paymentData, signerConfig)
.then(payment => {
const limeToken = payment.limeToken;
}).catch(error => {});
fiatPayment, err := limePay.FiatPayments.Create(paymentData, privateKey)
if err != nil {
// handle error
}
limeToken := fiatPayment.LimeToken

Once you have received the limeToken you need to send it to your Client.

NOTE: Detailed information on how to create payments can be found in the SDK Documentation

4. Send a Lime Token to your Client

Here is an example of how your server would create and return a lime token:

Node.js
app.post("/createPayment", function (req, res) {
LimePay.fiatPayment.create(paymentData, signerConfig)
.then(response => {
res.send(response.limeToken);
})
});
});

Set up your Client covers the next steps of the process.