# API 2.0 (Current)
# Overview
TripLink APIs are based on HTTPS protocol, the user should make POST requests following the instructions, see APIs.
The request body and response body of all APIs are in JSON
format and UTF-8
encoded. The user should include Content-Type: application/json
in request header.
The requests and responses of all APIs contain several public parameters which are located in request header and response header, see Public Parameters.
The requests and responses of all APIs are encrypted and signed, see Encryption, Signature.
Environment | URL |
---|---|
TEST | https://vcc-compass-fat.ctripqa.com/compass/api |
PROD (domestic) | https://compass.ctrip.com/compass/api |
PROD (overseas) | https://compass.triplinkintl.com/compass/api |
WARNING
PROD (domestic) will stop service on 2023/2/20, please change to PROD (overseas) as soon as possible. Please access the service by URL directly and do not use IP whitelist.
# Public Parameters
# Request header
Name | Required | Description | Comment | Sample |
---|---|---|---|---|
customerId | Y | customer ID | Pre-configured. | ASR3F1B4Z5 |
service | Y | API name | See APIs. | createCard |
version | Y | API version | Current version 2.0 . | 2.0 |
requestId | Y | request ID | Must be unique for each request, UUID is recommended. | 472f37e3-a803-47ed-b9b6-32632895b466 |
timestamp | Y | request timestamp | UNIX timestamp (milliseconds). | 1642747436113 |
sign | Y | request signature | See Signature. | _Ue0BiWsCOxbYD39Ldd (partial data) |
# Response header
Name | Description | Comment | Sample |
---|---|---|---|
customerId | customer ID | Same as Request header. | ASR3F1B4Z5 |
service | API name | Same as Request header. | createCard |
version | API version | Same as Request header. | 2.0 |
requestId | request ID | Same as Request header. | 472f37e3-a803-47ed-b9b6-32632895b466 |
timestamp | response timestamp | UNIX timestamp (milliseconds). | 1642747437393 |
code | response code | Enumerated type, 3 digits, see response code drop-down list. | 200 (code other than 200 means API call failed) |
message | response code details | See response code drop-down list. | succeed |
sign | response signature | See Signature. | WO8waUZ30bYlKp-_s9m (partial data) |
response code
code | message | Comment |
---|---|---|
200 | succeed | Succeed. |
400 | payload decrypt failed | Decrypt payload failed. |
403 | the ip is not whitelisted | Request IP not in whitelist |
405 | unsupported method | Request method not supported. (only support POST ) |
406 | too many requests | Too many requests. |
407 | verify sign failed | Verify sign failed. |
417 | the parameter is null or invalid | Required request header is empty. |
500 | (not fixed) | System error. |
# APIs
Name | Method | Request service header |
---|---|---|
Create Card | POST | createCard |
Update Card | POST | updateCard |
Recharge Card | POST | rechargeCard |
Withdraw Card | POST | withdrawCard |
Suspend Card | POST | suspendCard |
Unsuspend Card | POST | unSuspendCard |
Close Card | POST | closeCard |
Query Card | POST | queryCardDetail |
FX Quote | POST | fxQuote |
Query Account Credit | POST | queryCustomerCredit |
Query Authorization Transaction | POST | queryAuthTranscation |
Query Settlement Transaction | POST | querySettlementTranscation |
# Encryption
To ensure data security, TripLink will encrypt every requests and responses.
The user and TripLink should use the symmetric encryption algorithm AES/ECB/PKCS5Padding
to encrypt and decrypt both Request body and Response body, the result is encoded by Base64
.
The user should provide 128
bits AES
key (Base64
encoded) to TripLink in advance, see Preparation.
# Request body
For the meaning of each properties in original request body, please refer to each API description below.
User: Encrypts the original request body with AES
key and encodes with Base64
. Makes the result as the value of payload
property in actual request body. Sends out the actual request body.
TripLink: Decodes the payload
property of received actual request body with Base64
and decrypts with AES
key. The result is the original request body.
# Response body
For the meaning of each properties in original response body, please refer to each API description below.
TripLink: Encrypts the original response body with AES
key and encodes with Base64
. Makes the result as the value of payload
property in actual response body. Sends out the actual response body.
User: Decodes the payload
property of received actual response body with Base64
and decrypts with AES
key. The result is the original response body.
Java Utilities example
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;
import static java.nio.charset.StandardCharsets.UTF_8;
public class AesUtils {
private static final Base64.Encoder ENCODER = Base64.getEncoder();
private static final Base64.Decoder DECODER = Base64.getDecoder();
public static String aesEncrypt(SecretKey key, String plaintext) throws Exception {
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] cipherBytes = cipher.doFinal(plaintext.getBytes(UTF_8));
return new String(ENCODER.encode(cipherBytes), UTF_8);
}
public static String aesDecrypt(SecretKey key, String ciphertext) throws Exception {
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, key);
byte[] cipherBytes = DECODER.decode(ciphertext.getBytes(UTF_8));
return new String(cipher.doFinal(cipherBytes), UTF_8);
}
public static SecretKey newAesKey(String keyStr) {
return new SecretKeySpec(DECODER.decode(keyStr.getBytes(UTF_8)), "AES");
}
public static String toAesKeyStr(SecretKey key) {
return new String(ENCODER.encode(key.getEncoded()), UTF_8);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Java 6
users can consider using theorg.apache.commons.codec.binary.Base64
Class instead of the newjava.util.Base64
Class introduced inJava 8
.
PHP Utilities example
<?php declare(strict_types=1);
class AesUtils {
public static function aesEncrypt(string $keyStr, string $plaintext): string {
return base64_encode(openssl_encrypt($plaintext, 'AES-128-ECB', base64_decode($keyStr), OPENSSL_RAW_DATA));
}
public static function aesDecrypt(string $keyStr, string $ciphertext): string {
return openssl_decrypt(base64_decode($ciphertext), 'AES-128-ECB', base64_decode($keyStr), OPENSSL_RAW_DATA);
}
}
2
3
4
5
6
7
8
9
10
11
12
# Signature
To ensure safe API calls, TripLink will authenticate each request and response using signature.
TripLink uses the signature algorithm SHA256withRSA
to sign both Request string to be signed and Response string to be signed. The signature result is encoded by Base64
, located in sign
property of request header and response header.
The user will be assigned 2048
bits RSA
public key T (Base64
encoded). The user should also provide 2048
bits RSA
public key U (Base64
encoded) to TripLink in advance, see Preparation.
The entire request and response process involves 2 RSA
keys: The public key T and private key T which belongs to TripLink, the public key U and private key U which belongs to user. The public keys are used for verifying the signature and the private keys are used for generating the signature.
# Request string to be signed
All the properties are concatenated by |
symbol in the following order.
customerId|service|version|requestId|timestamp|payload
customerId
,service
,version
,requestId
andtimestamp
comes from request header.
payload
comes from thepayload
property in actual request body.
User: Generates the signature on request string to be signed with private key U and encodes with Base64
. Makes the result as the value of sign
property in request header.
TripLink: Decodes the sign
property of received request header with Base64
and verifies with public key U.
# Response string to be signed
All the properties are concatenated by |
symbol in the following order.
customerId|service|version|requestId|timestamp|code|message|payload
customerId
,service
,version
,requestId
,timestamp
,code
andmessage
comes from response header.
payload
comes from thepayload
property in actual response body.
TripLink: Generates the signature on response string to be signed with private key T and encodes with Base64
. Makes the result as the value of sign
property in response header.
User: Decodes the sign
property of received response header with Base64
and verifies with public key T.
Java Utilities example
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Signature;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
import static java.nio.charset.StandardCharsets.UTF_8;
public class Rsa8Utils {
private static final Base64.Encoder ENCODER_URL = Base64.getUrlEncoder().withoutPadding();
private static final Base64.Decoder DECODER_URL = Base64.getUrlDecoder();
private static final Base64.Encoder ENCODER = Base64.getEncoder();
private static final Base64.Decoder DECODER = Base64.getDecoder();
public static String rsaSign(PrivateKey privateKey, String content) throws Exception {
Signature signer = Signature.getInstance("SHA256withRSA");
signer.initSign(privateKey);
signer.update(content.getBytes(UTF_8));
return new String(ENCODER_URL.encode(signer.sign()), UTF_8);
}
public static boolean rsaVerify(PublicKey publicKey, String content, String signature) throws Exception {
Signature signer = Signature.getInstance("SHA256withRSA");
signer.initVerify(publicKey);
signer.update(content.getBytes(UTF_8));
return signer.verify(DECODER_URL.decode(signature.getBytes(UTF_8)));
}
public static PrivateKey newRsaPrivateKey(String privateKeyStr) throws Exception {
byte[] bytes = DECODER.decode(privateKeyStr.getBytes(UTF_8));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
return keyFactory.generatePrivate(new PKCS8EncodedKeySpec(bytes));
}
public static PublicKey newRsaPublicKey(String publicKeyStr) throws Exception {
byte[] bytes = DECODER.decode(publicKeyStr.getBytes(UTF_8));
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
return keyFactory.generatePublic(new X509EncodedKeySpec(bytes));
}
public static String toRsaPrivateKeyStr(PrivateKey privateKey) {
return new String(ENCODER.encode(privateKey.getEncoded()), UTF_8);
}
public static String toRsaPublicKeyStr(PublicKey publicKey) {
return new String(ENCODER.encode(publicKey.getEncoded()), UTF_8);
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
Java 6
users can consider using theorg.apache.commons.codec.binary.Base64
Class instead of the newjava.util.Base64
Class introduced inJava 8
.
PHP Utilities example
<?php declare(strict_types=1);
class RsaUtils {
public static function rsaSign(string $privateKeyStr, string $content): string {
openssl_sign($content, $signature, self::pemFormat($privateKeyStr, 'PRIVATE KEY'), OPENSSL_ALGO_SHA256);
return base64_encode($signature);
}
public static function rsaVerify(string $publicKeyStr, string $content, string $signature): bool {
return openssl_verify($content, base64_decode($signature), self::pemFormat($publicKeyStr, 'PUBLIC KEY'), OPENSSL_ALGO_SHA256) === 1;
}
private static function pemFormat(string $keyStr, string $label): string {
return "-----BEGIN {$label}-----\n" . chunk_split($keyStr, 64) . "-----END {$label}-----\n";
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Create Card
# Request body
Name | Type | Required | Description | Comment |
---|---|---|---|---|
requestId | String | Y | request ID | Same as Request header. |
customerId | String | Y | customer ID | Same as Request header. |
cardCurrencyCode | String | N | card currency code | Default same as settlement currency code. ISO 4217 currency code, 3 digits. |
settlementCurrencyCode | String | Y | settlement currency code | ISO 4217 currency code, 3 digits. |
activeDate | String | Y | effective date | Format yyyy-MM-dd . |
inactiveDate | String | Y | expiration date | Format yyyy-MM-dd . |
cardLimit | Number | Y | credit limit | Decimal, matching card currency. |
minAuthAmount | Number | Y | lower limit of single authorized transaction | Decimal, matching card currency. (Not take effect on Prepaid card) |
maxAuthAmount | Number | Y | upper limit of single authorized transaction | Decimal, matching card currency. (Not take effect on Prepaid card) |
maxAuthTimes | Number | Y | maximum authorized transaction times | Integer. 1 : one time card, -1 : no limit. |
cardCloseUsage | Number | N | auto close threshold percentage | Integer, between 0 and 100 , default 0 .When the settled credit / credit limit per cent larger than or equal to this value, the card will be auto closed. Special value 0 : the card will not be auto closed.(Not take effect on Prepaid card) |
supportedMccGroup | String | Y | accepted MCC group | Accepted Merchant Category Code group, defined by TripLink. Transaction requests which are not belong to this group will be rejected. |
supportedMid | String | N | accepted merchant ID | Transaction requests which are not from this merchant will be rejected. |
supportedAcquirerId | String | N | accepted acquirer ID | Transaction requests which are not from this acquirer will be rejected. |
multipleCurrencyCard | Boolean | N | whether allow transactions not in card currency | Default true . |
cvv2ForceCheck | Boolean | N | whether verify CCV2 | Default false . |
allow3ds | Boolean | N | whether allow 3DS | Default true .(Only take effect on Hong Kong MasterCard) |
cardProductCode | String | Y | card product code | Enumerated type Allowed values: C02 , C03 , C05 . |
cardType | String | Y | card brand | Enumerated type, default GWTTP .Allowed values: GWTTP , MCO , USDVCC etc. |
cardLabel | String | Y | card association | Enumerated type, default MasterCard .Allowed values: MasterCard , VISA . |
cardBin | String | N | IIN code | The Issuer Identification Number, defined by TripLink. |
timeZone | String | N | card time zone | The time zone of the card effective and expiration date, format example: China Standard Time GMT+08:00 Eastern Standard Time GMT-05:00 The default value can be configurated at Merchant System/Setting/VAN Default Configuration |
userReferenceMap | Object | N | user defined properties | String key-value pair, including 20 optional keys.Between useRef1Txt and useRef20Txt . |
TripLink will only save and display the user defined properties without involving business logic.
request body sample
{
"requestId": "1ac60d08-0e15-47da-a341-7287dd46ff39",
"customerId": "CSR47284A93E35E4",
"cardCurrencyCode": "840",
"settlementCurrencyCode": "840",
"activeDate": "2022-01-01",
"inactiveDate": "2024-06-01",
"cardLimit": 1000.12,
"minAuthAmount": 3.45,
"maxAuthAmount": 500.67,
"maxAuthTimes": -1,
"cardCloseUsage": 40,
"supportedMccGroup": "ecom",
"multipleCurrencyCard": true,
"cvv2ForceCheck": true,
"cardBin":"522981",
"cardType": "GWTTP",
"cardLabel": "MasterCard",
"userReferenceMap": {
"useRef1Txt": "anything"
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Response body
Name | Type | Description | Comment |
---|---|---|---|
returnCode | String | result code | Enumerated type, 6 digits, see result code drop-down list.(code other than 000000 means request failed) |
errorMessage | String | result code description | See result code drop-down list. |
cardLogId | String | card ID | TripLink card ID. |
cardNum | String | card number | 16 digits card number. |
cardExpirationDate | String | expiration date | Format yyMM . |
cvv2 | String | CVV2 | Card Verification Value. |
cardType | String | card brand | |
cardLabel | String | card association |
result code
returnCode | errorMessage |
---|---|
000000 | Success |
100000 | Input parameter is incorrect (not fixed) |
100001 | Reduplicative requestid |
200002 | Both MCC, MCC groups and [acquirerId,merchantId] are all empty |
200003 | Customer info not find |
200007 | Global parameter not find |
200008 | InactiveDate must be greater than activeDate |
200013 | Not find the mapping between the cardCurrency and settlementCurrency |
200014 | AcquirerId/mid must not be empty |
200022 | Not find active pan number config |
200029 | Card exists pending request |
200036 | card bin not support |
200037 | InactiveDate must submit |
200038 | cardCloseUsage not be null |
200040 | Invalid global parameter (indate) |
200043 | mcc group is empty |
200044 | mcc group all is not supported |
200048 | Card issuer failed (not fixed) |
200060 | Card issuer parameter error (not fixed) |
300004 | mcc link channel group is empty |
300005 | Trading is risky |
9XXXXX | System error (not fixed) |
response body sample
{
"returnCode": "000000",
"errorMessage": "Success",
"cardLogId": "9448b6a7b3bcb22f99c1bedd246aba092c7932fd5e7f3042607bf58bc7cc3d83",
"cardNum": "5229811460053354",
"cardExpirationDate": "2406",
"cvv2": "123",
"cardType": "GWTTP",
"cardLabel": "MasterCard"
}
2
3
4
5
6
7
8
9
10
# SDK Sample
Java SDK
public void testCreateCard() {
HttpClient<CallHttpResponse> httpClient = new TripLinkHttpClient();
TripLinkBizImplV2 tripLinkCore = new TripLinkBizImplV2(CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY, AES_KEY, BASE_URL, httpClient);
TripLinkApiImplV2 tripLinkApi = new TripLinkApiImplV2(tripLinkCore);
CardCreateRequest request = new CardCreateRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setCustomerId(CUSTOMER_ID);
request.setCardCurrencyCode("840");
request.setSettlementCurrencyCode("840");
request.setActiveDate("2022-01-01");
request.setInactiveDate("2024-06-01");
request.setCardLimit(BigDecimal.valueOf(1000.12));
request.setMinAuthAmount(BigDecimal.valueOf(3.45));
request.setMaxAuthAmount(BigDecimal.valueOf(500.67));
request.setMaxAuthTimes(-1);
request.setCardCloseUsage(40);
request.setSupportedMccGroup("ecom");
request.setMultipleCurrencyCard(true);
request.setCvv2ForceCheck(true);
request.setCardBin("522981");
request.setCardType("GWTTP");
request.setCardLabel("MasterCard");
Map<String, String> userReference = new HashMap<>();
userReference.put("useRef1Txt", "anything");
request.setUserReferenceMap(userReference);
CardCreateResponse response = tripLinkApi.create(request);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
PHP SDK
public function testCreateCard(): void {
$httpClient = new GuzzleHttpClient();
$customer = new Customer(CUSTOMER_ID, AES_KEY, CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY);
$tripLinkAgent = new SimpleTripLinkAgent(BASE_URL, $customer, $httpClient);
$request = new CreateCardRequest(uniqid(), CUSTOMER_ID);
$request->setCardCurrencyCode('840');
$request->setSettlementCurrencyCode('840');
$request->setActiveDate('2022-01-01');
$request->setInactiveDate('2024-06-01');
$request->setCardLimit(1000.12);
$request->setMinAuthAmount(3.45);
$request->setMaxAuthAmount(500.67);
$request->setMaxAuthTimes(-1);
$request->setCardCloseUsage(40);
$request->setSupportedMccGroup('ecom');
$request->setMultipleCurrencyCard(true);
$request->setCvv2ForceCheck(true);
$request->setCardBin('522981');
$request->setCardType('GWTTP');
$request->setCardLabel('MasterCard');
$userReference = new UserReference();
$userReference->setUseRef1Txt('anything');
$request->setUserReferenceMap($userReference);
$response = $tripLinkAgent->createCard($request);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
BASE_URL
: API URL;CARD_LOG_ID
: card ID.
CUSTOMER_ID
: customer ID;CUSTOMER_PRIVATE_KEY
: customer RSA private key.
AES_KEY
: AES key;TRIPLINK_PUBLIC_KEY
: TripLink RSA public key.
# Update Card
# Request body
Name | Type | Required | Description | Comment |
---|---|---|---|---|
requestId | String | Y | request ID | Same as Request header. |
customerId | String | Y | customer ID | Same as Request header. |
cardLogId | String | Y | card ID | TripLink card ID. |
activeDate | String | N | effective date | Format yyyy-MM-dd . |
inactiveDate | String | N | expiration date | Format yyyy-MM-dd . |
cardLimit | Number | N | credit limit | Decimal, matching card currency. |
minAuthAmount | Number | N | lower limit of single authorized transaction | Decimal, matching card currency. (Not take effect on Prepaid card) |
maxAuthAmount | Number | N | upper limit of single authorized transaction | Decimal, matching card currency. (Not take effect on Prepaid card) |
cardCloseUsage | Number | N | auto cancel threshold percentage | Integer, between 0 and 100 , default 0 .When the settled credit / credit limit per cent larger than or equal to this value, the card will be auto closed. Special value 0 : the card will not be auto closed.(Not take effect on Prepaid card) |
supportedMccGroup | String | N | accepted MCC group | Accepted Merchant Category Code group, defined by TripLink. Transaction requests which are not belong to this group will be rejected. |
supportedMid | String | N | accepted merchant ID | Transaction requests which are not from this merchant will be rejected. |
supportedAcquirerId | String | N | accepted acquirer ID | Transaction requests which are not from this acquirer will be rejected. |
multipleCurrencyCard | Boolean | N | whether allow transactions not in card currency | |
cvv2ForceCheck | Boolean | N | whether verify CCV2 | |
allow3ds | Boolean | N | whether allow 3DS | (Only take effect on Hong Kong MasterCard) |
timeZone | String | N | card time zone | The time zone of the card effective and expiration date, format example: China Standard Time GMT+08:00 Eastern Standard Time GMT-05:00 The default value can be configurated at Merchant System/Setting/VAN Default Configuration |
userReferenceMap | Object | N | user defined properties | String key-value pair, including 20 optional keys.Between useRef1Txt and useRef20Txt . |
TripLink will only save and display the user defined properties without involving business logic.
request body sample
{
"requestId": "15b77002-748d-4c89-b6a3-1fa0a25adf3b",
"customerId": "CSR47284A93E35E4",
"cardLogId": "9f289daa62ac6e941f918634de3f91a142eea82c09ac27783ea7c2d9c07f8ec3",
"cardLimit": 2000.12,
"multipleCurrencyCard": false,
"cvv2ForceCheck": false
}
2
3
4
5
6
7
8
# Response body
Name | Type | Description | Comment |
---|---|---|---|
returnCode | String | result code | Enumerated type, 6 digits, see result code drop-down list.(code other than 000000 means request failed) |
errorMessage | String | result code description | See result code drop-down list. |
cardLogId | String | card ID | TripLink card ID. |
cardNum | String | card number | 16 digits card number. |
cardExpirationDate | String | expiration date | Format yyMM . |
cvv2 | String | CVV2 | Card Verification Value. |
userReferenceMap | Object | user defined properties | String key-value pair, including 20 optional keys.Between useRef1Txt and useRef20Txt . |
TripLink will only save and display the user defined properties without involving business logic.
result code
returnCode | errorMessage |
---|---|
000000 | Success |
100000 | Input parameter is incorrect (not fixed) |
100001 | Reduplicative requestid |
200001 | ActiveDate must be greater than current date (not fixed) |
200003 | Customer info not find |
200007 | Global parameter not find |
200009 | Effective mccGroup not find |
200014 | AcquirerId/mid must not be empty |
200015 | Not find card |
200016 | Card status is clop or clos |
200019 | Update card limit is less than the amount of used card |
200029 | Card exists pending request |
200032 | Not find customer global setting |
200036 | card bin not support |
200048 | Card issuer failed (not fixed) |
200060 | Card issuer parameter error (not fixed) |
300004 | mcc link channel group is empty |
300005 | Trading is risky |
9XXXXX | System error (not fixed) |
response body sample
{
"returnCode": "000000",
"errorMessage": "Success",
"cardLogId": "9f289daa62ac6e941f918634de3f91a142eea82c09ac27783ea7c2d9c07f8ec3",
"cardNum": "5395933355051253",
"cardExpirationDate": "2406",
"cvv2": "123",
"userReferenceMap": {
"useRef1Txt": "anything"
}
}
2
3
4
5
6
7
8
9
10
11
# SDK Sample
Java SDK
public void testUpdateCard() {
HttpClient<CallHttpResponse> httpClient = new TripLinkHttpClient();
TripLinkBizImplV2 tripLinkCore = new TripLinkBizImplV2(CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY, AES_KEY, BASE_URL, httpClient);
TripLinkApiImplV2 tripLinkApi = new TripLinkApiImplV2(tripLinkCore);
CardUpdateRequest request = new CardUpdateRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setCustomerId(CUSTOMER_ID);
request.setCardLogId(CARD_LOG_ID);
request.setCardLimit(BigDecimal.valueOf(2000.12));
request.setMultipleCurrencyCard(false);
request.setCvv2ForceCheck(false);
CardUpdateResponse response = tripLinkApi.update(request);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
PHP SDK
public function testUpdateCard(): void {
$httpClient = new GuzzleHttpClient();
$customer = new Customer(CUSTOMER_ID, AES_KEY, CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY);
$tripLinkAgent = new SimpleTripLinkAgent(BASE_URL, $customer, $httpClient);
$request = new UpdateCardRequest(uniqid(), CUSTOMER_ID);
$request->setCardLogId(CARD_LOG_ID);
$request->setCardLimit(2000.12);
$request->setMultipleCurrencyCard(false);
$request->setCvv2ForceCheck(false);
$response = $tripLinkAgent->updateCard($request);
}
2
3
4
5
6
7
8
9
10
11
12
13
BASE_URL
: API URL;CARD_LOG_ID
: card ID.
CUSTOMER_ID
: customer ID;CUSTOMER_PRIVATE_KEY
: customer RSA private key.
AES_KEY
: AES key;TRIPLINK_PUBLIC_KEY
: TripLink RSA public key.
# Recharge Card
# Request body
Name | Type | Required | Description | Comment |
---|---|---|---|---|
requestId | String | Y | request ID | Same as Request header. |
customerId | String | Y | customer ID | Same as Request header. |
cardLogId | String | Y | card ID | TripLink card ID. |
rechargeAmount | Number | Y | recharge amount | Decimal, matching card currency. |
request body sample
{
"requestId": "9340c297-e8b8-4148-b0b7-3d8aa5fcb487",
"customerId": "CSR47284A93E35E4",
"cardLogId": "9261267e66b808e9a2f62fe54e516192677236b943aa2dee1836284b369768d7",
"rechargeAmount": 100.12
}
2
3
4
5
6
# Response body
Name | Type | Description | Comment |
---|---|---|---|
returnCode | String | result code | Enumerated type, 6 digits, see result code drop-down list.(code other than 000000 means request failed) |
errorMessage | String | result code description | See result code drop-down list. |
result code
returnCode | errorMessage |
---|---|
000000 | Success |
100000 | Input parameter is incorrect (not fixed) |
200003 | Customer info not find |
200015 | Not find card |
200016 | Card status is clop or clos |
300003 | Call JPM gateway error |
300004 | mcc link channel group is empty |
9XXXXX | System error (not fixed) |
response body sample
{
"returnCode": "000000",
"errorMessage": "Success"
}
2
3
4
# SDK Sample
Java SDK
public void testRechargeCard() {
HttpClient<CallHttpResponse> httpClient = new TripLinkHttpClient();
TripLinkBizImplV2 tripLinkCore = new TripLinkBizImplV2(CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY, AES_KEY, BASE_URL, httpClient);
TripLinkApiImplV2 tripLinkApi = new TripLinkApiImplV2(tripLinkCore);
CardRechargeRequest request = new CardRechargeRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setCustomerId(CUSTOMER_ID);
request.setCardLogId(CARD_LOG_ID);
request.setRechargeAmount(BigDecimal.valueOf(100.12));
CardRechargeResponse response = tripLinkApi.recharge(request);
}
2
3
4
5
6
7
8
9
10
11
12
13
PHP SDK
public function testRechargeCard(): void {
$httpClient = new GuzzleHttpClient();
$customer = new Customer(CUSTOMER_ID, AES_KEY, CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY);
$tripLinkAgent = new SimpleTripLinkAgent(BASE_URL, $customer, $httpClient);
$request = new RechargeCardRequest(uniqid(), CUSTOMER_ID);
$request->setCardLogId(CARD_LOG_ID);
$request->setRechargeAmount(100.12);
$response = $tripLinkAgent->rechargeCard($request);
}
2
3
4
5
6
7
8
9
10
11
BASE_URL
: API URL;CARD_LOG_ID
: card ID.
CUSTOMER_ID
: customer ID;CUSTOMER_PRIVATE_KEY
: customer RSA private key.
AES_KEY
: AES key;TRIPLINK_PUBLIC_KEY
: TripLink RSA public key.
# Withdraw Card
# Request body
Name | Type | Required | Description | Comment |
---|---|---|---|---|
requestId | String | Y | request ID | Same as Request header. |
customerId | String | Y | customer ID | Same as Request header. |
cardLogId | String | Y | card ID | TripLink card ID. |
withdrawAmount | Number | Y | withdraw amount | Decimal, matching card currency. |
request body sample
{
"requestId": "8f26c686-6275-4271-aa6d-a0a6a4df441e",
"customerId": "CSR47284A93E35E4",
"cardLogId": "9261267e66b808e9a2f62fe54e516192677236b943aa2dee1836284b369768d7",
"withdrawAmount": 80.12
}
2
3
4
5
6
# Response body
Name | Type | Description | Comment |
---|---|---|---|
returnCode | String | result code | Enumerated type, 6 digits, see result code drop-down list.(code other than 000000 means request failed) |
errorMessage | String | result code description | See result code drop-down list. |
result code
returnCode | errorMessage |
---|---|
000000 | Success |
100000 | Input parameter is incorrect (not fixed) |
200003 | Customer info not find |
200015 | Not find card |
200016 | Card status is clop or clos |
200019 | Update card limit is less than the amount of used card |
200029 | Card exists pending request |
200048 | card issuer failed |
300004 | mcc link channel group is empty |
9XXXXX | System error (not fixed) |
response body sample
{
"returnCode": "000000",
"errorMessage": "Success"
}
2
3
4
# SDK Sample
Java SDK
public void testWithdrawCard() {
HttpClient<CallHttpResponse> httpClient = new TripLinkHttpClient();
TripLinkBizImplV2 tripLinkCore = new TripLinkBizImplV2(CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY, AES_KEY, BASE_URL, httpClient);
TripLinkApiImplV2 tripLinkApi = new TripLinkApiImplV2(tripLinkCore);
CardWithdrawRequest request = new CardWithdrawRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setCustomerId(CUSTOMER_ID);
request.setCardLogId(CARD_LOG_ID);
request.setWithdrawAmount(BigDecimal.valueOf(80.12));
CardWithdrawResponse response = tripLinkApi.withdraw(request);
}
2
3
4
5
6
7
8
9
10
11
12
13
PHP SDK
public function testWithdrawCard(): void {
$httpClient = new GuzzleHttpClient();
$customer = new Customer(CUSTOMER_ID, AES_KEY, CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY);
$tripLinkAgent = new SimpleTripLinkAgent(BASE_URL, $customer, $httpClient);
$request = new WithdrawCardRequest(uniqid(), CUSTOMER_ID);
$request->setCardLogId(CARD_LOG_ID);
$request->setWithdrawAmount(80.12);
$response = $tripLinkAgent->withdrawCard($request);
}
2
3
4
5
6
7
8
9
10
11
BASE_URL
: API URL;CARD_LOG_ID
: card ID.
CUSTOMER_ID
: customer ID;CUSTOMER_PRIVATE_KEY
: customer RSA private key.
AES_KEY
: AES key;TRIPLINK_PUBLIC_KEY
: TripLink RSA public key.
# Suspend Card
# Request body
Name | Type | Required | Description | Comment |
---|---|---|---|---|
requestId | String | Y | request ID | Same as Request header. |
customerId | String | Y | customer ID | Same as Request header. |
cardLogId | String | Y | card ID | TripLink card ID. |
request body sample
{
"requestId": "7d451d22-fab3-471e-acfa-efd7aa3a1db9",
"customerId": "CSR47284A93E35E4",
"cardLogId": "f05c9c6670a956150aa346e671d6d9fe757cbe178d555a763631be75e61fee07"
}
2
3
4
5
# Response body
Name | Type | Description | Comment |
---|---|---|---|
returnCode | String | result code | Enumerated type, 6 digits, see result code drop-down list.(code other than 000000 means request failed) |
errorMessage | String | result code description | See result code drop-down list. |
result code
returnCode | errorMessage |
---|---|
000000 | Success |
100000 | Input parameter is incorrect (not fixed) |
200003 | Customer info not find |
200015 | Not find card |
200016 | Card status is clop or clos |
300006 | Not support suspend the card |
9XXXXX | System error (not fixed) |
response body sample
{
"returnCode": "000000",
"errorMessage": "Success"
}
2
3
4
# SDK Sample
Java SDK
public void testSuspendCard() {
HttpClient<CallHttpResponse> httpClient = new TripLinkHttpClient();
TripLinkBizImplV2 tripLinkCore = new TripLinkBizImplV2(CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY, AES_KEY, BASE_URL, httpClient);
TripLinkApiImplV2 tripLinkApi = new TripLinkApiImplV2(tripLinkCore);
CardSuspendRequest request = new CardSuspendRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setCustomerId(CUSTOMER_ID);
request.setCardLogId(CARD_LOG_ID);
CardSuspendResponse response = tripLinkApi.suspend(request);
}
2
3
4
5
6
7
8
9
10
11
12
PHP SDK
public function testSuspendCard(): void {
$httpClient = new GuzzleHttpClient();
$customer = new Customer(CUSTOMER_ID, AES_KEY, CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY);
$tripLinkAgent = new SimpleTripLinkAgent(BASE_URL, $customer, $httpClient);
$request = new SuspendCardRequest(uniqid(), CUSTOMER_ID);
$request->setCardLogId(CARD_LOG_ID);
$response = $tripLinkAgent->suspendCard($request);
}
2
3
4
5
6
7
8
9
10
BASE_URL
: API URL;CARD_LOG_ID
: card ID.
CUSTOMER_ID
: customer ID;CUSTOMER_PRIVATE_KEY
: customer RSA private key.
AES_KEY
: AES key;TRIPLINK_PUBLIC_KEY
: TripLink RSA public key.
# Unsuspend Card
# Request body
Name | Type | Required | Description | Comment |
---|---|---|---|---|
requestId | String | Y | request ID | Same as Request header. |
customerId | String | Y | customer ID | Same as Request header. |
cardLogId | String | Y | card ID | TripLink card ID. |
request body sample
{
"requestId": "7d451d22-fab3-471e-acfa-efd7aa3a1db9",
"customerId": "CSR47284A93E35E4",
"cardLogId": "f05c9c6670a956150aa346e671d6d9fe757cbe178d555a763631be75e61fee07"
}
2
3
4
5
# Response body
Name | Type | Description | Comment |
---|---|---|---|
returnCode | String | result code | Enumerated type, 6 digits, see result code drop-down list.(code other than 000000 means request failed) |
errorMessage | String | result code description | See result code drop-down list. |
result code
returnCode | errorMessage |
---|---|
000000 | Success |
100000 | Input parameter is incorrect (not fixed) |
200003 | Customer info not find |
200015 | Not find card |
200016 | Card status is clop or clos |
300006 | Not support unsuspend the card |
9XXXXX | System error (not fixed) |
response body sample
{
"returnCode": "000000",
"errorMessage": "Success"
}
2
3
4
# SDK Sample
Java SDK
public void testUnsuspendCard() {
HttpClient<CallHttpResponse> httpClient = new TripLinkHttpClient();
TripLinkBizImplV2 tripLinkCore = new TripLinkBizImplV2(CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY, AES_KEY, BASE_URL, httpClient);
TripLinkApiImplV2 tripLinkApi = new TripLinkApiImplV2(tripLinkCore);
CardUnsuspendRequest request = new CardUnsuspendRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setCustomerId(CUSTOMER_ID);
request.setCardLogId(CARD_LOG_ID);
CardUnsuspendResponse response = tripLinkApi.unsuspend(request);
}
2
3
4
5
6
7
8
9
10
11
12
PHP SDK
public function testUnsuspendCard(): void {
$httpClient = new GuzzleHttpClient();
$customer = new Customer(CUSTOMER_ID, AES_KEY, CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY);
$tripLinkAgent = new SimpleTripLinkAgent(BASE_URL, $customer, $httpClient);
$request = new UnsuspendCardRequest(uniqid(), CUSTOMER_ID);
$request->setCardLogId(CARD_LOG_ID);
$response = $tripLinkAgent->unsuspendCard($request);
}
2
3
4
5
6
7
8
9
10
BASE_URL
: API URL;CARD_LOG_ID
: card ID.
CUSTOMER_ID
: customer ID;CUSTOMER_PRIVATE_KEY
: customer RSA private key.
AES_KEY
: AES key;TRIPLINK_PUBLIC_KEY
: TripLink RSA public key.
# Close Card
# Request body
Name | Type | Required | Description | Comment |
---|---|---|---|---|
requestId | String | Y | request ID | Same as Request header. |
customerId | String | Y | customer ID | Same as Request header. |
cardLogId | String | Y | card ID | TripLink card ID. |
request body sample
{
"requestId": "7d451d22-fab3-471e-acfa-efd7aa3a1db9",
"customerId": "CSR47284A93E35E4",
"cardLogId": "f05c9c6670a956150aa346e671d6d9fe757cbe178d555a763631be75e61fee07"
}
2
3
4
5
# Response body
Name | Type | Description | Comment |
---|---|---|---|
returnCode | String | result code | Enumerated type, 6 digits, see result code drop-down list.(code other than 000000 means request failed) |
errorMessage | String | result code description | See result code drop-down list. |
result code
returnCode | errorMessage |
---|---|
000000 | Success |
100000 | Input parameter is incorrect (not fixed) |
200003 | Customer info not find |
200015 | Not find card |
200016 | Card status is clop or clos |
200025 | card status pre cancel not allow |
200051 | card cancel exception |
200053 | Incorrect card status |
300005 | Trading is risky |
9XXXXX | System error (not fixed) |
response body sample
{
"returnCode": "000000",
"errorMessage": "Success"
}
2
3
4
# SDK Sample
Java SDK
public void testCloseCard() {
HttpClient<CallHttpResponse> httpClient = new TripLinkHttpClient();
TripLinkBizImplV2 tripLinkCore = new TripLinkBizImplV2(CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY, AES_KEY, BASE_URL, httpClient);
TripLinkApiImplV2 tripLinkApi = new TripLinkApiImplV2(tripLinkCore);
CardCancelRequest request = new CardCancelRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setCustomerId(CUSTOMER_ID);
request.setCardLogId(CARD_LOG_ID);
CardCancelResponse response = tripLinkApi.close(request);
}
2
3
4
5
6
7
8
9
10
11
12
PHP SDK
public function testCloseCard(): void {
$httpClient = new GuzzleHttpClient();
$customer = new Customer(CUSTOMER_ID, AES_KEY, CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY);
$tripLinkAgent = new SimpleTripLinkAgent(BASE_URL, $customer, $httpClient);
$request = new CloseCardRequest(uniqid(), CUSTOMER_ID);
$request->setCardLogId(CARD_LOG_ID);
$response = $tripLinkAgent->closeCard($request);
}
2
3
4
5
6
7
8
9
10
BASE_URL
: API URL;CARD_LOG_ID
: card ID.
CUSTOMER_ID
: customer ID;CUSTOMER_PRIVATE_KEY
: customer RSA private key.
AES_KEY
: AES key;TRIPLINK_PUBLIC_KEY
: TripLink RSA public key.
# Query Card
# Request body
Name | Type | Required | Description | Comment |
---|---|---|---|---|
requestId | String | Y | request ID | Same as Request header. |
customerId | String | Y | customer ID | Same as Request header. |
cardLogId | String | Y | card ID | TripLink card ID. |
request body sample
{
"requestId": "5148d00e-d98f-4ccc-a5ef-acd1ff53d37e",
"customerId": "CSR47284A93E35E4",
"cardLogId": "0b51f2edf394d3875fa3c284186e5022236a59bc31dda6b3aba7dbe2982bc91a"
}
2
3
4
5
# Response body
Name | Type | Description | Comment |
---|---|---|---|
returnCode | String | result code | Enumerated type, 6 digits, see result code drop-down list.(code other than 000000 means request failed) |
errorMessage | String | result code description | See result code drop-down list. |
customerId | String | customer ID | Same as Request header. |
cardLogId | String | card ID | TripLink card ID. |
cardCurrencyCode | String | card currency code | ISO 4217 currency code, 3 digits. |
settlementCurrencyCode | String | settlement currency code | ISO 4217 currency code, 3 digits. |
activeDate | String | effective date | Format yyyy-MM-dd . |
inactiveDate | String | expiration date | Format yyyy-MM-dd . |
cardLimit | Number | credit limit | Decimal, matching card currency. |
minAuthAmount | Number | lower limit of single authorized transaction | Decimal, matching card currency. (Not take effect on Prepaid card) |
maxAuthAmount | Number | upper limit of single authorized transaction | Decimal, matching card currency. (Not take effect on Prepaid card) |
maxAuthTimes | Number | maximum authorized transaction times | Integer. 1 : one time card, -1 : no limit. |
cardCloseUsage | Number | auto cancel threshold percentage | Integer, between 0 and 100 , default 0 .When the settled credit / credit limit per cent larger than or equal to this value, the card will be auto closed. Special value 0 : the card will not be auto closed.(Not take effect on Prepaid card) |
supportedMccGroup | String | accepted MCC group | Accepted Merchant Category Code group, defined by TripLink. Transaction requests which are not belong to this group will be rejected. |
supportedMid | String | accepted merchant ID | Transaction requests which are not from this merchant will be rejected. |
supportedAcquirerId | String | accepted acquirer ID | Transaction requests which are not from this acquirer will be rejected. |
multipleCurrencyCard | Boolean | whether allow transactions not in card currency | |
cvv2ForceCheck | Boolean | whether verify CCV2 | |
applyTime | String | apply date | Format yyyy-MM-dd . |
status | String | card status | NORM : Normal, SUSP : Suspended, CLOP : Pre-Canceled, CLOS : Canceled. |
cardNum | String | card number | 16 digits card number. |
cardExpirationDate | String | expiration date | Format yyMM . |
cvv2 | String | CVV2 | Card Verification Value. |
availableBalance | Number | available balance | Decimal, matching card currency. |
authorizeAmount | Number | authorized amount | Decimal, matching card currency. |
settlementAmount | Number | settled amount | Decimal, matching card currency. |
cardType | String | card brand | Enumerated type. Allowed values: GWTTP , MCO , USDVCC etc. |
cardLabel | String | card association | Enumerated type. Allowed values: MasterCard , VISA . |
timeZone | String | card time zone | The time zone of the card effective and expiration date, format example: China Standard Time GMT+08:00 Eastern Standard Time GMT-05:00 The default value can be configurated at Merchant System/Setting/VAN Default Configuration |
userReferenceMap | Object | user defined properties | String key-value pair, including 20 optional keys.Between useRef1Txt and useRef20Txt . |
TripLink will only save and display the user defined properties without involving business logic.
result code
returnCode | errorMessage |
---|---|
000000 | Success |
100000 | Input parameter is incorrect (not fixed) |
200015 | Not find card |
9XXXXX | System error (not fixed) |
response body sample
{
"returnCode": "000000",
"errorMessage": "Success",
"customerId": "CSR47284A93E35E4",
"cardLogId": "0b51f2edf394d3875fa3c284186e5022236a59bc31dda6b3aba7dbe2982bc91a",
"cardCurrencyCode": "840",
"settlementCurrencyCode": "840",
"activeDate": "2022-01-01",
"inactiveDate": "2024-06-01",
"cardLimit": 1000.12,
"minAuthAmount": 3.45,
"maxAuthAmount": 500.67,
"maxAuthTimes": -1,
"cardCloseUsage": 40,
"supportedMccGroup": "ecom",
"multipleCurrencyCard": true,
"cvv2ForceCheck": true,
"applyTime": "2022-02-17",
"status": "NORM",
"cardNum": "5395933355052420",
"cardExpirationDate": "2406",
"cvv2": "123",
"availableBalance": 1000.12,
"authorizeAmount": 0.00,
"settlementAmount": 0.00,
"cardType": "GWTTP",
"cardLabel": "MasterCard",
"timeZone": "GMT+08:00",
"userReferenceMap": {
"useRef1Txt": "anything"
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# SDK Sample
Java SDK
public void testQueryCard() {
HttpClient<CallHttpResponse> httpClient = new TripLinkHttpClient();
TripLinkBizImplV2 tripLinkCore = new TripLinkBizImplV2(CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY, AES_KEY, BASE_URL, httpClient);
TripLinkApiImplV2 tripLinkApi = new TripLinkApiImplV2(tripLinkCore);
CardDetailQueryRequest request = new CardDetailQueryRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setCustomerId(CUSTOMER_ID);
request.setCardLogId(CARD_LOG_ID);
CardDetailQueryResponse response = tripLinkApi.queryCard(request);
}
2
3
4
5
6
7
8
9
10
11
12
PHP SDK
public function testQueryCard(): void {
$httpClient = new GuzzleHttpClient();
$customer = new Customer(CUSTOMER_ID, AES_KEY, CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY);
$tripLinkAgent = new SimpleTripLinkAgent(BASE_URL, $customer, $httpClient);
$request = new QueryCardRequest(uniqid(), CUSTOMER_ID);
$request->setCardLogId(CARD_LOG_ID);
$response = $tripLinkAgent->queryCard($request);
}
2
3
4
5
6
7
8
9
10
BASE_URL
: API URL;CARD_LOG_ID
: card ID.
CUSTOMER_ID
: customer ID;CUSTOMER_PRIVATE_KEY
: customer RSA private key.
AES_KEY
: AES key;TRIPLINK_PUBLIC_KEY
: TripLink RSA public key.
# FX Quote
# Request body
Name | Type | Required | Description | Comment |
---|---|---|---|---|
requestId | String | Y | request ID | Same as Request header. |
customerId | String | Y | customer ID | Same as Request header. |
sellCurrency | String | Y | sell currency | ISO 4217 currency code, 3 digits. |
buyCurrency | String | Y | buy currency | ISO 4217 currency code, 3 digits. |
fxDirection | Number | Y | trading direction | 0 :designate for selling, in which fxAmount will be sell amount;1 :designate for buying, in which fxAmount will be buy amount. |
fxAmount | Number | Y | trading amount | Decimal, matching the buy or sell currency. |
request body sample
{
"requestId": "3ddf14f6-04b0-4a66-840b-a21cf0c148ee",
"customerId": "CSR47284A93E35E4",
"sellCurrency": "156",
"buyCurrency": "840",
"fxDirection": 0,
"fxAmount": 100.00
}
2
3
4
5
6
7
8
# Response body
Name | Type | Description | Comment |
---|---|---|---|
returnCode | String | result code | Enumerated type, 6 digits, see result code drop-down list.(code other than 000000 means request failed) |
errorMessage | String | result code description | See result code drop-down list. |
quoteId | String | quote ID | Unique ID of the Quote. |
sellCurrency | String | sell currency | ISO 4217 currency code, 3 digits. |
sellAmount | Number | sell amount | Decimal, matching the sell currency. |
buyCurrency | String | buy currency | ISO 4217 currency code, 3 digits. |
buyAmount | Number | buy amount | Decimal, matching the buy currency. |
rate | Number | exchange rate | |
expireTime | String | expiration time | Format yyyy-MM-dd HH:mm:ss (UTC+08:00 ). |
result code
returnCode | errorMessage |
---|---|
000000 | Success |
9XXXXX | System error (not fixed) |
response body sample
{
"returnCode": "000000",
"errorMessage": "success",
"quoteId": "f3c41a86e880f2c71de0b5c45d4ae066",
"sellCurrency": "156",
"sellAmount": 100.00,
"buyCurrency": "840",
"buyAmount": 15.72,
"rate": 0.15707102,
"expireTime": "2022-02-25 21:56:51"
}
2
3
4
5
6
7
8
9
10
11
# SDK Sample
Java SDK
public void testFxQuote() {
HttpClient<CallHttpResponse> httpClient = new TripLinkHttpClient();
TripLinkBizImplV2 tripLinkCore = new TripLinkBizImplV2(CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY, AES_KEY, BASE_URL, httpClient);
TripLinkApiImplV2 tripLinkApi = new TripLinkApiImplV2(tripLinkCore);
QuoteRequest request = new QuoteRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setCustomerId(CUSTOMER_ID);
request.setSellCurrency("156");
request.setBuyCurrency("840");
request.setFxDirection(0);
request.setFxAmount(BigDecimal.valueOf(100.00));
QuoteResponse response = tripLinkApi.quote(request);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
PHP SDK
public function testFxQuote(): void {
$httpClient = new GuzzleHttpClient();
$customer = new Customer(CUSTOMER_ID, AES_KEY, CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY);
$tripLinkAgent = new SimpleTripLinkAgent(BASE_URL, $customer, $httpClient);
$request = new FxQuoteRequest(uniqid(), CUSTOMER_ID);
$request->setSellCurrency('156');
$request->setBuyCurrency('840');
$request->setFxDirection(0);
$request->setFxAmount(100.00);
$response = $tripLinkAgent->fxQuote($request);
}
2
3
4
5
6
7
8
9
10
11
12
13
BASE_URL
: API URL.
CUSTOMER_ID
: customer ID;CUSTOMER_PRIVATE_KEY
: customer RSA private key.
AES_KEY
: AES key;TRIPLINK_PUBLIC_KEY
: TripLink RSA public key.
# Query Account Credit
# Request body
Name | Type | Required | Description | Comment |
---|---|---|---|---|
requestId | String | Y | request ID | Same as Request header. |
customerId | String | Y | customer ID | Same as Request header. |
request body sample
{
"requestId": "3ddf14f6-04b0-4a66-840b-a21cf0c148ee",
"customerId": "CSR47284A93E35E4"
}
2
3
4
# Response body
Name | Type | Description | Comment |
---|---|---|---|
returnCode | String | result code | Enumerated type, 6 digits, see result code drop-down list.(code other than 000000 means request failed) |
errorMessage | String | result code description | See result code drop-down list. |
customerId | String | customer ID | Same as Request header. |
list | Array | account information | See Account . |
Account
Name | Type | Description | Comment |
---|---|---|---|
accountType | String | account type | CREDIT : credit account; DEBIT : debit account; CCP_ACCT : exchange account. |
accountCurrency | String | account currency | ISO 4217 currency code, 3 digits. |
accountAmount | Number | account amount | Only has value when account type CREDIT .Decimal, matching card currency. |
remainAccountAmount | Number | remain account amount | Decimal, matching card currency. |
result code
returnCode | errorMessage |
---|---|
000000 | Success |
100000 | input parameter is incorrect |
200007 | not find the account credit |
9XXXXX | System error (not fixed) |
response body sample
{
"returnCode": "000000",
"errorMessage": "success",
"customerId": "CSR47284A93E35E4",
"list": [
{
"accountType": "DEBIT",
"accountCurrency": "840",
"remainAccountAmount": 999967.66
},
{
"accountType": "DEBIT",
"accountCurrency": "978",
"remainAccountAmount": 999999.99
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# SDK Sample
Java SDK
public void testQueryAccount() {
HttpClient<CallHttpResponse> httpClient = new TripLinkHttpClient();
TripLinkBizImplV2 tripLinkCore = new TripLinkBizImplV2(CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY, AES_KEY, BASE_URL, httpClient);
TripLinkApiImplV2 tripLinkApi = new TripLinkApiImplV2(tripLinkCore);
QueryCustomerCreditAmountRequest request = new QueryCustomerCreditAmountRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setCustomerId(CUSTOMER_ID);
QueryCustomerCreditAmountResponse response = tripLinkApi.queryCustomerCreditAmount(request);
}
2
3
4
5
6
7
8
9
10
11
PHP SDK
public function testQueryAccount(): void {
$httpClient = new GuzzleHttpClient();
$customer = new Customer(CUSTOMER_ID, AES_KEY, CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY);
$tripLinkAgent = new SimpleTripLinkAgent(BASE_URL, $customer, $httpClient);
$request = new QueryAccountRequest(uniqid(), CUSTOMER_ID);
$response = $tripLinkAgent->queryAccount($request);
}
2
3
4
5
6
7
8
9
BASE_URL
: API URL;CARD_LOG_ID
: card ID.
CUSTOMER_ID
: customer ID;CUSTOMER_PRIVATE_KEY
: customer RSA private key.
AES_KEY
: AES key;TRIPLINK_PUBLIC_KEY
: TripLink RSA public key.
# Query Authorization Transaction
# Request body
Name | Type | Required | Description | Comment |
---|---|---|---|---|
requestId | String | Y | request ID | Same as Request header. |
customerId | String | Y | customer ID | Same as Request header. |
cardLogId | String | Y | card ID | TripLink card ID. |
startTime | String | Y | start date | Format yyyy-MM-dd . |
endTime | String | Y | end date | Format yyyy-MM-dd . |
request body sample
{
"requestId": "7fb57ff0-ea70-4099-acf5-eacba55e18ef",
"customerId": "CSR47284A93E35E4",
"cardLogId": "c55d99dac26bb334c07879404a93d2c6a96b42f7372f9c04d14034d019203fe4",
"startTime": "2022-02-01",
"endTime": "2022-03-01"
}
2
3
4
5
6
7
# Response body
Name | Type | Description | Comment |
---|---|---|---|
returnCode | String | result code | Enumerated type, 6 digits, see result code drop-down list.(code other than 000000 means request failed) |
errorMessage | String | result code description | See result code drop-down list. |
cardLogId | String | card ID | TripLink card ID. |
list | Array | authorization transactions | See AuthTransaction . |
result code
returnCode | errorMessage |
---|---|
000000 | Success |
100007 | NOT_FIND_CARD |
9XXXXX | System error (not fixed) |
AuthTransaction
Name | Type | Description | Comment |
---|---|---|---|
txnId | String | transaction ID | Global unique. |
transactionID | String | transaction relation ID | Authorization and corresponding reversal has same value. |
occurDateTime | String | transaction time | Format yyyy-MM-dd HH:mm:ss . |
messageType | String | transaction type | Enumerated type, 4 digits, see authorization type drop-down list. |
messageTypeDescription | String | transaction type description | See authorization type drop-down list. |
reversalType | String | reversal type | Only has value when authorization type 6930 or 6940 .0 : system reversal; 1 : non system reversal. |
responseCode | String | transaction response code | Enumerated type, 4 digits, see response code drop-down list.(code other than 0000 means authorization reject) |
responseCodeDescription | String | transaction response code description | See response code drop-down list. |
approvalCode | String | authorization code | Random 6 digits. |
originalTransactionCurrency | String | original transaction currency code | ISO 4217 currency code, 3 digits. |
originalTransactionAmount | Number | original transaction amount | Decimal, matching transaction currency. |
cardTransactionCurrency | String | card currency code | ISO 4217 currency code, 3 digits. |
cardTransactionAmount | Number | card transaction amount | Decimal, matching card currency. |
posMerchantID | String | merchant ID | |
posMerchantName | String | merchant name | |
posMerchantClassCode | String | merchant MCC | ISO 18245 merchant type, 4 digits. |
posMerchantCountry | String | merchant country | |
posMerchantCity | String | merchant city | |
posAcquirerID | String | acquirer ID |
authorization type
messageType | messageTypeDescription | Amount Sign |
---|---|---|
6810 | Authorization Approval | Positive |
6510 | Auth Refund Approval | Negative |
6930 | Authorization Reversal Approval | Negative |
6940 | Auth Refund Reversal Approval | Positive |
6820 | Authorization Query | Zero |
response code (6810 Authorization Approval)
responseCode | responseCodeDescription |
---|---|
0000 | Authorization Approval |
1002 | High Risk Transaction |
1003 | Invalid Account |
1101 | Abnormal Customer Status |
1102 | Abnormal VAN Status |
1103 | Authorization Amount Error |
1104 | VAN Amount Limit Error |
1105 | Invalid Expiry Date |
1106 | Transaction Count Over Limit |
1107 | Invalid CVV2 |
1108 | VAN Amount Limit Error |
1110 | Trans Currency Not Allowed |
1111 | MCC Error |
1112 | VAN credit limit greater than max Limit |
1113 | VAN credit limit less than min Limit |
1114 | Transaction Date before card activeDate |
1115 | Transaction Date after card inactiveDate |
1116 | Auth Amount greater than available VAN credit limit |
1117 | Auth Amount greater than available account credit limit |
1201 | Authorization already in process, please wait until the last authorization completed |
1203 | Not support 3ds |
2222 | Authorization decision reject |
2299 | Authorization decision downgrade reject |
9000 | Unknow Error |
response code (6510 Auth Refund Approval)
responseCode | responseCodeDescription |
---|---|
0000 | Authorization Approval |
1002 | High Risk Transaction |
1003 | Invalid Account |
1101 | Abnormal Customer Status |
1107 | Invalid CVV2 |
1110 | Trans Currency Not Allowed |
1111 | MCC Error |
response code (6930 Authorization Reversal Approval)
responseCode | responseCodeDescription |
---|---|
0000 | Authorization Approval |
1002 | High Risk Transaction |
1003 | Invalid Account |
1101 | Abnormal Customer Status |
1105 | Invalid Expiry Date |
2001 | Original Transaction Unmatch |
2002 | Original Transaction Unmatch |
response code (6940 Auth Refund Reversal Approval)
responseCode | responseCodeDescription |
---|---|
0000 | Authorization Approval |
1002 | High Risk Transaction |
1003 | Invalid Account |
2001 | Original Transaction Unmatch |
2002 | Original Transaction Unmatch |
response code (6820 Authorization Query)
responseCode | responseCodeDescription |
---|---|
0000 | Authorization Approval |
1002 | High Risk Transaction |
1003 | Invalid Account |
1102 | Abnormal VAN Status |
response code (6950 Authorization Auto Reversal)
responseCode | responseCodeDescription |
---|---|
0000 | Authorization Approval |
response body sample
{
"returnCode": "000000",
"errorMessage": "Success",
"cardLogId": "c55d99dac26bb334c07879404a93d2c6a96b42f7372f9c04d14034d019203fe4",
"list": [
{
"txnId": "8f77bb77-84b1-4244-9ae6-b075ae1aeb88",
"transactionID": "0216125935688468213457",
"occurDateTime": "2022-02-02 18:49:35",
"messageType": "6810",
"messageTypeDescription": "Authorization Approval",
"responseCode": "0000",
"responseCodeDescription": "Authorization Approval",
"approvalCode": "645597",
"originalTransactionCurrency": "840",
"originalTransactionAmount": 22.33,
"cardTransactionCurrency": "840",
"cardTransactionAmount": 22.33,
"posMerchantID": "080000100003",
"posMerchantName": "",
"posMerchantClassCode": "0018",
"posMerchantCountry": "",
"posMerchantCity": "",
"posAcquirerID": "213457"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# SDK Sample
Java SDK
public void testQueryAuthorization() {
HttpClient<CallHttpResponse> httpClient = new TripLinkHttpClient();
TripLinkBizImplV2 tripLinkCore = new TripLinkBizImplV2(CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY, AES_KEY, BASE_URL, httpClient);
TripLinkApiImplV2 tripLinkApi = new TripLinkApiImplV2(tripLinkCore);
QueryAuthTransactionRequest request = new QueryAuthTransactionRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setCustomerId(CUSTOMER_ID);
request.setCardLogId(CARD_LOG_ID);
request.setStartTime("2022-02-01");
request.setEndTime("2022-03-01");
QueryAuthTransactionResponse response = tripLinkApi.queryAuthTransaction(request);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
PHP SDK
public function testQueryAuthorization(): void {
$httpClient = new GuzzleHttpClient();
$customer = new Customer(CUSTOMER_ID, AES_KEY, CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY);
$tripLinkAgent = new SimpleTripLinkAgent(BASE_URL, $customer, $httpClient);
$request = new QueryAuthorizationRequest(uniqid(), CUSTOMER_ID);
$request->setCardLogId(CARD_LOG_ID);
$request->setStartTime('2022-02-01');
$request->setEndTime('2022-03-01');
$response = $tripLinkAgent->queryAuthorization($request);
}
2
3
4
5
6
7
8
9
10
11
12
BASE_URL
: API URL;CARD_LOG_ID
: card ID.
CUSTOMER_ID
: customer ID;CUSTOMER_PRIVATE_KEY
: customer RSA private key.
AES_KEY
: AES key;TRIPLINK_PUBLIC_KEY
: TripLink RSA public key.
# Query Settlement Transaction
# Request body
Name | Type | Required | Description | Comment |
---|---|---|---|---|
requestId | String | Y | request ID | Same as Request header. |
customerId | String | Y | customer ID | Same as Request header. |
cardLogId | String | Y | card ID | TripLink card ID. |
startTime | String | Y | start date | Format yyyy-MM-dd . |
endTime | String | Y | end date | Format yyyy-MM-dd . |
request body sample
{
"requestId": "9032aee1-85aa-41e8-bc46-7ff8bb36097d",
"customerId": "CSR47284A93E35E4",
"cardLogId": "c55d99dac26bb334c07879404a93d2c6a96b42f7372f9c04d14034d019203fe4",
"startTime": "2022-02-01",
"endTime": "2022-03-01"
}
2
3
4
5
6
7
# Response body
Name | Type | Description | Comment |
---|---|---|---|
returnCode | String | result code | Enumerated type, 6 digits, see result code drop-down list. (code other than 000000 means request failed) |
errorMessage | String | result code description | See result code drop-down list. |
cardLogId | String | card ID | TripLink card ID. |
list | Array | settlement transactions | See SettlementTransaction . |
result code
returnCode | errorMessage |
---|---|
000000 | Success |
100000 | Input parameter is incorrect |
100007 | NOT_FIND_CARD |
9XXXXX | System error (not fixed) |
SettlementTransaction
Name | Type | Description | Comment |
---|---|---|---|
txnId | String | transaction ID | Global unique. |
occurDateTime | String | transaction time | Format yyyy-MM-dd HH:mm:ss . |
postingDateTime | String | posting time | Format yyyy-MM-dd HH:mm:ss . |
postingSysTime | String | posting system date | Format yyyy-MM-dd . |
transactionCode | String | transaction code | Enumerated type, 4 digits, see settlement type drop-down list. |
transactionType | String | transaction code description | See settlement type drop-down list. |
approvalCode | String | approval code | Random 6 digits. |
isCredit | String | transaction type | DEBT : Debit; CRED : Credit. |
originalTransactionCurrency | String | original transaction currency code | ISO 4217 currency code, 3 digits. |
originalTransactionAmount | Number | original transaction amount | Decimal, matching transaction currency. |
cardTransactionCurrency | String | card currency code | ISO 4217 currency code, 3 digits. |
cardTransactionAmount | Number | card transaction amount | Decimal, matching card currency. |
accountCurrency | String | settlement currency code | ISO 4217 currency code, 3 digits. |
billAccountAmount | Number | settlement amount | Decimal, matching settlement currency. |
posMerchantID | String | merchant ID | |
posMerchantName | String | merchant name | |
posMerchantClassCode | String | merchant MCC | ISO 18245 merchant type, 4 digits. |
posMerchantCountry | String | merchant country | (unstandardized) |
isoMerchantCountryCode | String | merchant country | ISO 3166 country code, 3 letters.(maybe empty) |
posMerchantCity | String | merchant city | |
posAcquirerID | String | acquirer ID |
settlement type
transactionCode | transactionType | Debit/Credit | Amount Sign |
---|---|---|---|
2010 | Purchase | DEBT | Positive |
2110 | Refund | CRED | Negative |
4060 | Chargeback Release | DEBT | Positive |
4160 | Chargeback | CRED | Negative |
response body sample
{
"returnCode": "000000",
"errorMessage": "Success",
"cardLogId": "c55d99dac26bb334c07879404a93d2c6a96b42f7372f9c04d14034d019203fe4",
"list": [
{
"txnId": "ac06a617a4a5488e976dd5ee4f557289",
"occurDateTime": "2022-02-03 11:24:44",
"postingDateTime": "2022-02-03 11:24:44",
"postingSysTime": "2022-02-03",
"transactionCode": "2010",
"transactionType": "Purchase",
"approvalCode": "645597",
"isCredit": "DEBT",
"originalTransactionCurrency": "840",
"originalTransactionAmount": 22.33,
"cardTransactionCurrency": "840",
"cardTransactionAmount": 22.33,
"accountCurrency": "840",
"billAccountAmount": 22.33,
"posMerchantID": "080000100003",
"posMerchantClassCode": "0018",
"posAcquirerID": "213457"
}
]
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# SDK Sample
Java SDK
public void testQuerySettlement() {
HttpClient<CallHttpResponse> httpClient = new TripLinkHttpClient();
TripLinkBizImplV2 tripLinkCore = new TripLinkBizImplV2(CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY, AES_KEY, BASE_URL, httpClient);
TripLinkApiImplV2 tripLinkApi = new TripLinkApiImplV2(tripLinkCore);
QuerySettlementTransactionRequest request = new QuerySettlementTransactionRequest();
request.setRequestId(UUID.randomUUID().toString());
request.setCustomerId(CUSTOMER_ID);
request.setCardLogId(CARD_LOG_ID);
request.setStartTime("2022-02-01");
request.setEndTime("2022-03-01");
QuerySettlementTransactionResponse response = tripLinkApi.querySettlementTransaction(request);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
PHP SDK
public function testQuerySettlement(): void {
$httpClient = new GuzzleHttpClient();
$customer = new Customer(CUSTOMER_ID, AES_KEY, CUSTOMER_PRIVATE_KEY, TRIPLINK_PUBLIC_KEY);
$tripLinkAgent = new SimpleTripLinkAgent(BASE_URL, $customer, $httpClient);
$request = new QuerySettlementRequest(uniqid(), CUSTOMER_ID);
$request->setCardLogId(CARD_LOG_ID);
$request->setStartTime('2022-02-01');
$request->setEndTime('2022-03-02');
$response = $tripLinkAgent->querySettlement($request);
}
2
3
4
5
6
7
8
9
10
11
12
BASE_URL
: API URL;CARD_LOG_ID
: card ID.
CUSTOMER_ID
: customer ID;CUSTOMER_PRIVATE_KEY
: customer RSA private key.
AES_KEY
: AES key;TRIPLINK_PUBLIC_KEY
: TripLink RSA public key.