How To Make Charge In Clearent Using JWT Card Token And How To Use Existing Card


In this article, we will learn how to implement a clearent payment gateway with a JWT Credit card token using jquery. You can use this token as a card in your Sale refund and other APIs.

And also we learn how to use existing cards for sale and other APIs Integrators may use the JavaScript SDK to incorporate payments into their websites smoothly. Iframes are used by Clearent’s JavaScript SDK to include PCI security compliance best practices for e-commerce sites.

You can learn how to use Clearent Javascript SDK and how to generate JWT Card Token from Here

we are going to learn how to use this token and use the existing cards in the future without generating tokens again.

Let’s begin.

Here we use postman for API calls

Step 1: Get Your Card JWT Token From  Javascript SDK

Step 2: Now open Your postman

  • Set Type POST
  • Enter your clearent mobile sale API :
  • Now click on “Header” and new key :
  • Now click on body and add your JSON data for payment and add body type JSON
    • Data :
          "type": "SALE",
          "amount": "99",
          "software-type": "AwesomePOSSoftware",

Now Click on Send 

And you get responses that look like this :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
        <href>/rest/v2/tokens/{Here is your card Token}</href>
        <id>{Here is your card Token}</id>
    <payload type="errorTransaction">
            <display-message>Declined by Issuer -Referred - Please call Card Issuer</display-message>
            <merchant-id>{here is your merchant-id}</merchant-id>

Here you can find your following key and tokens:

  1. Transaction Key
  2. New Card Token
  3. Your Card details

That’s it you can make payment with your JWT token without giving your card details

But there is one problem JWT token is not valid for the second time you can not use this JWt token for future payment. Token will be invalid in some time.

So you can use the token that you get from the response save this token in your database and you can use that token in future payment

But using this token you can not use this API :

To use the existing  card(Token) you need to use this API :

Use Existing Token for Payment

Open Postman and add AIP :

for this time add Your API key in the header and in this API you can not pass your Any JWT token

Now Add Body 

  • In body set type: SALE
  • Set Amount
  • set software-Type: Any Name
  • set software-type-virsion:1
  • here we already have a card token so make “create-token”: false
  • And in header set “accept”: application/JSON

Like This :

Now Click on send and you got a response that look like this :

    "code": "200",
    "status": "success",
    "exchange-id": "ID-clearent-cgw-2-1643310635949-0-16898478",
    "links": [
            "rel": "transaction",
            "href": "/rest/v2/transactions?id=114974234",
            "id": "114974234"
    "payload": {
        "transaction": {
            "amount": "25.55",
            "id": "114974234",
            "type": "SALE",
            "result": "APPROVED",
            "card": "XXXXXXXXXXXX1111",
            "authorization-code": "TAS393",
            "batch-string-id": "38",
            "display-message": "Transaction approved",
            "result-code": "000",
            "exp-date": "0226",
            "software-type": "AwesomePOSSoftware",
            "card-type": "VISA",
            "last-four": "1111",
            "merchant-id": "943250857867",
            "terminal-id": "10011113"
        "payloadType": "transactionToken",
        "tokenResponse": {
            "token-id": "{Card Token}",
            "times-used": "1",
            "status": "Active",
            "created": "2022-02-12T06:28:30.946Z",
            "updated": "2022-02-12T06:28:30.968Z",
            "exp-date": "0226",
            "last-four-digits": "1111",
            "card-type": "VISA",
            "merchant-id": "943250857867",
            "token-status": "Open"

That’s it.

Here we learn how to use JWT Card tokens and make payments and generate cards is for future payment

You cannot use the JWT token in the future because this token is valid for some time and you can not use it after that

So we generate a card ID with the use of JWTmobile sale API and in response and we can store this token in DB, also you can use this token any time in the future for payment.

In short, you can use this token as an existing card for customers and make Transactions.

Submit a Comment

Your email address will not be published. Required fields are marked *


Select Categories