---
updatedAt: 2026-09-21T21:15:02.000Z
agentTools:
  projectIndex: https://docs.qorcommerce.io/llms.txt
---

# Purchase - Use a Payment Token

Process a sale with a card token

***

<Callout icon="📘" theme="info">
  ### Note:

  To simplify your development and have consistency across the various **Purchase** requests - all **Purchase** API calls can also be reached at the following endpoint with any combination of the required **Purchase...** parameters :

  `https://api-sandbox.qorcommerce.io/v3/payment/sale/`
</Callout>

<span style={{ color: "#5375bd" }}><b>QorCommerce</b></span> provides a **Secure Vault** that will encrypt and store card numbers and return a token you can store with the client and/or a contract to use for future payments.

Card Tokens can be created from card data during a sale or authorize transaction by providing the required card data and **store\_card** == `true` parameter in the request.

You can also create a card token using the [Payment Tokens (tokenization)](https://docs.qorcommerce.io/reference/token-create)

To use a card token for a sale, you simply pass the token as a **creditcard** value in the request using this endpoint or the sale endpoint.

### <span style={{ color: "#5375bd" }}><b>Parameters</b></span>

The following parameters are available to process a card token sale.

<Table align={["left","left","center"]}>
  <thead>
    <tr>
      <th>
        <span style={{ color: "#5375bd" }}><b>parameter</b></span>
      </th>

      <th>
        <span style={{ color: "#5375bd" }}><b>description</b></span>
      </th>

      <th style={{ textAlign: "center" }}>
        <span style={{ color: "#5375bd" }}><b>required</b></span>
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        **mid**
      </td>

      <td>
        the merchant id assigned by <span style={{ color: "#5375bd" }}><b>QorCommerce</b></span> or your merchant service provider (MSP)
      </td>

      <td style={{ textAlign: "center" }}>
        Yes
      </td>
    </tr>

    <tr>
      <td>
        **topt**
      </td>

      <td>
        Type Of Payment Transaction - set a value to simply tag and/or route a transaction to a pre-defined provider.
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        **reference_id**
      </td>

      <td>
        A reference id that will be echo'd back in the message response.
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        **amount**
      </td>

      <td>
        the total amount to process
      </td>

      <td style={{ textAlign: "center" }}>
        Yes
      </td>
    </tr>

    <tr>
      <td>
        **service_charge**
      </td>

      <td>
        the amount of the total sum of this transaction that is made up of the service_charge
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        **creditcard**
      </td>

      <td>
        the card token
      </td>

      <td style={{ textAlign: "center" }}>
        Yes
      </td>
    </tr>

    <tr>
      <td>
        cryptogram
      </td>

      <td>
        cryptogram for a network token (if required)
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        is_network_token
      </td>

      <td>
        is this a network token (0 or 1)<br />default = 0
      </td>

      <td style={{ textAlign: "center" }}>
        Only Yes, when token presented is a netowrk token
      </td>
    </tr>

    <tr>
      <td>
        **cvv**
      </td>

      <td>
        supply the card validation value of the tokenized card for security purposes
      </td>

      <td style={{ textAlign: "center" }}>
        Yes
      </td>
    </tr>

    <tr>
      <td>
        **currency**
      </td>

      <td>
        The currency to process. Defaults to USD if no value provided
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        **invoiceid**
      </td>

      <td>
        the merchant invoice id associated with the sale
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        **orderid**
      </td>

      <td>
        unique merchant order number
      </td>

      <td style={{ textAlign: "center" }}>
        Yes
      </td>
    </tr>

    <tr>
      <td>
        **ipaddress**
      </td>

      <td>
        The IP address of the client or server sending the request
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        **cfirstname**
      </td>

      <td>
        the customers first name
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        **clastname**
      </td>

      <td>
        the customers last name
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        **cemail**
      </td>

      <td>
        the customers email address
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        **cphone**
      </td>

      <td>
        the customers phone number
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        **risk_score**
      </td>

      <td>
        risk score associated to this transaction (

        -

        if you are using a risk prevention system)
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        **is_recurring**
      </td>

      <td>
        is this a recurring transaction (0 or 1)<br />default = 0
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        **first_trxn**
      </td>

      <td>
        original transaction id of the first payment. Only when this is a recurring transaction, this must be set to the first transaction id of the installment purchase.
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>

    <tr>
      <td>
        **metadata**
      </td>

      <td>
        a set of key-value pairs that you can attach to a payment. This can be useful for storing additional information about the payment in a structured format.
      </td>

      <td style={{ textAlign: "center" }}>
        No
      </td>
    </tr>
  </tbody>
</Table>

<details>
  <summary>JSON Example</summary>
  <p>The following JSON example provides test values to process a sale using a token. You can copy and paste these values in the <b>Body Params</b> section below to be used by the <span style={{ color: "#5375bd" }}><b>Try It</b></span> feature</p>

```json
{
  "transaction_data": {   
		"mid": "887728202",
    "amount": "1.5",
    "creditcard": "{token}",
    "cvv": "999",
    "currency": "USD",
    "orderid": "193383",
    "invoiceid": "INV-123332",
    "ipaddress": "0.0.0.0",
    "cfirstname": "Russell",
    "clastname": "Hanneman",
    "cemail": "cryptoking@example.com",
    "cphone": "1-344-877-8928",
    "cwebaddress": "example.com"
  }
}
```

</details>

#### <span style={{ color: "#5375bd" }}><b>Response Codes</b></span>

<ul>
  <li>Link to details on related response codes.</li>
  <li>[Payment Response Codes](https://docs.qorcommerce.io/docs/payment-response-codes)</li>
</ul>

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "version": "3.0",
    "title": "QorCommerce Endpoints",
    "description": "API Version 3"
  },
  "paths": {
    "/payment/sale/token": {
      "post": {
        "operationId": "payment-sale-token",
        "summary": "Purchase - Use a Payment Token",
        "tags": [
          "Payments - Credit / Debit Cards"
        ],
        "description": "Process a sale with a card token",
        "parameters": [
          {
            "$ref": "#/components/parameters/trait_qorHeaderAuthentication_Qor-App-Key"
          },
          {
            "$ref": "#/components/parameters/trait_qorHeaderAuthentication_Qor-Client-Key"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "transaction_data": {
                    "type": "object",
                    "properties": {
                      "mid": {
                        "type": "string"
                      },
                      "amount": {
                        "type": "string"
                      },
                      "service_charge": {
                        "type": "string"
                      },
                      "creditcard": {
                        "type": "string",
                        "description": "the card token"
                      },
                      "cvv": {
                        "type": "string"
                      },
                      "currency": {
                        "type": "string"
                      },
                      "invoiceid": {
                        "type": "string"
                      },
                      "orderid": {
                        "type": "string"
                      },
                      "ipaddress": {
                        "type": "string"
                      },
                      "cfirstname": {
                        "type": "string"
                      },
                      "clastname": {
                        "type": "string"
                      },
                      "cemail": {
                        "type": "string"
                      },
                      "cphone": {
                        "type": "string"
                      },
                      "risk_score": {
                        "type": "integer"
                      },
                      "reference_id": {
                        "type": "string",
                        "description": "A reference id that will be echo'd back in the message response."
                      },
                      "topt": {
                        "type": "string",
                        "description": "set a value to route a transaction to a pre-defined provider."
                      }
                    },
                    "required": [
                      "amount",
                      "creditcard",
                      "cvv",
                      "orderid"
                    ]
                  }
                },
                "required": [
                  "transaction_data"
                ],
                "example": {
                  "transaction_data": {
                    "mid": "",
                    "amount": "",
                    "creditcard": "",
                    "currency": "",
                    "invoiceid": "",
                    "orderid": "",
                    "ipaddress": "",
                    "cemail": "",
                    "cphone": ""
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/response-sale-auth"
                }
              }
            }
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api-sandbox.qorcommerce.io/v3"
    }
  ],
  "components": {
    "parameters": {
      "trait_qorHeaderAuthentication_Qor-App-Key": {
        "name": "Qor-App-Key",
        "in": "header",
        "description": "The unique key identifying the app making this request.\n\nNOTE: If testing use **`T6554252567241061980`** for the **`Qor-App-Key`** header key.",
        "required": true,
        "schema": {
          "type": "string",
          "maxLength": 24,
          "default": "T6554252567241061980"
        }
      },
      "trait_qorHeaderAuthentication_Qor-Client-Key": {
        "name": "Qor-Client-Key",
        "in": "header",
        "description": "The Client key represents an authorized **merchant account**  and is assigned by QorCommerce or your merchant service account provider.\n\n**NOTE:**  If testing use `01dffeb784c64d098c8c691ea589eb82 `  for the `Qor-Client-Key` header key.",
        "required": true,
        "schema": {
          "type": "string",
          "default": "01dffeb784c64d098c8c691ea589eb82"
        }
      }
    },
    "schemas": {
      "response-sale-auth": {
        "title": "Response - Sale/Auth",
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "description": "The status of the transaction.\n\nPossible response values are `approved`, `declined` and `error`",
            "example": "approved"
          },
          "code": {
            "type": "string",
            "description": "See [Payment Response Codes](doc:payment-response-codes) for more detail",
            "example": "GW00"
          },
          "message": {
            "type": "string",
            "description": "A payment gateway status code message",
            "example": "Card Sale processed successfully"
          },
          "transaction_date": {
            "type": "string",
            "description": "The date and time the transaction has taken place",
            "example": "2020-11-03 07:13:55"
          },
          "transaction_id": {
            "type": "string",
            "description": "The payment gateway unique transaction identifier. This value should be used for transaction lookups and when requesting voids and refunds",
            "example": "831649658996418"
          },
          "amount_approved": {
            "type": "string",
            "description": "The total amount approved and charged by the host processer",
            "example": "15.00"
          },
          "authcode": {
            "type": "string",
            "description": "The host processor authorization code",
            "example": "606012"
          },
          "token": {
            "type": "string",
            "description": "If the request value `store_card` = `1` then a token value representing the card will be provided in the response.\n\nThis token can be stored with your customer record and used in place of a credit card for future processing",
            "example": "909055$DQs7OHDo"
          }
        },
        "required": [
          "status",
          "code",
          "message"
        ]
      }
    }
  },
  "x-explorer-enabled": true,
  "x-proxy-enabled": true,
  "x-samples-enabled": true,
  "x-samples-languages": [
    "curl",
    "csharp",
    "node",
    "ruby",
    "java",
    "javascript",
    "php",
    "python",
    "swift"
  ]
}
```