question

tvang avatar image
tvang asked David Marginian Deactivated commented

Tokens used in node sdk

If I am using a private token does that substitute for the access_token needed in the node clobver sdk? also is the Environment variable equivalent to the DEVELOPER_UID you get when calling the pakms endpoint?

e-commerce api
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated commented

I just confirmed with the ecomm team, environment should be a string value either "sandbox" or "production" depending on the Clover environment you want to target.

4 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

tvang avatar image tvang commented ·

Now I am getting a "CloverAuthenticationError" when I try to call the order.create method. I am using a private token provided by the merchant and set the environment to "production" What can be causing this error?

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ tvang commented ·

There is an outstanding issue with ecomm token creation in production. A large percentage of the time the tokens won't work. You can try to have the merchant generate the token a few more times and see if you can get a valid one. Otherwise you will have to wait for the fix which will be deployed in January.

0 Likes 0 ·
tvang avatar image tvang David Marginian ♦♦ commented ·

Okay I will try that. When in Jan will they be pushing the update? If this does not work, is there a recommended way to create the order and process payment? would I just use the v3 endpoints?

0 Likes 0 ·
Show more comments
David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated converted comment to answer

Yes, the private token is the access_token. Iam not certain what environment variable you are referring to, API_KEY? The API_KEY will be the public key.

3 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

tvang avatar image tvang commented ·

The environemnet shown here:

require('dotenv').config();
const Clover = require("clover-ecomm-sdk");

let ACCESS_TOKEN = process.env.ACCESS_TOKEN;
let ENVIRONMENT = process.env.ENVIRONMENT;

const cloverInst = new Clover(ACCESS_TOKEN, {
  environment: ENVIRONMENT
});

let order = cloverInst.orders.create({
    currency: 'usd',
    email:'sample.email@example.com',
    items:{
        'amount': 1358,
        'currency': 'usd',
        'description': 'Lemon cupcake with blackberry frosting',
        'quantity': 2,
        'tax_rates':{'name':'Sale','rate':1000000}
    }
});

would that be the public_key?


The documentation shows two different way to config the SDK one version is shown above the other is here:


const clover = require('clover-ecomm-sdk')('Bkk312...');

Is this one no longer used?

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ tvang commented ·

Where is that code sample from? I am guessing environment is going to specificy sandbox or prod, but I am not certain what the value is supposed to be.

0 Likes 0 ·
tvang avatar image tvang David Marginian ♦♦ commented ·

Here:

https://docs.clover.com/docs/creating-and-paying-for-orders-sdk

under the Node tab in the example.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community