# 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
Query Account Credit POST queryCustomerCredit
Query Authorization Transactions POST queryAuthTransactionByPage
Query Settlement Transactions POST settlementTransactionQuery
Initiate Account Withdrawal POST payoutCreate
Query Account Withdrawal POST payoutQuery
FX Quote POST fxQuote
FX Create Order POST fxCreate
FX Query Order POST fxQuery

# 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);
          }
      }
      
      1
      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 the org.apache.commons.codec.binary.Base64 Class instead of the new java.util.Base64 Class introduced in Java 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);
          }
      }
      
      1
      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
      
      1

      customerId, service, version, requestId and timestamp comes from request header.

      payload comes from the payload 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
      
      1

      customerId, service, version, requestId, timestamp, code and message comes from response header.

      payload comes from the payload 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);
          }
      }
      
      1
      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 the org.apache.commons.codec.binary.Base64 Class instead of the new java.util.Base64 Class introduced in Java 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";
          }
      }
      
      1
      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.
      quoteId String N quote ID The quote ID returned by FX Quote.
      If valid, exchange at this rate; If invalid, exchange at the real-time rate.
      (Only take effect on card product code C05)
      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"
        }
      }
      
      1
      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"
      }
      
      1
      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);
      }
      
      1
      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);
      }
      
      1
      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.
      (Not take effect on Prepaid card)
      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
      }
      
      1
      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"
        }
      }
      
      1
      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);
      }
      
      1
      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);
      }
      
      1
      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
      }
      
      1
      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"
      }
      
      1
      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);
      }
      
      1
      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);
      }
      
      1
      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
      }
      
      1
      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"
      }
      
      1
      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);
      }
      
      1
      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);
      }
      
      1
      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"
      }
      
      1
      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"
      }
      
      1
      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);
      }
      
      1
      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);
      }
      
      1
      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"
      }
      
      1
      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"
      }
      
      1
      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);
      }
      
      1
      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);
      }
      
      1
      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"
      }
      
      1
      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"
      }
      
      1
      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);
      }
      
      1
      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);
      }
      
      1
      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"
      }
      
      1
      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"
        }
      }
      
      1
      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);
      }
      
      1
      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);
      }
      
      1
      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 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"
      }
      
      1
      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
          }
        ]
      }
      
      1
      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);
      }
      
      1
      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);
      }
      
      1
      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 Transactions

      # 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.
      orderNo String N order number Order number.
      transactionStatus String N transaction status Enumerated type, allowed values: 1: Approved, 2: Declined.
      transactionCode String N transaction type Enumerated type, 4 digits, see authorization type drop-down list.
      transactionStartTime String N transaction start time Format yyyy-MM-dd HH:mm:ss.
      transactionEndTime String N transaction end time Format yyyy-MM-dd HH:mm:ss.
      pageNo Number N page number Integer, range [1,100], default 1.
      pageSize Number N page size Integer, range [1,100], default 5.
      request body sample
      {
          "requestId":"7fb57ff0-ea70-4099-acf5-eacba55e18ef",
          "customerId":"CSR47284A93E35E4",
          "cardLogId":"c55d99dac26bb334c07879404a93d2c6a96b42f7372f9c04d14034d019203fe4",
          "transactionStartTime":"2022-10-01 03:00:00",
          "transactionEndTime":"2022-10-02 04:00:00",
          "pageNo":1,
          "pageSize":10
      }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9

      # 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.
      count Number count Integer, the number of transaction data returned.
      more Boolean more data Whether there are more paginated data under this request condition.
      true means there are more.
      transactionData 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
      requestId String transaction ID Globally unique.
      cardLogId String card ID TripLink card ID.
      transactionId String transaction relation ID Authorization and corresponding reversal has same value.
      orderNo String order number Order number.
      transactionCurrencyCode String transaction currency code ISO 4217 currency code, 3 digits.
      transactionAmount Number transaction amount Decimal, matching transaction currency.
      cardCurrencyCode String card currency ISO 4217 currency code, 3 digits.
      cardTransactionAmount Number card transaction Amount Decimal, matching card currency.
      responseCode String transaction response code Enumerated type, 4 digits, see response code drop-down list.
      (code other than 0000 means authorization reject)
      responseDescription String transaction response code description See response code drop-down list.
      approvalCode String authorization code Random 6 alphanumeric.
      transactionCode String transaction type Enumerated type, 4 digits, see authorization type drop-down list.
      transactionDate String transaction time Format yyyy-MM-dd HH:mm:ss.
      merchantName String merchant name
      mcc String merchant MCC ISO 18245 merchant type, 4 digits.
      merchantCountry String merchant country (unstandardized)
      isoMerchantCountryCode String merchant country ISO 3166-1 alpha-3 country code, 3 letters.
      (maybe empty)
      merchantCity String merchant city
      merchantId String merchant ID
      acquiringBankId String acquirer ID
      cardInitialBalance Number card opening balance Decimal, matching card currency.
      cardEndingBalance Number card closing balance Decimal, matching card currency.
      creditTransactionSign String credit transaction marker Enumerated type, allowed values: 0: Debit, 1: Credit.
      reversalType String reversal type Only has value when authorization type 6930 or 6940.
      0: system reversal; 1: non system reversal.
      authorization type
      messageType messageTypeDescription Transaction Direction
      6810 Authorization Approval Debit
      6510 Auth Refund Approval Credit
      6930 Authorization Reversal Approval Credit
      6940 Auth Refund Reversal Approval Debit
      6820 Authorization Query Debit
      response code (6810 Authorization Approval)
      responseCode responseCodeDescription
      0000 Authorization Approval
      1002 High Risk Transaction
      1003 Invalid Account
      1101 Abnormal Customer Status
      1102 Card canceled
      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
      1118 Limited usage with abnormal card status
      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 Card canceled
      1118 Limited usage with abnormal card status
      response body sample
      {
          "returnCode":"000000",
          "errorMessage":"Success",
          "cardLogId":"3d70589dfe5c9a771c520d3382ad67af6a17389128b1c3d7968d33b3f62d0703",
          "count":1,
          "more":true,
          "transactionData":[
              {
                  "cardLogId":"3d70589dfe5c9a771c520d3382ad67af6a17389128b1c3d7968d33b3f62d0703",
                  "requestId":"63fe1c0b-9030-4d57-82c7-74eec6e4a450",
                  "transactionId":"0707110634049997213457",
                  "orderNo":"dingdan11",
                  "transactionCurrencyCode":"344",
                  "transactionAmount":1000,
                  "cardCurrencyCode":"840",
                  "cardTransactionAmount":127.44,
                  "responseCode":"0000",
                  "responseDescription":"Authorization Approval",
                  "approvalCode":"730704",
                  "transactionCode":"6810",
                  "transactionDate":"2022-07-07 19:06:34",
                  "merchantName":"ALIEXPRESS.COM",
                  "mcc":"0015",
                  "merchantCountry":"SGP",
                  "merchantCity":"Singapore",
                  "merchantId":"87846545546",
                  "acquiringBankId":"213457",
                  "creditTransactionSign":"0",
                  "reversalType":"0"
              }
          ]
      }
      
      1
      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 testQueryAuthorizationByPage() {
          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);
      
          QueryAuthTransactionByPageRequest request = new QueryAuthTransactionByPageRequest();
          request.setRequestId(UUID.randomUUID().toString());
          request.setCustomerId(CUSTOMER_ID);
          request.setCardLogId(CARD_LOG_ID);
          request.setTransactionStartTime("2022-02-01 03:00:00");
          request.setTransactionEndTime("2022-03-02 04:00:00");
      
          QueryAuthTransactionByPageResponse response = tripLinkApi.authTransactionQueryByPage(request);
      }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      PHP SDK
      public function testQueryAuthorizationByPage(): 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 QueryAuthorizationByPageRequest(uniqid(), CUSTOMER_ID);
          $request->setCardLogId(CARD_LOG_ID);
          $request->setTransactionStartTime('2022-02-01 03:00:00');
          $request->setTransactionEndTime('2022-03-02 04:00:00');
      
          $response = $tripLinkAgent->queryAuthorizationByPage($request);
      }
      
      1
      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 Transactions

      # 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.
      settlementStartTime String Y settlement start time Format yyyy-MM-dd HH:mm:ss.
      settlementEndTime String Y settlement end time Format yyyy-MM-dd HH:mm:ss.
      pageNo Number N page number Integer, range [1,100], default 1.
      pageSize Number N page size Integer, range [1,100], default 5.
      request body sample
      {
        "requestId": "9032aee1-85aa-41e8-bc46-7ff8bb36097d",
        "customerId": "CSR47284A93E35E4",
        "cardLogId": "c55d99dac26bb334c07879404a93d2c6a96b42f7372f9c04d14034d019203fe4",
        "settlementStartTime": "2022-02-01 03:00:00",
        "settlementEndTime": "2022-03-01 04:00:00"
      }
      
      1
      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.
      count Number count Integer, the number of transaction data returned.
      more Boolean more data Whether there are more paginated data under this request condition.
      true means there are more.
      settlementData 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
      serialNo String transaction ID Globally 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 system posting time Format yyyy-MM-dd.
      transactionCode String transaction type Enumerated type, 4 digits, see settlement type drop-down list.
      transactionType String transaction code description See settlement type drop-down list.
      approvalCode String authorization code Random 6 alphanumeric.
      isCredit String credit transaction DEBT: Debit, CRED: Credit.
      originalTransactionCurrency String transaction currency code ISO 4217 currency code, 3 digits.
      originalTransactionAmount Number transaction amount Decimal, matching transaction currency.
      cardTransactionCurrency String card currency 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-1 alpha-3 country code, 3 letters.
      (maybe empty)
      posMerchantCity String merchant city
      posAcquirerID String acquirer ID
      transactionId String transaction relation ID Settlement and corresponding authorization has same value.
      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
      
      
      1

      # SDK Sample

      Java SDK
      
      
      1
      PHP SDK
      
      
      1

      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.

      # Initiate Account Withdrawal

      # 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.
      paymentCurrency String Y withdrawal currency code ISO 4217 currency code, 3 digits.
      paymentAmount Number Y withdrawal amount Decimal, matching withdrawal currency.
      beneficiaryAccountNo String Y beneficiary account number The account must be registered at TripLink.
      Please contact your account manager for details.
      beneficiaryAccountName String Y beneficiary account name
      beneficiaryBankName String Y beneficiary bank name
      beneficiaryBankCountryCode String Y beneficiary bank country ISO 3166-1 alpha-2 country code, 2 letters.
      reference String Y reference Will be directly transmitted to the receiving bank, the length should not exceed 90 characters.
      Only English, numbers, spaces, and some special characters , - ()./ are allowed.
      clientOrderId String N client order ID
      request body sample
      {
        "requestId": "9032aee1-85aa-41e8-bc46-7ff8bb36097d",
        "customerId": "CSR47284A93E35E4",
        "paymentCurrency": "840",
        "paymentAmount": "100.21",
        "beneficiaryAccountNo": "660010011001",
        "beneficiaryAccountName": "Trip company",
        "beneficiaryBankName": "JP Morgan",
        "beneficiaryBankCountryCode": "HK",
        "reference": "payment to xx",
        "clientOrderId": "13211000"
      }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12

      # 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.
      orderId String order ID Globally unique.
      paymentCurrency String withdrawal currency code ISO 4217 currency code, 3 digits.
      paymentAmount Number withdrawal amount Decimal, matching withdrawal currency.
      acceptTime String acceptance time Format yyyy-MM-dd HH:mm:ss.
      result code
      returnCode errorMessage
      000000 Success
      100000 Input parameter is incorrect
      150016 RequestId is exists
      9XXXXX System error (not fixed)
      response body sample
      {
        "returnCode": "000000",
        "errorMessage": "Success",
        "orderId": "142303141346210898",
        "paymentCurrency": "840",
        "paymentAmount": "100.21",
        "acceptTime": "2023-03-14 12:00:00"
      }
      
      1
      2
      3
      4
      5
      6
      7
      8

      # SDK Sample

      Java SDK
      public void testPayoutCreate() {
          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);
      
          PayoutCreateRequest request = new PayoutCreateRequest();
          request.setRequestId(UUID.randomUUID().toString());
          request.setCustomerId("CSR2E54DC4B8A5D4");
          request.setPaymentCurrency("840");
          request.setPaymentAmount(new BigDecimal("100"));
          request.setBeneficiaryAccountNo("12321424");
          request.setBeneficiaryAccountName("trip company");
          request.setBeneficiaryBankName("bank name");
          request.setBeneficiaryBankCountryCode("HK");
          request.setReference("reference123");
          request.setClientOrderId("f334f967102d");
          
          PayoutCreateResponse response = tripLinkApi.payoutCreate(request);
      }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      19
      PHP SDK
      
      
      1

      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 Account Withdrawal

      # 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.
      oriRequestId String Y original initiate request ID

      :: details request body sample

      {
        "requestId": "68519520-66ef-404d-82cc-fa34f967002d",
        "customerId": "CSR47284A93E35E4",
        "oriRequestId": "9032aee1-85aa-41e8-bc46-7ff8bb36097d"
      }
      
      1
      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.
      orderId String order ID Globally unique.
      status String order status 1: Processing, 2: Remitted, 3: Review Rejection,
      4: Remittance Rejection, 5: Remittance Exception, 6: Refunded
      paymentCurrency String withdrawal currency code ISO 4217 currency code, 3 digits.
      paymentAmount Number withdrawal amount Decimal, matching withdrawal currency.
      beneficiaryAccountNo String beneficiary account number
      beneficiaryAccountName String beneficiary account name
      acceptTime String acceptance time Format yyyy-MM-dd HH:mm:ss.
      clientOrderId String client order ID
      result code
      returnCode errorMessage
      000000 Success
      100000 Input parameter is incorrect
      150017 Order is not exists
      9XXXXX System error (not fixed)
      response body sample
      {
        "returnCode": "000000",
        "errorMessage": "Success",
        "orderId": "142303141346210898",
        "status": 1,
        "paymentCurrency": "840",
        "paymentAmount": "100.21",
        "beneficiaryAccountNo": "1232112",
        "beneficiaryAccountName": "trip company",
        "acceptTime": "2023-03-14 12:00:00",
        "clientOrderId": "clientOrderId"
      }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12

      # SDK Sample

      Java SDK
      public void testPayoutQuery() {
          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);
      
          PayoutQueryRequest request = new PayoutQueryRequest();
          request.setRequestId(UUID.randomUUID().toString());
          request.setCustomerId("CSR2E54DC4B8A5D4");
          request.setOriRequestId("9032aee1-85aa-41e8-bc46-7ff8bb36097d");
          
          PayoutQueryResponse response = tripLinkApi.payoutQuery(request);
      }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      PHP SDK
      
      
      1

      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:Selling, in this case, fxAmount is the sell amount;
      1:Buying, in this case, fxAmount is the buy amount.
      fxAmount Number Y trading amount Decimal, matching buy or sell currency.
      request body sample
      {
        "requestId": "3ddf14f6-04b0-4a66-840b-a21cf0c148ee",
        "customerId": "CSR47284A93E35E4",
        "sellCurrency": "156",
        "buyCurrency": "840",
        "fxDirection": 0,
        "fxAmount": 100.00
      }
      
      1
      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 Globally unique.
      sellCurrency String sell currency ISO 4217 currency code, 3 digits.
      sellAmount Number sell amount Decimal, matching sell currency.
      buyCurrency String buy currency ISO 4217 currency code, 3 digits.
      buyAmount Number buy amount Decimal, matching buy currency.
      rate Number exchange rate Decimal.
      expireTime String expiration time Format yyyy-MM-dd HH:mm:ss (Time zone 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"
      }
      
      1
      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);
      }
      
      1
      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);
      }
      
      1
      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.

      # FX Create Order

      # 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:Selling, in this case, fxAmount is the sell amount;
      1:Buying, in this case, fxAmount is the buy amount.
      fxAmount Number Y trading amount Decimal, matching buy or sell currency.
      quoteId String N quote ID The quote ID returned by FX Quote.
      If not provided, exchange at the real-time rate.
      request body sample
      {
        "requestId": "9032aee1-85aa-41e8-bc46-7ff8bb36097d",
        "customerId": "CSR32384FAC033D4",
        "sellCurrency": "840",
        "buyCurrency": "157",
        "fxDirection": "0",
        "fxAmount": "200.99"
      }
      
      1
      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.
      orderId String order ID Globally unique.
      acceptTime String acceptance time Format yyyy-MM-dd HH:mm:ss.
      sellCurrency String sell currency ISO 4217 currency code, 3 digits.
      sellAmount Number sell amount Decimal, matching sell currency.
      buyCurrency String buy currency ISO 4217 currency code, 3 digits.
      buyAmount Number buy amount Decimal, matching buy currency.
      rate Number exchange rate Decimal.
      quoteId String quote ID
      result code
      returnCode errorMessage
      000000 Success
      100000 Input parameter is incorrect
      100006 No rate
      100010 account currency not enough
      100017 customer product is not support
      120034 RequestId is exists
      120035 Fx info not match quote info
      120037 The exchange amount is not within the limit
      9XXXXX System error (not fixed)
      response body sample
      {
        "returnCode": "000000",
        "errorMessage": "Success",
        "orderId": "646873e2-4d3f-486b-83af-e6a0bc6d464c",
        "acceptTime": "2024-01-08 14:38:17",
        "sellCurrency": "840",
        "sellAmount": "28.08",
        "buyCurrency": "157",
        "buyAmount": "200.99",
        "rate": "7.15711345",
        "quoteId": "ff36346e5c5c4562af194ba44165d759"
      }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12

      # SDK Sample

      Java SDK
      public void testFxCreate() {
          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);
      
          FxCreateRequest request = new FxCreateRequest();
          request.setRequestId(String.valueOf(UUID.randomUUID()));
          request.setCustomerId("CSR2E54DC4B8A5D4");
          request.setSellCurrency("840");
          request.setBuyCurrency("344");
          request.setFxDirection(0);
          request.setFxAmount(new BigDecimal("100.03"));
          
          FxCreateResponse response = tripLinkApi.fxCreate(request);
      }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      PHP SDK
      public function testFxCreate(): 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 FxCreateRequest(uniqid(), CUSTOMER_ID);
          $request->setSellCurrency('840');
          $request->setBuyCurrency('157');
          $request->setFxDirection(0);
          $request->setFxAmount(2.98);
          $request->setQuoteId('');
          
          $response = $tripLinkAgent->fxCreate($request);
      }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14

      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.

      # FX Query Order

      # 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.
      oriRequestId String N original initiate request ID Either oriRequestId or orderId is required.
      orderId String N order ID Either oriRequestId or orderId is required.
      request body sample
      {
        "requestId": "2024010800000001",
        "customerId": "CSR32384FAC033D4",
        "oriRequestId": "9032aee1-85aa-41e8-bc46-7ff8bb360976"
      }
      
      1
      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.
      orderId String order ID Globally unique.
      status Number status 0: Processing, 1: Success, 2: Failure.
      acceptTime String acceptance time Format yyyy-MM-dd HH:mm:ss.
      sellCurrency String sell currency ISO 4217 currency code, 3 digits.
      sellAmount Number sell amount Decimal, matching sell currency.
      buyCurrency String buy currency ISO 4217 currency code, 3 digits.
      buyAmount Number buy amount Decimal, matching buy currency.
      rate Number exchange rate Decimal.
      quoteId String quote ID
      result code
      returnCode errorMessage
      000000 Success
      100000 Input parameter is incorrect
      120036 Fx order not found
      9XXXXX System error (not fixed)
      response body sample
      {
        "returnCode": "000000",
        "errorMessage": "Success",
        "orderId": "f1f0dded-a130-4bc9-be08-0d9cc9072dc4",
        "status": 1,
        "acceptTime": "2024-01-08 14:39:31",
        "sellCurrency":"840",
        "sellAmount":200.99,
        "buyCurrency":"157",
        "buyAmount":1438.51,
        "rate":7.15711345,
        "quoteId":"94eae20cbbc54c7e89c502a653ce41bc"
      }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13

      # SDK Sample

      Java SDK
      public void testFxQuery() {
          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);
      
          FxQueryRequest request = new FxQueryRequest();
          request.setRequestId(String.valueOf(UUID.randomUUID()));
          request.setCustomerId("CSR2E54DC4B8A5D4");
          request.setOriRequestId("testRequest1");
          
          FxQueryResponse response = tripLinkApi.fxQuery(request);
      }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      PHP SDK
      public function testFxQuery(): 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 FxQueryRequest(uniqid(), CUSTOMER_ID);
          $request->setOrderId('27f4b30b-3ddc-4736-8c9d-a35d3e73cae7');
          
          $response = $tripLinkAgent->fxQuery($request);
      }
      
      1
      2
      3
      4
      5
      6
      7
      8
      9
      10

      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.