a a

Sale API Call(Required)

ENDPOINT
https://api-test.interpayments.com/v1/ch/sale

For testing purpose, please use the Test Cards

HEADERS
    Content-Type : application/json
    X-Requested-With : xhr
    Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NDA5MjcyNzgsImNsaWVudElkIjoiQ1JXIiwiaWQiOiJhMWQxODRiYy1lMzk5LTRiOTItYjFjNy0zY2RkMzM4YzIxMzEifQ.viBGNeKOG57nbZg1rCJbXf3H6QfM3TsEjx7QMkA3R90
REQUEST BODY
{
   "sTxId": "5ml635gste9log31t5llq2akg",
   "authCode": "optional notes/order details"
}
curl    --location --request POST "https://api-test.interpayments.com/v1/ch/sale" \
        --header "Content-Type: application/json" \
        --header "X-Requested-With: xhr" \
        --data "{
            \"sTxId\": \"Insert sTxId here\",
            \"authCode\": \"optional notes/order details\"
        }"
var https = require('https');

var options = {
    "method": "POST",
    "hostname": "api-test.interpayments.com",
    "path": "/v1/ch/sale",
    "headers": {
        "Content-Type": "application/json",
        "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 =  "{ \"sTxId\": \"Insert sTxId here\"\n, \"authCode\": \"optional notes/order details\"}";

req.write(postData);

req.end();
var settings = {
   "url": "https://api-test.interpayments.com/v1/ch/sale",
   "method": "POST",
   "timeout": 0,
   "headers": {
        "Content-Type": "application/json",
        "X-Requested-With": "xhr"
   },
   "data": { "sTxId": "Insert sTxId here", "authCode": "optional notes/order details"},
};

$.ajax(settings).done(function (response) {
    console.log(response);
});
require "uri"
require "net/http"

url = URI("https://api-test.interpayments.com/v1/ch/sale")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request["X-Requested-With"] = "xhr"
request.body = "{ "sTxId": "Insert sTxId here", "authCode": "optional notes/order details"}"

response = https.request(request)
puts response.read_body
import requests
url = 'https://api-test.interpayments.com/v1/ch/sale'
payload = "{ \n\"sTxId\": \"Insert sTxId here\"\n, \"authCode\": \"optional notes/order details\"}"
headers = {
    'Content-Type': 'application/json',
    '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/sale",
        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 =>"{ "sTxId": "Insert sTxId here", "authCode": "optional notes/order details"}",
        CURLOPT_HTTPHEADER => array(
            "Content-Type: application/json",
            "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"
    "os"
    "path/filepath"
    "net/http"
    "io/ioutil"
)

func main() {

url := https://api-test.interpayments.com/v1/ch/sale
method := "POST"

payload := strings.NewReader("{
    "sTxId": "5ml635gste9log31t5llq2akg",
    "authCode": "optional notes/order details"
}")

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("X-Requested-With", "xhr")

res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)

fmt.Println(string(body))
}
RESPONSE
{ 
"sTxId": "5ml635gste9log31t5llq2akg"
}
Nomenclature
NameInformationMandatory
mTxIdA Merchant orderId or unique identifier in the Merchant e-commerce scope referencing the Order or Shopping Cart. This field is optional.Yes, if sTxId is not passed
sTxIdIt is a unique identifier in the InterPayments system which refers to the persistence state of the Transaction Fee calculation.Yes, if mTxId is not passed
authCodeAn opaque data field that can be used to store an authorization code returned from the Merchant’s credit card processing process; or any other data representing the Merchant's transaction