Skip to content

Apple Pay

Preparations

Merchant Registration

For registration, you must provide your company name, domain name, and merchant ID (defined by Fireantpay). Apple Pay requires the Merchant ID provided by Fireantpay.

Sample request:

js
apple_pay_integrator_identity.pem --key platform_integrator_identity.key -H "Content-Type: application/json" -d '{
        "domainNames": ["www.example.com"],
        "encryptTo": "platformintegrator.com.fireantpay",
        "partnerInternalMerchantIdentifier": "mer-example",
        "partnerMerchantName": "EXAMPLE CO.LTD"
      }'
  • domainNames: Website domain names
  • partnerInternalMerchantIdentifier: Apple merchant ID
  • partnerMerchantName: Apple merchant name (usually your company name)

Merchant Website Verification

  1. The merchant must upload the apple-developer-merchantid-domain-association file provided by Fireantpay to your website.

  2. Verify that your website can access the file at:

    https://xxx.com/.well-known/apple-developer-merchantid-domain-association
  3. Provide your website domain (e.g., xxx.com) to Fireantpay to generate the merchantIdentifier.

  4. The front-end payment page must provide an Apple validation interface; validation information shall be forwarded to FireantPay via the merchant backend for merchant verification.

Validation endpoint: /api/applepay/validate

Front-end example (direct access to Fireantpay will cause CORS issues; submit to your merchant backend):

js
fetch('/api/applepay/validate', { 
    method: 'POST',
    headers: {'Content-Type': 'application/json'},
    body: JSON.stringify({
        validationURL: event.validationURL,
        merchantIdentifier: 'merchant.com.fireanttest',
        domainName: window.location.hostname,
        displayName: 'My Store'
    })
})

Back-end example:

java
// Prepare request payload to Fireantpay
JSONObject payload = new JSONObject();
String fireantpayValidateUrl = "https://secure.fireantpay.com/api/applepay/validate";

payload.put("merchantIdentifier", merchantIdentifier);
payload.put("domainName", domainName);
payload.put("displayName", displayName);
payload.put("validationURL", validationURL);

// 1. Create HTTPS connection
HttpsURLConnection connection = (HttpsURLConnection) new URL(fireantpayValidateUrl).openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");

// 2. Send request
connection.setDoOutput(true);
try (OutputStream os = connection.getOutputStream()) {
  os.write(payload.getBytes(StandardCharsets.UTF_8));
}

// 3. Parse response
if (connection.getResponseCode() != 200) {
    throw new IOException("Apple Pay validation failed: " + connection.getResponseMessage());
}

try (InputStream is = connection.getInputStream()) {
    String responseBody = new BufferedReader(new InputStreamReader(is))
        .lines().collect(Collectors.joining("\n"));
    return JSON.parseObject(responseBody);
}

Payment Request

Payment Interface Request

  • Fill in relevant information according to the example format.
  • Submit fields using the exact field names in the table below; parameter names are case-sensitive.
  • All commands sent to this system gateway use the POST method and UTF-8 encoding.
  • Trim leading/trailing spaces from every parameter value before combining, encrypting, and submitting payment parameters.

Form Parameter Format Description

Param NameTypeLengthRequiredDescription
Order Information
merNoString5YesMerchant Number; unique ID assigned by the payment platform
gatewayNoString8YesGateway Access No.; unique ID for merchant access
orderNoString50YesStore Order No.; unique, no duplicates in the same store system
orderCurrencyString3YesPayment currency (3-digit ISO 4217 code; see Appendix)
orderAmountString10YesTotal order amount; 2 decimal places, rounded if needed
shipFeeString100NoShipping fee; numeric, max 2 decimals
discountString100NoDiscount; default negative, numeric, max 2 decimals
goodsInfoString5000YesDetailed goods info; see Appendix: Goods Information
Credit Card Information
cardNoString200YesCredit card number; for Apple Pay: masked number (e.g., 4***********1111)
tradeTypeString50YesTransaction type; fixed: APPLEPAY (required for wallet payments)
cardTokenString500YesWallet payment token (required for APPLEPAY)
User Information
firstNameString100YesFirst name
lastNameString50YesLast name
emailString200YesUser email
ipString100YesUser IP address
phoneString50YesUser phone
countryString100YesUser country (ISO 3166-1 2-letter code, e.g., US)
stateString100NoUser state/province
cityString100YesUser city
addressString500YesUser detailed address
zipString100YesUser ZIP/postal code
Consignee Information
shipFirstNameString100NoConsignee first name
shipLastNameString100NoConsignee last name
shipEmailString100NoConsignee email
shipPhoneString100NoConsignee phone
shipCountryString100NoConsignee country (ISO 3166-1 2-letter code)
shipStateString100NoConsignee state/province
shipCityString100NoConsignee city
shipAddressString100NoConsignee detailed address
shipZipString100NoConsignee ZIP/postal code
Device/OS Information
osString50YesCardholder OS
browerString50YesBrowser type
browerLangString50YesBrowser language
timeZoneString50YesTime zone
resolutionString50YesScreen resolution
newCookieString500YesNew cookie (current order cookie $$ old cookie)
oldCookieString500NoOld cookie value
Other Information
webSiteString200YesSource website domain
notifyUrlString200YesAsynchronous notification URL; platform POSTs result here; reply OK
returnUrlString200YesReal-time return URL; for 3D Secure redirection
signInfoString32YesSHA256 signature; fixed order: merNo+gatewayNo+orderNo+orderCurrency+orderAmount+cardNo+tradeType+cardToken+merKey; no spaces or + . For details, please refer to the appendix: SHA256 Signature Method.
remarkString500NoMerchant custom remark (returned as-is)


Payment Interface Response

Interface Description

After receiving and processing the merchant’s order, the gateway returns the payment result in real time in XML format with UTF-8 encoding.

Return Data Description

Parse the XML response first, then judge the payment result. See the example below.

Form Parameter Format Description

Param NameTypeMax LengthDescription
merNoString5Merchant Number
gatewayNoString8Gateway Access No.
tradeNoString50Platform transaction serial number (unique)
orderNoString50Merchant order number
orderCurrencyString3Order currency (ISO 4217)
orderAmountString10Order amount
orderStatusString1Transaction status:-1=Pending 0=Failed 1=Success 5=Failed (3D abandoned)
orderInfoString100Transaction result message
billAddressString100Billing descriptor (success only)
returnTypeString1Return type: 1(Browser real-time) 2(Server real-time) 3(Server asynchronous)
orderErrorCodeString50Error code; 00 = success
signInfoString32SHA256 signature: merNo+gatewayNo+tradeNo+orderNo+orderCurrency+orderAmount+orderStatus+orderInfo+merKey
remarkString500Merchant remark (as-is)
redirectUrlString5003D Secure redirect URL

Payment Return Example

xml
<?xml version="1.0" encoding="UTF-8"?>
<respon>
<merNo>80000</merNo>
<gatewayNo>80000001</gatewayNo>
<tradeNo>N025050101235959566838</tradeNo>
<orderNo>Test-123456</orderNo>
<orderAmount>10.00</orderAmount>
<orderCurrency>USD</orderCurrency>
<orderStatus>1</orderStatus>
<orderErrorCode>00</orderErrorCode>
<orderInfo>Approved</orderInfo>
<paymentMethod>Credit Card</paymentMethod>
<returnType>2</returnType>
<billAddress>Test Descriptor</billAddress>
<signInfo>B359F45698D1CE8A341C64815D346C9EDA8F14657D997901EA4D30FFODFC232A</signInfo>
<remark></remark>
<redirectUrl></redirectUrl>
</respon>

Common Errors

I0013: Signature Value (signInfo) Error

  • Check merKey correctness and case consistency.
  • Use SHA256 signature.
  • Remove all leading/trailing spaces from combined parameters.

I0014: Test Gateway Access No. → Production Payment Gateway

  • Use the test gateway during development.
  • Contact support to switch the merchant number to production after testing.

I0015: Production Gateway Access No. → Test Payment Gateway

  • After switching to production, update the submission URL in your code to the production endpoint.

E0008: Duplicate Payment

  • Multiple submissions for the same order within a short window (≈30s) are blocked to prevent duplicate payments.

Appendix

Goods Information

Format (fixed order):

GoodsName#,#GoodsID#,#UnitPrice#,#Qty#;#NextGoods...
  • Separate fields with #,#
  • Separate goods with #;#
  • Use 0 for empty values
  • Currency matches the order currency
  • All symbols are half-width

Example:

Good1#,#ID1#,#10.00#,#2#;#Good2#,#ID2#,#15.50#,#1

Transaction Currency ISO 4217

CodeDescription ENDescription CN
CNYChinese Yuan人民币
USDUS Dollar美元
HKDHong Kong Dollar港币
GBPPound Sterling英镑
JPYJapanese Yen日元
EUREuro欧元
AUDAustralian Dollar澳元
SGDSingapore Dollar新加坡元
NZDNew Zealand Dollar新西兰元
TWDNew Taiwan Dollar台币
KRWSouth Korean Won韩元
DKKDanish Krone丹麦克朗
MYRMalaysian Ringgit马币
THBThai Baht泰铢
INRIndian Rupee印度卢比
PHPPhilippine Peso菲律宾比索
CHFSwiss Franc瑞士法郎
SEKSwedish Krona瑞典克朗
ILSIsraeli New Shekel新谢克尔
ZARSouth African Rand兰特
RUBRussian Ruble卢布
NOKNorwegian Krone挪威克朗
AEDUAE Dirham迪拉姆
ARSArgentine Peso阿根廷比索
BRLBrazilian Real巴西雷亚尔
MMKMyanmar Kyat缅币
CADCanadian Dollar加元
COPColombian Peso哥伦比亚比索
HUFHungarian Forint匈牙利福林
IDRIndonesian Rupiah印尼卢比
KWDKuwaiti Dinar科威特第纳尔
LAKLaotian Kip老挝基普
MXNMexican Peso墨西哥比索
NGNNigerian Naira尼日利亚奈拉
PLNPolish Złoty波兰兹罗提
QARQatari Riyal卡塔尔里亚尔
SARSaudi Riyal沙特里亚尔
TRYTurkish Lira新土耳其里拉
VNDVietnamese Dong越南盾

Error List

CodeDescription
I0001Merchant No. cannot be empty
I0002Gateway No. cannot be empty
I0003Encryption Value cannot be empty
I0004Merchant No. and Gateway No. mismatch
I0005Merchant No. not activated
I0006Merchant No. disabled
I0007Merchant No. does not exist
I0008Abnormal merchant status
I0009Gateway Access No. not activated
I0010Gateway Access No. disabled
I0011Gateway Access No. deleted
I0012Abnormal gateway status
I0013Invalid signInfo
I0014Test gateway → production interface
I0015Production gateway → test interface
I0016Gateway not bound to this interface
I0017Order No. cannot be empty
I0018Order No. over 50 chars
I0019Order amount cannot be empty
I0020Invalid order amount
I0021Amount must have ≤2 decimals and ≥0
I0022Currency cannot be empty
I0023Invalid currency
I0024Return URL cannot be empty
I0025Return URL over 1000 chars
I0059Required parameter missing
I0060Invalid parameter length
I0061Successful txn exists for this order (24h)
I0062System exception
I0067Remark over 500 chars
I0068Two-party verification failed
I0069Please select payment method
I0070Please select payment type
I0071IP cannot be empty
I0072Invalid IP format
I0092Invalid payment method
I0115Order not found
I0132Transaction type cannot be empty
I0133Invalid transaction type
I0134Appid cannot be empty
I0135Openid cannot be empty
I0136Goods info cannot be empty
R0000High risk
R0001Website not submitted/approved
R0002Cross-border transaction
C0001Gateway not bound to channel
C0002Rate not set
E0001Operation timeout
E0008Duplicate payment
T0001Test payment success
U0001Cardholder cancelled

SHA256 Signature Method

Java

java
signInfo=sha256(merNo+gateWayNo+orderNo+orderCurrency+orderAmount+cardNo+tradeType+cardToken+merKey);

PHP

php
$signInfo=hash("sha256",$merNo.$gateWayNo.$orderNo.$orderCurrency.$orderAmount.$cardNo.$tradeType.$cardToken.$merKey);

ApplePay Format

  • cardNo: The format of cardNo is a masked card number, where the first digit indicates the card brand (Visa: 4, Mastercard: 5, JCB: 35, AE: 34), and the last four digits are the actual last four digits of the card number. The middle part is padded with asterisks (*) to make a total length of 16 digits.(e.g., 4***********1111)
  • cardToken: full wallet token JSON

ApplePay Token Example

json
{
  "paymentData": {
    "data": "kTWMTlpcZV4VamhQGYL6O89tSn2zcyrvEJVUvdcBhro...",
    "signature": "MIAGCSqGSIb3DQEHAqCAMIACAQExDTALBglghkgB...",
    "header": {
      "publicKeyHash": "nHSr4aTmUBLmIiCH15Y+ZbRt03L/c3FTaaR59iSGztc=",
      "ephemeralPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE1V+nhAGl86sIA49ZIPUCsBjw0v6MzVEUlrY1slTlC9DT5Q7cye7GJSI0yWMGfpvtrM1i4IqZVqOci7LAkBGAZg==",
      "transactionId": "6b76240ac14c8231e009a43e28fb2206be0ce3f939cf2bbb605fc5ebd7f0ed4c"
    },
    "version": "EC_v1"
  },
  "paymentMethod": {
    "displayName": "Visa 0121",
    "network": "Visa",
    "type": "credit"
  },
  "transactionIdentifier": "6b76240ac14c8231e009a43e28fb2206be0ce3f939cf2bbb605fc5ebd7f0ed4c"
}

Payment Submission Example PHP

php
$data = array(
    'merNo'             => $merNo,
    'gatewayNo'         => $gatewayNo,
    'orderNo'           => $orderNo,
    'orderAmount'       => $orderAmount,
    'orderCurrency'     => $orderCurrency,
    'shipFee'           => $shipFee,
    'firstName'         => $firstName,
    'lastName'          => $lastName,
    'email'             => $email,
    'phone'             => $phone,
    'zip'               => $zip,
    'address'           => $address,
    'city'              => $city,
    'state'             => $state,
    'country'           => $country,
    'shipFirstName'     => $shipFirstName,
    'shipLastName'      => $shipLastName,
    'shipPhone'         => $shipPhone,
    'shipEmail'         => $shipEmail,
    'shipCountry'       => $shipCountry,
    'shipState'         => $shipState,
    'shipCity'          => $shipCity,
    'shipAddress'       => $shipAddress,
    'shipZip'           => $shipZip,
    'returnUrl'         => $returnUrl,
    'notifyUrl'         => $notifyUrl,
    'shipMethod'        => $shipMethod,
    'signInfo'          => $signInfo,
    'cardNo'            => $cardNo,
    'cardToken'         => $cardToken,
    'tradeType'       =>   $tradeType,
    'ip'                => $ip,
    'os'                => $os,
    'brower'            => $brower,
    'browerLang'        => $browerLang,
    'timeZone'          => $timeZone,
    'resolution'        => $resolution,
    'goodsInfo'         => $goodsInfo,
    'oldCookie'         => $oldCookie,
    'newCookie'         => $newCookie
);

// Submit via CURL to FireAnt Payment Gateway
$result = curl_post('https://sandbox.fireantpay.com/TPInterface', http_build_query($data));
$xmlstring = simplexml_load_string($result, 'SimpleXMLElement', LIBXML_NOCDATA);
$value_array = json_decode(json_encode($xmlstring), true);

// Redirect to 3D Secure if redirectUrl exists
if (!empty($value_array['redirectUrl'])) {
    header('Location:'.$value_array['redirectUrl']);
    exit;
}

// Get order status
$orderStatus = $value_array['orderStatus'];
if ($orderStatus == "1") {
    echo "Payment Successful";
}