Transaction Fee API Call
This API uses the required input fields to calculate the estimated credit card transaction fee based on the pricing models and processors that have been configured for this individual merchant.
The transaction API response message contains the calculated transaction fee and the InterPayments unique identifier (sTxId - which will be unique per transaction).
ENDPOINT
https://api-test.interpayments.com/v1/ch
For testing purpose, please use the Test Cards
HEADERS
Content-Type : application/json
X-Requested-With : xhr
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTU2MTc4NzcsIm5hbWUiOiJwb3N0bWFuIiwiaWQiOiI3MDI4NTk3Yy02MzQ4LTQzOTAtOTQwNi1lNjVmNmQyZTZiOGUiLCJkYXRhIjpbInBvc3RtYW4gLSBodWdvIGRvYyBzaXRlIC0gbm9uZXhwIl19.1UrOuxISUTul8HkOR0ZuOH33INFcZ2vFy29_iH0fqnU
REQUEST BODY
For subsequent calls to update this transaction either mTxId/sTxId is required.
{
"region":"85004",
"nicn":"424242",
"amount":100.00,
"campaign": ["optional text field1"]
}
curl --location --request POST "https://api-test.interpayments.com/v1/ch" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTU2MTc4NzcsIm5hbWUiOiJwb3N0bWFuIiwiaWQiOiI3MDI4NTk3Yy02MzQ4LTQzOTAtOTQwNi1lNjVmNmQyZTZiOGUiLCJkYXRhIjpbInBvc3RtYW4gLSBodWdvIGRvYyBzaXRlIC0gbm9uZXhwIl19.1UrOuxISUTul8HkOR0ZuOH33INFcZ2vFy29_iH0fqnU" \
--header "X-Requested-With: xhr" \
--data "{
\"region\":\"85004\"
,\"nicn\":\"424242\"
,\"amount\":100.00
,\"campaign\":[\"optional text field1\"]
}"
var https = require('https');
var options = {
'method': 'POST',
'hostname': 'api-test.interpayments.com',
'path': '/v1/ch',
'headers': {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTU2MTc4NzcsIm5hbWUiOiJwb3N0bWFuIiwiaWQiOiI3MDI4NTk3Yy02MzQ4LTQzOTAtOTQwNi1lNjVmNmQyZTZiOGUiLCJkYXRhIjpbInBvc3RtYW4gLSBodWdvIGRvYyBzaXRlIC0gbm9uZXhwIl19.1UrOuxISUTul8HkOR0ZuOH33INFcZ2vFy29_iH0fqnU',
'X-Requested-With': 'xhr'
}
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = "{ \"campaign\":[\"optional text field1\"]\n,\"region\":\"85004\"\n,\"nicn\":\"424242\"\n,\"amount\":100.00\n}";
req.write(postData);
req.end();
var settings = {
"url": "https://api-test.interpayments.com/v1/ch",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTU2MTc4NzcsIm5hbWUiOiJwb3N0bWFuIiwiaWQiOiI3MDI4NTk3Yy02MzQ4LTQzOTAtOTQwNi1lNjVmNmQyZTZiOGUiLCJkYXRhIjpbInBvc3RtYW4gLSBodWdvIGRvYyBzaXRlIC0gbm9uZXhwIl19.1UrOuxISUTul8HkOR0ZuOH33INFcZ2vFy29_iH0fqnU",
"X-Requested-With": "xhr"
},
"data": "{\"campaign\":[\"optional text field1\"]\n,\"region\":\"85004\"\n,\"nicn\":\"42424242\"\n,\"amount\":100.00\n}",
};
$.ajax(settings).done(function (response) {
console.log(response);
});
require "uri"
require "net/http"
url = URI("https://api-test.interpayments.com/v1/ch")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTU2MTc4NzcsIm5hbWUiOiJwb3N0bWFuIiwiaWQiOiI3MDI4NTk3Yy02MzQ4LTQzOTAtOTQwNi1lNjVmNmQyZTZiOGUiLCJkYXRhIjpbInBvc3RtYW4gLSBodWdvIGRvYyBzaXRlIC0gbm9uZXhwIl19.1UrOuxISUTul8HkOR0ZuOH33INFcZ2vFy29_iH0fqnU"
request["X-Requested-With"] = "xhr"
request.body = "{\"campaign\":[\"optional text field1\"]\n,\"region\":\"85004\"\n,\"nicn\":\"42424242\"\n,\"amount\":100.00\n}"
response = https.request(request)
puts response.read_body
import requests
url = 'https://api-test.interpayments.com/v1/ch'
payload = "{\n\"campaign\":[\"optional text field1\"]\n,\"region\":\"85004\"\n,\"nicn\":\"42424242\"\n,\"amount\":100.00\n}"
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTU2MTc4NzcsIm5hbWUiOiJwb3N0bWFuIiwiaWQiOiI3MDI4NTk3Yy02MzQ4LTQzOTAtOTQwNi1lNjVmNmQyZTZiOGUiLCJkYXRhIjpbInBvc3RtYW4gLSBodWdvIGRvYyBzaXRlIC0gbm9uZXhwIl19.1UrOuxISUTul8HkOR0ZuOH33INFcZ2vFy29_iH0fqnU',
'X-Requested-With': 'xhr'
}
response = requests.request('POST', url, headers = headers, data = payload, allow_redirects=False)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api-test.interpayments.com/v1/ch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\"campaign\":[\"optional text field1\"]\n,\"region\":\"85004\"\n,\"nicn\":\"42424242\"\n,\"amount\":100.00\n}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTU2MTc4NzcsIm5hbWUiOiJwb3N0bWFuIiwiaWQiOiI3MDI4NTk3Yy02MzQ4LTQzOTAtOTQwNi1lNjVmNmQyZTZiOGUiLCJkYXRhIjpbInBvc3RtYW4gLSBodWdvIGRvYyBzaXRlIC0gbm9uZXhwIl19.1UrOuxISUTul8HkOR0ZuOH33INFcZ2vFy29_iH0fqnU",
"X-Requested-With: xhr"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
} ?>
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api-test.interpayments.com/v1/ch"
method := "POST"
payload := strings.NewReader("{\"campaign\":[\"optional text field1\"]\n,\"region\":\"85004\"\n,\"nicn\":\"42424242\"\n,\"amount\":100.00\n}")
client := &http.Client {
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
},
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTU2MTc4NzcsIm5hbWUiOiJwb3N0bWFuIiwiaWQiOiI3MDI4NTk3Yy02MzQ4LTQzOTAtOTQwNi1lNjVmNmQyZTZiOGUiLCJkYXRhIjpbInBvc3RtYW4gLSBodWdvIGRvYyBzaXRlIC0gbm9uZXhwIl19.1UrOuxISUTul8HkOR0ZuOH33INFcZ2vFy29_iH0fqnU")
req.Header.Add("X-Requested-With", "xhr")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
RESPONSE
{
"transactionFee": 3.75,
"sTxId": "47k17y158esu5yz158exfq22o",
"message": "ok"
}
JSON payload with all fields including optional fields (for syntax)
{
"amount": 60.00,
"totalAmount": 100.00,
"campaign": [ "optional text field1" ],
"country": "840",
"nicn": "411111",
"processor": "standard",
"mTxId": "merchantPO-123456",
"sTxId": "47k17y158esu5yz158exfq22o",
"region": "85004"
}
Nomenclature
Name | Information | Required |
---|---|---|
Amount | The transaction amount in US dollars. | Yes |
NICN (Non-Identifiable Card Number) | The first 6-8 digits of credit card number, also known as BIN number or IN number. InterPayments never handles more than 8 digits and therefore is not in conflict with PCI requirements or guidelines. | Yes |
Region | Zip code, two letter state abbreviation, or the ISO State Code. See for Reference. | Yes |
Campaign | This is opaque data that is available for further data analytics and is also used during A/B Test-Implementation phases. Users may pass tags in this field to be used for filtering transaction data. Format is an array of strings. | |
Country | This is an optional field and will default to 840/US. The ISO Numerical Country Code. See for Reference . | |
Processor | The MID or Name value of the processor to use for calculating Transaction Fees. This field is optional when the Merchant has only one configured processor. In that case the single, configured processor is used. | Only when multiple processors are configured |
cardToken | A credit card tokenization key to be associated with this transaction and reused later by calling /recur/surcharge. | |
data | This is opaque data that is used to pass additional transactions information such as coupon codes. Format is an array of strings. | |
TotalAmount | The transaction total in US dollars. Only applicable when using multi-pay. | Only when using multi-pay |
Transaction Fee | InterPayments generated fee for making a credit card transaction (sent in response from API). | |
mTxId | A Merchant orderId or unique transactions identifier in the Merchant e-commerce scope referencing the Order or Shopping Cart. This field is optional. If the mTxId is not known until the "sale" sequence, it may be passed at that time. | |
sTxId | It is a unique transaction identifier in the InterPayments system which refers to the persistence state of the Transaction Fee calculation. |