question

tvang avatar image
tvang asked David Marginian Deactivated answered

TOKENIZATION SERVICE API

I am trying to create a card token following the documentation but keep getting the 400 error when calling the API.


export default async (req, res) => {
  try {
    const response = await fetch("https://token.clover.com/v1/tokens", {
      method: "POST,
      headers: {
        Accept: "application/json",
        apiKey: process.env.CLOVER_PUBLIC,
        "Content-Type": "application/json",
      },
      body: {
        card: {
          number: "411111111111",
          exp_month: "07",
          exp_year: "2023",
          cvv: "123",
        },
      },
    });
    const data = await response.json(
  } catch (err) {
    console.log(err);
  }
};

that is the code I'm using to call on my server side, if this does not work the documentation says i can also use an 'alternate_tender' as a source of payment. What can be considered an 'alternate_tender'?

API Token
10 |2000

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

1 Answer

·
David Marginian avatar image
David Marginian Deactivated answered

Your body contains invalid JSON, you need to remove the "," after the cvv. Do you have PCI DSS certification? If not you should not be obtaining the token via API:

https://docs.clover.com/docs/ecommerce-generating-a-card-token#api-only-integrations

https://docs.clover.com/docs/ecommerce-integration-type

For using the API only integration in production, you must have (or use a service that has) a PCI DSS certification.


10 |2000

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

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