API – Developers Docs API – Developers Docs
  • Cyberpac
  • Addon Payments
  • POS integrated Payments
  • SpanishSwitch to Spanish
API – Developers Docs API – Developers Docs
API – Developers Docs
  • Cyberpac
  • Addon Payments
  • POS integrated Payments
  • SpanishSwitch to Spanish
POS integrated Payments
  • Folder icon closed Folder open iconPayment integrated with Android POS
    • InStore Payment API Android
    • InStore Payment API Windows
    • InStore Payment REST API
  • Folder icon closed Folder open iconPayment integrated with Smartphone POS
    • Payment integration with Smartphone POS
  • Folder icon closed Folder open iconPOS integrated Payments
    • Transactions
      • Tokenization
    • Reports
    • Device
  • Folder icon closed Folder open iconHost2Host Integration – POI-Switch Protocol
  • Folder icon closed Folder open iconPOS Data sheets

Tokenization

Introduction

Comercia 2.0 POS allows you to process payment with card tokens generated from physical card data.

To do so, during a sale or pre-authorization request with the physical card, if the payment request specifies, the host will generate and return in the authorization response a unique token associated with the customer’s card details. This token represents the customer’s card details and can be used in future transactions, without having the physical card present.

Parameters

This table has the parameters related to tokenization.

NameTypeDescription
createTokenBoolean
– true
– false
If true, a request will be sent to generate a card token as part of the current transaction authorization request. The types of transactions that allow the card tokenization operation are SALES and PRE-AUTHORIZATIONS. For these purposes, these transactions are:
-Payment card and tokenization
– New pre-authorization card and tokenization.
codeOfUseString
Max 1 character
This attribute shows the specific use for the token and must be provided in the transaction carried out with the token. Comercia currently supports the following values:

– “C” Unique payment
– “R” Recurring payment
– “D” Postponed
– “E” Re-sent
– “H” Re-Authorization
– “M” Incremental
– “N” Not shown

Max length: 1
customerIdString
Max 100 characters
The Customer ID sent in the request to generate the token (Transaction and Tokenization) is uniquely associated with the token data generated and returned by Comercia. It must then be provided with the data from its associated token in each payment request made on the app with the token.
tokenString
Max 64 characters
The card token represents the card data for payment, refund or pre-authorization request with the token. Generated and returned in the response to operations and tokenization.

For these purposes, the transactions with a token that can be carried out by Comercia are:

– Payment with token
– Pre-authorization
– New with token
– Pre-authorization completed with token
– Refund with token
subscriptionIdString
Max 15 characters
Subscription ID associated with a specific token. This data is returned by the Host in requests for operations and tokenization. It is uniquely associated with the token data returned in the response and must be provided together in each token payment request.
tokenizerCodeStringResult code for card tokenization and tokenized transactions. Possible values:

– “0” Transaction successful
– “1” Token not generated
– “2” PAN not recovered”

POST Payment & Tokenization Card

This request initiates a payment transaction and card tokenization.

It must be sent to: https:// 172.20.10.1:2011/v1/transactions/payment

Request payload

  • amount: Positive decimal number. Contains the transaction total, the decimal places are separated with a point (. ).
  • orderId: String. An order/invoice/reference number is a value assigned by the customer’s application that is associated with the transaction, but it is not sent in the transaction request to the bank (so it is not associated with the transaction in the bank records). In general, this should be a unique value.
  • description: String. It is a value assigned by the customer’s app that is associated with the transaction reference and shown on screen with the transaction total.
  • tokenization: Tokenization. Request for tokenization object.

HEADERS

X-SOURCE

COMERCIA

Unique application request ID that identifies the application that is the origin of the API request.

Body raw (json)

				
					{
    "orderId": "tx-00000002",
    "amount": 2,
    "description":"Billete Sencillo",
    "tokenization": {
        "createToken": true,
        "codeOfUse": "C",
        "customerId": "123456789"
    }
}
				
			

These are sample requests and responses for POST Payment Tokenization Card. Here are some examples in different programming languages.

				
					var myHeaders = new Headers();
myHeaders.append("X-SOURCE", "COMERCIA");

var raw = "{\n    \"orderId\": \"tx-00000002\",\n    \"amount\": 2,\n    \"description\":\"Billete Sencillo\",\n    \"tokenization\": {\n        \"createToken\": true,\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}";

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https:// 172.20.10.1:2011/v1/transactions/payment", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
				
			
				
					var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https:// 172.20.10.1:2011/v1/transactions/payment");
request.Headers.Add("X-SOURCE", "COMERCIA");
var content = new StringContent("{\n    \"orderId\": \"tx-00000002\",\n    \"amount\": 2,\n    \"description\":\"Billete Sencillo\",\n    \"tokenization\": {\n        \"createToken\": true,\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}", null, "text/plain");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
				
			
				
					curl --location 'https:// 172.20.10.1:2011/v1/transactions/payment' \
--header 'X-SOURCE: COMERCIA' \
--data '{
    "orderId": "tx-00000002",
    "amount": 2,
    "description":"Billete Sencillo",
    "tokenization": {
        "createToken": true,
        "codeOfUse": "C",
        "customerId": "123456789"
    }
}'
				
			
				
					import requests

url = "https:// 172.20.10.1:2011/v1/transactions/payment"

payload = "{\n    \"orderId\": \"tx-00000002\",\n    \"amount\": 2,\n    \"description\":\"Billete Sencillo\",\n    \"tokenization\": {\n        \"createToken\": true,\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}"
headers = {
  'X-SOURCE': 'COMERCIA'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
				
			
				
					let parameters = "{\n    \"orderId\": \"tx-00000002\",\n    \"amount\": 2,\n    \"description\":\"Billete Sencillo\",\n    \"tokenization\": {\n        \"createToken\": true,\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "https:// 172.20.10.1:2011/v1/transactions/payment")!,timeoutInterval: Double.infinity)
request.addValue("COMERCIA", forHTTPHeaderField: "X-SOURCE")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()
				
			

There are more samples of programming languages in our Postman collection.

This is the JSON for the response and its headers:

				
					{
  "orderId": "tx-00000002",
  "resultCode": 0,
  "resultMessage": "ACEPTADA",
  "ticket": {
    "AID": "A0000000031010",
    "ARC": "00",
    "ATC": "00959",
    "PSN": "01",
    "Amount": "200",
    "Authorization": "43970 ",
    "CardBank": "Comercia Global Payments",
    "CardHolder": "",
    "CardIssuer": "VISA CLASICA",
    "CardNumber": "************2825",
    "CardTechnology": 1,
    "CardType": "",
    "Currency": "EUR",
    "Date": "20230202",
    "Id": "187780",
    "Language": "es",
    "Location": "BARCELONA",
    "MerchantId": "329811087",
    "MerchantName": "Comercia Global Payments PRUEBAS",
    "Modifiers": [],
    "OriginalTransactionDate": "",
    "OriginalTransactionId": "",
    "PinIndicator": 1,
    "SignatureIndicator": 0,
    "Status": "0",
    "Templates": [],
    "TerminalId": "00000021",
    "Time": "1540",
    "Type": "Payment"
  },
  "tokenization": {
    "subscriptionId": "232023033707473",
    "token": "490727200336944988668125853538957465289310483021",
    "tokenizerCode": "0"
  }
}
				
			

Content–Type application/json

Date Thu, 2 Feb 2023 14:40:53 GMT

Access-Control-Allow-Origin *

Access-Control-Allow-Credentials true

Connection keep-alive

Content-Encoding gzip

Transfer-Encoding chunked

POST PreAuthorization New & Tokenization Card

This request initiates a pre-authorization.

It must be sent to: https:// 172.20.10.1:2011/v1/transactions/preauth/new

Request Payload

  • amount: Positive decimal number. Contains the transaction total, the decimal places are separated with a point (. ).
  • orderId (optional): String. An order/invoice/reference number is a value assigned by the customer’s application that is associated with the transaction, but it is not sent in the transaction request to the bank (so it is not associated with the transaction in the bank records). In general, this should be a unique value.
  • description (optional): String. It is a value assigned by the customer’s app that is associated with the transaction reference and shown on screen with the transaction total.
  • tokenization: Tokenization. Request for tokenization object.

HEADERS

X-SOURCE

COMERCIA

Unique application request ID that identifies the application that is the origin of the API request.

Body raw (json)

				
					{
    "amount": 1,
    "description": "billete sencillo",
    "tokenization": {
        "createToken": true,
        "codeOfUse": "R",
        "customerId": "123456789"
    }
}
				
			

These are sample requests and responses for POST PreAuthorization New Tokenization Card. Here are some examples in different programming languages.

				
					var myHeaders = new Headers();
myHeaders.append("X-SOURCE", "COMERCIA");

var raw = "{\n    \"amount\": 1,\n    \"description\": \"billete sencillo\",\n    \"tokenization\": {\n        \"createToken\": true,\n        \"codeOfUse\": \"R\",\n        \"customerId\": \"123456789\"\n    }\n}";

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https:// 172.20.10.1:2011/v1/transactions/preauth/new", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
				
			
				
					var myHeaders = new Headers();
myHeaders.append("X-SOURCE", "COMERCIA");

var raw = "{\n    \"amount\": 1,\n    \"description\": \"billete sencillo\",\n    \"tokenization\": {\n        \"createToken\": true,\n        \"codeOfUse\": \"R\",\n        \"customerId\": \"123456789\"\n    }\n}";

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https:// 172.20.10.1:2011/v1/transactions/preauth/new", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
				
			
				
					curl --location 'https:// 172.20.10.1:2011/v1/transactions/preauth/new' \
--header 'X-SOURCE: COMERCIA' \
--data '{
    "amount": 1,
    "description": "billete sencillo",
    "tokenization": {
        "createToken": true,
        "codeOfUse": "R",
        "customerId": "123456789"
    }
}'
				
			
				
					import requests

url = "https:// 172.20.10.1:2011/v1/transactions/preauth/new"

payload = "{\n    \"amount\": 1,\n    \"description\": \"billete sencillo\",\n    \"tokenization\": {\n        \"createToken\": true,\n        \"codeOfUse\": \"R\",\n        \"customerId\": \"123456789\"\n    }\n}"
headers = {
  'X-SOURCE': 'COMERCIA'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
				
			
				
					let parameters = "{\n    \"amount\": 1,\n    \"description\": \"billete sencillo\",\n    \"tokenization\": {\n        \"createToken\": true,\n        \"codeOfUse\": \"R\",\n        \"customerId\": \"123456789\"\n    }\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "https:// 172.20.10.1:2011/v1/transactions/preauth/new")!,timeoutInterval: Double.infinity)
request.addValue("COMERCIA", forHTTPHeaderField: "X-SOURCE")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()
				
			

There are more samples of programming languages in our Postman collection.

This is the JSON for the response and its headers:

				
					{
  "resultCode": 0,
  "resultMessage": "ACEPTADA",
  "ticket": {
    "AID": "A0000000031010",
    "ARC": "00",
    "ATC": "00960",
    "PSN": "01",
    "Amount": "100",
    "Authorization": "238599",
    "CardBank": "Comercia Global Payments",
    "CardHolder": "",
    "CardIssuer": "VISA CLASICA",
    "CardNumber": "************2825",
    "CardTechnology": 1,
    "CardType": "",
    "Currency": "EUR",
    "Date": "20230203",
    "Id": "188272",
    "Language": "es",
    "Location": "BARCELONA",
    "MerchantId": "329811087",
    "MerchantName": "Comercia Global Payments PRUEBAS",
    "Modifiers": [],
    "OriginalTransactionDate": "",
    "OriginalTransactionId": "",
    "PinIndicator": 1,
    "SignatureIndicator": 0,
    "Status": "0",
    "Templates": [],
    "TerminalId": "00000021",
    "Time": "2304",
    "Type": "Preauthorization"
  },
  "tokenization": {
    "subscriptionId": "232023034711367",
    "token": "490727200336944988668125853538957465289310483021",
    "tokenizerCode": "0"
  }
}
				
			

Content–Type application/json

Date Fri, 3 Feb 2023 22:04:34 GMT

Access-Control-Allow-Origin *

Access-Control-Allow-Credentials true

Connection keep-alive

Content-Encoding gzip

Transfer-Encoding chunked

POST Payment with Token

This request initiates a payment transaction.

It must be sent to: https:// 172.20.10.1:2011/v1/transactions/payment

Request Payload

  • amount: Positive decimal number. Contains the transaction total, the decimal places are separated with a point (. ).
  • orderId: String. An order/invoice/reference number is a value assigned by the customer’s application that is associated with the transaction, but it is not sent in the transaction request to the bank (so it is not associated with the transaction in the bank records). In general, this should be a unique value.
  • description: String. It is a value assigned by the customer’s app that is associated with the transaction reference and shown on screen with the transaction total.
  • tokenization: Tokenization. Request for tokenization object.

HEADERS

X-SOURCE

COMERCIA

Unique application request ID that identifies the application that is the origin of the API request.

Body raw (json)

				
					{
    "orderId": "tx-00000001",
    "amount": 1,
    "description": "Billete Sencillo",
    "tokenization": {
        "subscriptionId": "232023033707473",
        "token": "490727200336944988668125853538957465289310483021",
        "codeOfUse": "C",
        "customerId": "123456789"
    }
}
				
			

These are sample requests and responses for POST Payment with Token. Here are some examples in different programming languages.

				
					var myHeaders = new Headers();
myHeaders.append("X-SOURCE", "COMERCIA");

var raw = "{\n    \"orderId\": \"tx-00000001\",\n    \"amount\": 3,\n    \"description\": \"Billete Sencillo\",\n    \"tokenization\": {\n        \"subscriptionId\": \"232023033707473\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}";

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https:// 172.20.10.1:2011/v1/transactions/payment", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
				
			
				
					var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https:// 172.20.10.1:2011/v1/transactions/payment");
request.Headers.Add("X-SOURCE", "COMERCIA");
var content = new StringContent("{\n    \"orderId\": \"tx-00000001\",\n    \"amount\": 3,\n    \"description\": \"Billete Sencillo\",\n    \"tokenization\": {\n        \"subscriptionId\": \"232023033707473\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}", null, "text/plain");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
				
			
				
					curl --location 'https:// 172.20.10.1:2011/v1/transactions/payment' \
--header 'X-SOURCE: COMERCIA' \
--data '{
    "orderId": "tx-00000001",
    "amount": 3,
    "description": "Billete Sencillo",
    "tokenization": {
        "subscriptionId": "232023033707473",
        "token": "490727200336944988668125853538957465289310483021",
        "codeOfUse": "C",
        "customerId": "123456789"
    }
}'
				
			
				
					import requests

url = "https:// 172.20.10.1:2011/v1/transactions/payment"

payload = "{\n    \"orderId\": \"tx-00000001\",\n    \"amount\": 3,\n    \"description\": \"Billete Sencillo\",\n    \"tokenization\": {\n        \"subscriptionId\": \"232023033707473\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}"
headers = {
  'X-SOURCE': 'COMERCIA'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
				
			
				
					let parameters = "{\n    \"orderId\": \"tx-00000001\",\n    \"amount\": 3,\n    \"description\": \"Billete Sencillo\",\n    \"tokenization\": {\n        \"subscriptionId\": \"232023033707473\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "https:// 172.20.10.1:2011/v1/transactions/payment")!,timeoutInterval: Double.infinity)
request.addValue("COMERCIA", forHTTPHeaderField: "X-SOURCE")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()
				
			

There are more samples of programming languages in our Postman collection.

This is the JSON for the response and its headers:

				
					{
  "orderId": "tx-00000001",
  "resultCode": 0,
  "resultMessage": "ACEPTADA",
  "ticket": {
    "AID": "",
    "ARC": "00",
    "ATC": "",
    "PSN": "",
    "Amount": "300",
    "Authorization": "847650",
    "CardBank": "Comercia Global Payments",
    "CardHolder": "",
    "CardIssuer": "VISA VISA CASH-CLASSIC",
    "CardNumber": "************2825",
    "CardTechnology": 3,
    "CardType": "",
    "Currency": "EUR",
    "Date": "20230202",
    "Id": "187782",
    "Language": "es",
    "Location": "BARCELONA",
    "MerchantId": "329811087",
    "MerchantName": "Comercia Global Payments PRUEBAS",
    "Modifiers": [],
    "OriginalTransactionDate": "",
    "OriginalTransactionId": "",
    "PinIndicator": 0,
    "SignatureIndicator": 0,
    "Status": "0",
    "Templates": [],
    "TerminalId": "00000021",
    "Time": "1541",
    "Type": "Payment"
  },
  "tokenization": {
    "tokenizerCode": "0"
  }
}
				
			

Content–Type application/json

Date Thu, 2 Feb 2023 14:41:55 GMT

Access-Control-Allow-Origin *

Access-Control-Allow-Credentials true

Connection keep-alive

Content-Encoding gzip

Transfer-Encoding chunked

POST Refund with Token

This request initiates a refund transaction.

It must be sent to: https:// 172.20.10.1:2011/v1/transactions/refund

Request Payload

  • amount: Positive decimal number. Contains the transaction total, the decimal places are separated with a point (. ).
  • transactionId: String of decimal digits. Gives the transaction ID for the transaction to be refunded.
  • orderId (optional): String. An order/invoice/reference number is a value assigned by the customer’s application that is associated with the transaction, but it is not sent in the transaction request to the bank (so it is not associated with the transaction in the bank records). In general, this should be a unique value.
  • description (optional): String. It is a value assigned by the customer’s app that is associated with the transaction reference and shown on screen with the transaction total.
  • tokenization: Tokenization. Request for tokenization object.

HEADERS

X-SOURCE

COMERCIA

Unique application request ID that identifies the application that is the origin of the API request.

Body raw (json)

				
					{
    "transactionId": "187782",
    "amount": 3,
    "tokenization": {
        "subscriptionId": "232023033707473",
        "token": "490727200336944988668125853538957465289310483021",
        "codeOfUse": "C",
        "customerId": "123456789"
    }
}
				
			

These are sample requests and responses for POST Refund with Token. Here are some examples in different programming languages.

				
					var myHeaders = new Headers();
myHeaders.append("X-SOURCE", "COMERCIA");

var raw = "{\n    \"transactionId\": \"187782\",\n    \"amount\": 3,\n    \"tokenization\": {\n        \"subscriptionId\": \"232023033707473\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}";

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https:// 172.20.10.1:2011/v1/transactions/refund", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
				
			
				
					var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https:// 172.20.10.1:2011/v1/transactions/refund");
request.Headers.Add("X-SOURCE", "COMERCIA");
var content = new StringContent("{\n    \"transactionId\": \"187782\",\n    \"amount\": 3,\n    \"tokenization\": {\n        \"subscriptionId\": \"232023033707473\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}", null, "text/plain");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
				
			
				
					curl --location 'https:// 172.20.10.1:2011/v1/transactions/refund' \
--header 'X-SOURCE: COMERCIA' \
--data '{
    "transactionId": "187782",
    "amount": 3,
    "tokenization": {
        "subscriptionId": "232023033707473",
        "token": "490727200336944988668125853538957465289310483021",
        "codeOfUse": "C",
        "customerId": "123456789"
    }
}'
				
			
				
					import requests

url = "https:// 172.20.10.1:2011/v1/transactions/refund"

payload = "{\n    \"transactionId\": \"187782\",\n    \"amount\": 3,\n    \"tokenization\": {\n        \"subscriptionId\": \"232023033707473\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}"
headers = {
  'X-SOURCE': 'COMERCIA'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
				
			
				
					let parameters = "{\n    \"transactionId\": \"187782\",\n    \"amount\": 3,\n    \"tokenization\": {\n        \"subscriptionId\": \"232023033707473\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "https:// 172.20.10.1:2011/v1/transactions/refund")!,timeoutInterval: Double.infinity)
request.addValue("COMERCIA", forHTTPHeaderField: "X-SOURCE")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()
				
			

There are more samples of programming languages in our Postman collection.

This is the JSON for the response and its headers:

				
					{
  "resultCode": 0,
  "resultMessage": "ACEPTADA",
  "ticket": {
    "AID": "",
    "ARC": "00",
    "ATC": "",
    "PSN": "",
    "Amount": "300",
    "Authorization": "847650",
    "CardBank": "Comercia Global Payments",
    "CardHolder": "",
    "CardIssuer": "VISA VISA CASH-CLASSIC",
    "CardNumber": "************2825",
    "CardTechnology": 3,
    "CardType": "",
    "Currency": "EUR",
    "Date": "20230202",
    "Id": "187784",
    "Language": "es",
    "Location": "BARCELONA",
    "MerchantId": "329811087",
    "MerchantName": "Comercia Global Payments PRUEBAS",
    "Modifiers": [],
    "OriginalTransactionDate": "20230202",
    "OriginalTransactionId": "187782",
    "PinIndicator": 0,
    "SignatureIndicator": 0,
    "Status": "0",
    "Templates": [],
    "TerminalId": "00000021",
    "Time": "1543",
    "Type": "Refund"
  },
  "tokenization": {
    "tokenizerCode": "0"
  }
}
				
			

Content–Type application/json

Date Thu, 2 Feb 2023 14:43:23 GMT

Access-Control-Allow-Origin *

Access-Control-Allow-Credentials true

Connection keep-alive

Content-Encoding gzip

Transfer-Encoding chunked

POST PreAuthorization New with Token

This request initiates a new pre-authorization.
It must be sent to: https:// 172.20.10.1:2011/v1/transactions/preauth/new

Request Payload

  • amount: Positive decimal number. Contains the transaction total, the decimal places are separated with a point (. ).
  • orderId (optional): String. An order/invoice/reference number is a value assigned by the customer’s application that is associated with the transaction, but it is not sent in the transaction request to the bank (so it is not associated with the transaction in the bank records). In general, this should be a unique value.
  • description (optional): String. It is a value assigned by the customer’s app that is associated with the transaction reference and shown on screen with the transaction total.
  • tokenization: Tokenization. Request for tokenization object.

HEADERS

X-SOURCE

COMERCIA

Unique application request ID that identifies the application that is the origin of the API request.

Body raw (json)

				
					{
    "amount": 1,
    "description": "billete sencillo",
    "tokenization": {
        "subscriptionId": "232023031702405",
        "token": "490727200336944988668125853538957465289310483021",
        "codeOfUse": "C",
        "customerId": "123456789"
    }
}
				
			

These are sample requests and responses for POST PreAuthorization New with Token. Here are some examples in different programming languages.

				
					var myHeaders = new Headers();
myHeaders.append("X-SOURCE", "COMERCIA");

var raw = "{\n    \"amount\": 1,\n    \"description\": \"billete sencillo\",\n    \"tokenization\": {\n        \"subscriptionId\": \"232023031702405\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}";

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https:// 172.20.10.1:2011/v1/transactions/preauth/new", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
				
			
				
					var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https:// 172.20.10.1:2011/v1/transactions/preauth/new");
request.Headers.Add("X-SOURCE", "COMERCIA");
var content = new StringContent("{\n    \"amount\": 1,\n    \"description\": \"billete sencillo\",\n    \"tokenization\": {\n        \"subscriptionId\": \"232023031702405\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}", null, "text/plain");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
				
			
				
					curl --location 'https:// 172.20.10.1:2011/v1/transactions/preauth/new' \
--header 'X-SOURCE: COMERCIA' \
--data '{
    "amount": 1,
    "description": "billete sencillo",
    "tokenization": {
        "subscriptionId": "232023031702405",
        "token": "490727200336944988668125853538957465289310483021",
        "codeOfUse": "C",
        "customerId": "123456789"
    }
}'
				
			
				
					import requests

url = "https:// 172.20.10.1:2011/v1/transactions/preauth/new"

payload = "{\n    \"amount\": 1,\n    \"description\": \"billete sencillo\",\n    \"tokenization\": {\n        \"subscriptionId\": \"232023031702405\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}"
headers = {
  'X-SOURCE': 'COMERCIA'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
				
			
				
					let parameters = "{\n    \"amount\": 1,\n    \"description\": \"billete sencillo\",\n    \"tokenization\": {\n        \"subscriptionId\": \"232023031702405\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "https:// 172.20.10.1:2011/v1/transactions/preauth/new")!,timeoutInterval: Double.infinity)
request.addValue("COMERCIA", forHTTPHeaderField: "X-SOURCE")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()
				
			

There are more samples of programming languages in our Postman collection.

This is the JSON for the response and its headers:

				
					{
  "orderId": "tx-00000001",
  "resultCode": 0,
  "resultMessage": "ACEPTADA",
  "ticket": {
    "AID": "",
    "ARC": "00",
    "ATC": "",
    "PSN": "",
    "Amount": "300",
    "Authorization": "847650",
    "CardBank": "Comercia Global Payments",
    "CardHolder": "",
    "CardIssuer": "VISA VISA CASH-CLASSIC",
    "CardNumber": "************2825",
    "CardTechnology": 3,
    "CardType": "",
    "Currency": "EUR",
    "Date": "20230202",
    "Id": "187782",
    "Language": "es",
    "Location": "BARCELONA",
    "MerchantId": "329811087",
    "MerchantName": "Comercia Global Payments PRUEBAS",
    "Modifiers": [],
    "OriginalTransactionDate": "",
    "OriginalTransactionId": "",
    "PinIndicator": 0,
    "SignatureIndicator": 0,
    "Status": "0",
    "Templates": [],
    "TerminalId": "00000021",
    "Time": "1541",
    "Type": "Payment"
  },
  "tokenization": {
    "tokenizerCode": "0"
  }
}
				
			

Content–Type application/json

Date Thu, 3 Feb 2023 22:07:12 GMT

Access-Control-Allow-Origin *

Access-Control-Allow-Credentials true

Connection keep-alive

Content-Encoding gzip

Transfer-Encoding chunked

POST PreAuthorization Complete with Token

This request initiates the closing of a previous pre-authorization transaction.

It must be sent to: https:// 172.20.10.1:2011/v1/transactions/preauth/complete

Request Payload

  • amount: Positive decimal number. Contains the transaction total, the decimal places are separated with a point (. ).
  • transactionId: String of decimal digits. Gives the transaction ID for the transaction to be refunded.
  • transactionDate: String. The date of the original authorization transaction in the format: YYYYMMDDHHMM
  • orderId (optional): String. An order/invoice/reference number is a value assigned by the customer’s application that is associated with the transaction, but it is not sent in the transaction request to the bank (so it is not associated with the transaction in the bank records). In general, this should be a unique value.
  • description (optional): String. It is a value assigned by the customer’s app that is associated with the transaction reference and shown on screen with the transaction total.
  • tokenization: Tokenization. Request for tokenization object.

HEADERS

X-SOURCE

COMERCIA

Unique application request ID that identifies the application that is the origin of the API request.

Body raw (json)

				
					{
    "transactionId": "188273",
    "transactionDate": "202302032307",
    "amount": 1,
    "orderId": "tx-00000001",
    "description": "billete sencillo",
    "tokenization": {
        "subscriptionId": "232023031702405",
        "token": "490727200336944988668125853538957465289310483021",
        "codeOfUse": "C",
        "customerId": "123456789"
    }
}
				
			

These are sample requests and responses for POST PreAuthorization Complete with Token. Here are some examples in different programming languages.

				
					var myHeaders = new Headers();
myHeaders.append("X-SOURCE", "COMERCIA");

var raw = "{\n    \"transactionId\": \"188273\",\n    \"transactionDate\": \"202302032307\",\n    \"amount\": 1,\n    \"orderId\": \"tx-00000001\",\n    \"description\": \"billete sencillo\",\n    \"tokenization\": {\n        \"subscriptionId\": \"232023031702405\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}";

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https:// 172.20.10.1:2011/v1/transactions/preauth/complete", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
				
			
				
					var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https:// 172.20.10.1:2011/v1/transactions/preauth/complete");
request.Headers.Add("X-SOURCE", "COMERCIA");
var content = new StringContent("{\n    \"transactionId\": \"188273\",\n    \"transactionDate\": \"202302032307\",\n    \"amount\": 1,\n    \"orderId\": \"tx-00000001\",\n    \"description\": \"billete sencillo\",\n    \"tokenization\": {\n        \"subscriptionId\": \"232023031702405\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}", null, "text/plain");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
				
			
				
					curl --location 'https:// 172.20.10.1:2011/v1/transactions/preauth/complete' \
--header 'X-SOURCE: COMERCIA' \
--data '{
    "transactionId": "188273",
    "transactionDate": "202302032307",
    "amount": 1,
    "orderId": "tx-00000001",
    "description": "billete sencillo",
    "tokenization": {
        "subscriptionId": "232023031702405",
        "token": "490727200336944988668125853538957465289310483021",
        "codeOfUse": "C",
        "customerId": "123456789"
    }
}'
				
			
				
					import requests

url = "https:// 172.20.10.1:2011/v1/transactions/preauth/complete"

payload = "{\n    \"transactionId\": \"188273\",\n    \"transactionDate\": \"202302032307\",\n    \"amount\": 1,\n    \"orderId\": \"tx-00000001\",\n    \"description\": \"billete sencillo\",\n    \"tokenization\": {\n        \"subscriptionId\": \"232023031702405\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}"
headers = {
  'X-SOURCE': 'COMERCIA'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
				
			
				
					let parameters = "{\n    \"transactionId\": \"188273\",\n    \"transactionDate\": \"202302032307\",\n    \"amount\": 1,\n    \"orderId\": \"tx-00000001\",\n    \"description\": \"billete sencillo\",\n    \"tokenization\": {\n        \"subscriptionId\": \"232023031702405\",\n        \"token\": \"490727200336944988668125853538957465289310483021\",\n        \"codeOfUse\": \"C\",\n        \"customerId\": \"123456789\"\n    }\n}"
let postData = parameters.data(using: .utf8)

var request = URLRequest(url: URL(string: "https:// 172.20.10.1:2011/v1/transactions/preauth/complete")!,timeoutInterval: Double.infinity)
request.addValue("COMERCIA", forHTTPHeaderField: "X-SOURCE")

request.httpMethod = "POST"
request.httpBody = postData

let task = URLSession.shared.dataTask(with: request) { data, response, error in 
  guard let data = data else {
    print(String(describing: error))
    return
  }
  print(String(data: data, encoding: .utf8)!)
}

task.resume()
				
			

There are more samples of programming languages in our Postman collection.

This is the JSON for the response and its headers:

				
					{
  "orderId": "tx-00000001",
  "resultCode": 0,
  "resultMessage": "ACEPTADA",
  "ticket": {
    "AID": "",
    "ARC": "00",
    "ATC": "",
    "PSN": "",
    "Amount": "100",
    "Authorization": "94450 ",
    "CardBank": "Comercia Global Payments",
    "CardHolder": "",
    "CardIssuer": "VISA VISA CASH-CLASSIC",
    "CardNumber": "************2825",
    "CardTechnology": 3,
    "CardType": "",
    "Currency": "EUR",
    "Date": "20230203",
    "Id": "188274",
    "Language": "es",
    "Location": "BARCELONA",
    "MerchantId": "329811087",
    "MerchantName": "Comercia Global Payments PRUEBAS",
    "Modifiers": [],
    "OriginalTransactionDate": "20230203",
    "OriginalTransactionId": "188273",
    "PinIndicator": 0,
    "SignatureIndicator": 0,
    "Status": "0",
    "Templates": [],
    "TerminalId": "00000021",
    "Time": "2309",
    "Type": "PreauthorizationConfirmation"
  },
  "tokenization": {
    "tokenizerCode": "0"
  }
}
				
			

Content–Type application/json

Date Thu, 3 Feb 2023 22:09:51 GMT

Access-Control-Allow-Origin *

Access-Control-Allow-Credentials true

Connection keep-alive

Content-Encoding gzip

Transfer-Encoding chunked

Comparte este documento

Tokenization

Copiar el enlace

Clipboard Icon
Tabla de Contenidos

Products

  • Cyberpac
  • Addon Payments
  • POS integrated Payments
  • Universal Pay

Sales

Tell us about your business so we can offer you the best solution.

Contact an expert
Contact an expert
Contact an expert
Contact an expert
Contact an expert

Technical Support

Already a client and need help? Contact us, we’re here for you.

Help

Partners

We work with the best partners for in-store and ecommerce solutions. Want to join us?

Join us

© Comercia Global Payments

Privacy policy
Exercising rights
Client information
Whistleblowing channel
Legal disclaimer
Cookies policy
Ask AI
Write your question. For example: How do I create a payment link?
SmartWiki may skip data. Verify the information or contact support.

SmartWiki, Powered by AI

API - Developers Docs
Manage cookie consent

To offer the best experiences, we use technologies such as cookies to store and/or access device information. Consent to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Failure to consent, or withdrawal of consent, may adversely affect certain features and functions.

Functional Always active
Storage or technical access is strictly necessary for the legitimate purpose of allowing the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
Technical storage or access is necessary for the legitimate purpose of storing preferences not requested by the subscriber or user.
Statistics
El almacenamiento o acceso técnico que es utilizado exclusivamente con fines estadísticos. Storage or technical access that is used exclusively for anonymous statistical purposes. Without a requirement, voluntary compliance by your Internet service provider, or additional records from a third party, information stored or retrieved solely for this purpose cannot be used to identify you.
Marketing
Storage or technical access is necessary to create user profiles to send advertising, or to track the user on a website or several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
See preferences
{title} {title} {title}

Consulta la documentación de las distintas secciones de integraciones:

Comienza a integrar

undraw_add_to_cart_re_wrdo 1 (1) (1)

Plugins para CMS

Complementa la integración

SDKs

Métodos de pago

Herramientas

Addon Payments

Consulta la documentación de Addon Payments. Aquí tienes las distintas secciones:

Integraciones

Consultas frecuentes

Portal Backoffice

Cyberpac

We are currently working on the English version of the Cyberpac documentation. You can view the Spanish version using the buttons below:

Canales BackOffice Portal

Plugins integration

Custom integrations

POS integrated Payments

Create a solution that will help you automate processes. You can even add payment processes on physical terminals.

Payment Integrated with Android POS

Payment Integrated with Smartphone POS

POS Data sheets

Addon Payments

Comercia Global Payments has several integration options so you can choose the most efficient one for you.

Integrations

Frequently Asked Questions

BackOffice Portal

Consult the documentation of the different integrations sections:​

Start integration

undraw_add_to_cart_re_wrdo 1 (1) (1)

CMS Plugins

Complement your integration

SDKs

Payment Methods

Tools