React Native
React Native
CardConnect Inquire
See more CardConnect Examples
Demonstrates how to get information for an individual transaction, including its settlement status (setlstat) and the response codes from the initial authorization.See https://developer.cardconnect.com/cardconnect-api?lang=json#inquire
Chilkat React Native Downloads
import { Http, JsonObject } from '@chilkat/react-native'
async function chilkatExample() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const http = new Http();
http.basicAuth = true;
http.login = 'API_USERNAME';
http.password = 'API_PASSWORD';
const url = 'https://<site>.cardconnect.com:<port>/cardconnect/rest/inquire/<retref>/<merchid>';
let responseStr: string;
try {
responseStr = await http.quickGetStrAsync(url);
} catch {
console.log(http.lastErrorText);
return;
}
// A response status of 200 indicates potential success. The JSON response body
// must be examined to determine if it was truly successful or an error.
console.log(`response status code = ${http.lastStatus}`);
const jsonResp = new JsonObject();
jsonResp.load(responseStr);
jsonResp.emitCompact = false;
console.log('response JSON:');
console.log(jsonResp.emit());
// A successful response looks like this:
// {
// "amount": "0.00",
// "resptext": "Approval",
// "setlstat": "Voided",
// "capturedate": "20190422180044",
// "acctid": "1",
// "respcode": "00",
// "entrymode": "ECommerce",
// "merchid": "MERCHANT_ID",
// "token": "9418594164541111",
// "authcode": "PPS158",
// "respproc": "FNOR",
// "authdate": "20190422",
// "bintype": "",
// "profileid": "16618402968441604028",
// "lastfour": "1111",
// "name": "TOM JONES",
// "currency": "USD",
// "retref": "112989260941",
// "respstat": "A",
// "account": "9418594164541111"
// }
// Use this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON
const amount = jsonResp.stringOf('amount');
const resptext = jsonResp.stringOf('resptext');
const setlstat = jsonResp.stringOf('setlstat');
const capturedate = jsonResp.stringOf('capturedate');
const acctid = jsonResp.stringOf('acctid');
const respcode = jsonResp.stringOf('respcode');
const entrymode = jsonResp.stringOf('entrymode');
const merchid = jsonResp.stringOf('merchid');
const token = jsonResp.stringOf('token');
const authcode = jsonResp.stringOf('authcode');
const respproc = jsonResp.stringOf('respproc');
const authdate = jsonResp.stringOf('authdate');
const bintype = jsonResp.stringOf('bintype');
const profileid = jsonResp.stringOf('profileid');
const lastfour = jsonResp.stringOf('lastfour');
const name = jsonResp.stringOf('name');
const currency = jsonResp.stringOf('currency');
const retref = jsonResp.stringOf('retref');
const respstat = jsonResp.stringOf('respstat');
const account = jsonResp.stringOf('account');
}