### JS SDK: Basic Authentication Example Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/ToC.md Example of setting up Basic Authentication for the JS SDK. Ensure your merchant ID and API key are correctly configured. ```javascript NicePay.setGlobalConfig({ "merchantId": "your_merchant_id", "apiKey": "your_api_key" }); ``` -------------------------------- ### Handle URL and Call 3rd Party Apps in Objective-C Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Handle App Schemes within URLs to call applications using openURL. This example includes checks for specific payment apps and falls back to the App Store if not installed. ```objectivec (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { NSURLRequest *request = navigationAction.request; NSURL *url = [request URL]; NSString *urlScheme = [url scheme]; NSLog(@"url : %@", url); if( ![urlScheme isEqualToString:@"http"] && ![urlScheme isEqualToString:@"https"] ) { if( [urlScheme isEqualToString:@"ispmobile"] && ![[UIApplication sharedApplication] canOpenURL:url] ) { //ISP App가 설치되어 있지 않을 경우 앱스토어로 이동 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/kr/app/id369125087?mt=8"]]; } else if( [urlScheme isEqualToString:@"kftc-bankpay"] && ![[UIApplication sharedApplication] canOpenURL:url] ) { //BANKPAY App가 설치되어 있지 않을 경우 앱스토어로 이동 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://itunes.apple.com/us/app/id398456030?mt=8"]]; } else { if( [[UIApplication sharedApplication] canOpenURL:url] ) { [[UIApplication sharedApplication] openURL:url]; //App 실행 } else { //1. App 미설치 확인 //2. info.plist 내 scheme 등록 확인 } } } decisionHandler(WKNavigationActionPolicyAllow); } ``` -------------------------------- ### Terms Inquiry Request Example Source: https://github.com/nicepayments/nicepay-manual/blob/main/api/status-terms.md Example of a GET request to the terms inquiry API, including necessary headers and query parameters. ```http GET /v1/terms?termsType={약관 유형} HTTP/1.1 Host: api.nicepay.co.kr Authorization: Basic or Bearer Content-type: application/json;charset=utf-8 ``` -------------------------------- ### Get Terms Lookup API Example Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Use this endpoint to retrieve terms and conditions information before initiating a payment. It's essential for payment methods that do not use the Nicepay payment window. Specify the terms type to get relevant information. ```bash curl -X GET 'https://api.nicepay.co.kr/v1/terms?termsType={약관유형}' -H 'Content-Type: application/json' -H 'Authorization: Basic YWYwZDExNjIzNmRmNDM3ZjgzMT...' ``` -------------------------------- ### Handle URL and Call 3rd Party Apps in Swift Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Handle App Schemes within URLs to call applications using openURL. This example includes checks for specific payment apps and falls back to the App Store if not installed. ```swift func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { let request = navigationAction.request let optUrl = request.url let optUrlScheme = optUrl?.scheme guard let url = optUrl, let scheme = optUrlScheme else { return decisionHandler(WKNavigationActionPolicy.cancel) } debugPrint("url : \(url)") if( scheme != "http" && scheme != "https" ) { if( scheme == "ispmobile" && !UIApplication.shared.canOpenURL(url) ) { //ISP 미설치 시 UIApplication.shared.openURL(URL(string: "http://itunes.apple.com/kr/app/id369125087?mt=8")!) } else if( scheme == "kftc-bankpay" && !UIApplication.shared.canOpenURL(url) ) { //BANKPAY 미설치 시 UIApplication.shared.openURL(URL(string: "http://itunes.apple.com/us/app/id398456030?mt=8")!) } else { if( UIApplication.shared.canOpenURL(url) ) { UIApplication.shared.openURL(url) } else { //1. App 미설치 확인 //2. info.plist 내 scheme 등록 확인 } } } decisionHandler(WKNavigationActionPolicy.allow) } ``` -------------------------------- ### Sandbox Testing Example Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md An example demonstrating the test development flow using sandbox environment with Basic Authentication and Server Approval model. ```APIDOC ## 샌드박스를 통한 테스트 개발 예시 - `Basic 인증` / `Server 승인` 기준으로 결제창 TEST 개발 흐름 예시를 설명 합니다. #### 결제창 호출을 위한 JS include - 결제창 호출을 위한 JS SDK를 sandbox 도메인으로 변경합니다. - clientId는 가맹점관리자 TEST상점에서 발급한 `클라이언트키`를 사용 합니다. ```html ``` > #### ⚠️ 중요 > 샌드박스를 통한 TEST가 완료되면 운영계 도메인으로 변경 해주세요.
#### 결제창 응답 - 카드사 인증을 성공하면 authResultCode가 `0000`으로 응답 됩니다. ```bash Accept: application/x-www-form-urlencoded { authResultCode: '0000', authResultMsg: '인증 성공', tid: 'UT0000113m01012110051656331001', clientId: '58e3b578555e45738d6b569e53d5ae54', orderId: 'b0980639-52db-4504-9e4d-97200827dc48', amount: '1004', mallReserved: '', authToken: 'NICEUNTT9FBBD87FD2393AFEE45A7DCA61C194AA', signature: '7cc95c592e2a12f0292e1a20d68dd9eb8132fd3c0af675b981a4c1c2ce63a93b' } ``` `authResultCode`가 `0000` 으로 응답된 경우 결제창을 통한 인증과정이 성공된 것을 의미합니다. 인증과정이 성공한 경우 `tid(거래key)값`을 승인(결제) API로 전달하여 💳 결제(승인)을 요청 할 수 있습니다. ``` -------------------------------- ### Example of Basic Authentication Header Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Shows how to set the generated credentials in the HTTP header for Basic authentication. ```bash Authorization: Basic YWYwZDExNjIzNmRmNDM3ZjgzMTQ4M2VlOWM1MDBiYzQ6NDMzYTg0MjFiZTc1NGIzNDk4OTA0OGNmMTQ4YTVmZmM= ``` -------------------------------- ### Example cURL Request for Transaction Inquiry Source: https://github.com/nicepayments/nicepay-manual/blob/main/api/status-transaction.md Use this cURL command to perform a GET request for transaction details. Ensure you replace the placeholder with your actual transaction ID and authorization credentials. ```bash curl -X GET 'https://api.nicepay.co.kr/v1/payments/nicuntct1m0101210727200125A056' -H 'Content-Type: application/json' -H 'Authorization: Basic YWYwZDExNjIzNmRmNDM3ZjgzMT...' ``` -------------------------------- ### Payment Gateway Response Example Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Example response from the payment gateway after successful card authentication. An authResultCode of '0000' indicates success. ```bash Accept: application/x-www-form-urlencoded { authResultCode: '0000', authResultMsg: '인증 성공', tid: 'UT0000113m01012110051656331001', clientId: '58e3b578555e45738d6b569e53d5ae54', orderId: 'b0980639-52db-4504-9e4d-97200827dc48', amount: '1004', mallReserved: '', authToken: 'NICEUNTT9FBBD87FD2393AFEE45A7DCA61C194AA', signature: '7cc95c592e2a12f0292e1a20d68dd9eb8132fd3c0af675b981a4c1c2ce63a93b' } ``` -------------------------------- ### JS SDK: Bearer Authentication Example Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/ToC.md Example of setting up Bearer Authentication for the JS SDK. This method uses an access token obtained separately. ```javascript NicePay.setGlobalConfig({ "merchantId": "your_merchant_id", "accessToken": "your_access_token" }); ``` -------------------------------- ### Access Token Request Example Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Example of an HTTP POST request to the /v1/access-token endpoint. Includes required headers for content type and authorization. ```http POST /v1/access-token HTTP/1.1 Host: api.nicepay.co.kr Authorization: Basic or Bearer Content-type: application/json;charset=utf-8 ``` -------------------------------- ### Access Token API Response Example Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Example response from the Access Token API, including the access token and its expiration. ```json { "resultCode": "0000", "resultMsg": "정상 처리되었습니다.", "accessToken": "6d0a7caa1b7358c8aa06ef3706e01bb1feb2c65dacc7147b258dfdd6191b5279", "tokenType": "Bearer", "expireAt": "2021-07-31T00:58:02.000+0900", "now": "2021-07-20T15:28:26.882+0900" } ``` -------------------------------- ### Payment (Approval) Response Example Source: https://github.com/nicepayments/nicepay-manual/blob/main/README.md This is an example of a JSON response received after a successful payment approval. Note that sandbox responses contain arbitrary values and are for testing purposes only. ```json { resultCode: '0000', resultMsg: '정상 처리되었습니다.', tid: 'UT0000113m01012111051714341073', cancelledTid: null, orderId: 'c74a5960-830b-4cd8-82a9-fa1ce739a18f', ediDate: '2021-11-05T17:14:35.150+0900', signature: '63b251b31c909eebef1a9f4fcc19e77bdcb8f64fc1066a29670f8627186865cd', status: 'paid', paidAt: '2021-11-05T17:14:35.000+0900', failedAt: '0', cancelledAt: '0', payMethod: 'card', amount: 1004, balanceAmt: 1004, goodsName: '나이스페이-상품', mallReserved: null, useEscrow: false, currency: 'KRW', channel: 'pc', approveNo: '000000', buyerName: null, buyerTel: null, buyerEmail: null, receiptUrl: 'https://npg.nicepay.co.kr/issue/IssueLoader.do?type=0&innerWin=Y&TID=UT0000113m01012111051714341073', mallUserId: null, issuedCashReceipt: false, coupon: null, card: { // 샌드박스 응답결과는 모두 임의값입니다. resultCode가 0000 이면 응답 TEST 성공입니다. cardCode: '04', cardName: '삼성', // (샌드박스) 응답 결과는 삼성카드로 고정 cardNum: '123412******1234', cardQuota: 0, isInterestFree: false, cardType: 'credit', canPartCancel: true, acquCardCode: '04', acquCardName: '삼성' }, vbank: null, cancels: null, cashReceipts: null } ``` -------------------------------- ### Node.js Express Webhook Receiver Example Source: https://context7.com/nicepayments/nicepay-manual/llms.txt This example demonstrates how to set up a webhook endpoint using Node.js and Express to receive and process payment events from NicePay. It includes crucial signature verification to prevent tampering and handles different payment statuses like 'paid' and 'cancelled'. Remember to respond with 'OK' in 'text/html' format to acknowledge receipt. ```javascript const express = require('express'); const crypto = require('crypto'); const app = express(); app.use(express.json()); app.post('/webhook', (req, res) => { const { tid, amount, ediDate, signature, status, payMethod } = req.body; const secretKey = process.env.NICEPAY_SECRET_KEY; // 위변조 검증: hex(sha256(tid + amount + ediDate + secretKey)) const expectedSig = crypto .createHash('sha256') .update(tid + amount + ediDate + secretKey) .digest('hex'); if (expectedSig !== signature) { console.error('위변조 감지! 처리 중단'); return res.status(400).send('FAIL'); } // 결제 상태별 비즈니스 로직 처리 if (status === 'paid') { // 주문 완료 처리 console.log(`결제완료 - TID: ${tid}, 금액: ${amount}원, 수단: ${payMethod}`); } else if (status === 'cancelled') { // 취소 처리 console.log(`결제취소 - TID: ${tid}`); } // 나이스페이에 정상 수신 응답 (반드시 text/html + "OK") res.setHeader('Content-Type', 'text/html'); res.send('OK'); }); // 웹훅 발송 인바운드 허용 IP: 121.133.126.86, 121.133.126.87 ``` -------------------------------- ### Example of Credentials Generation Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Illustrates the process of creating credentials by combining client and secret keys and encoding them. ```bash clientKey = 'af0d116236df437f831483ee9c500bc4' secretKey = '433a8421be754b34989048cf148a5ffc' >> `af0d116236df437f831483ee9c500bc4:433a8421be754b34989048cf148a5ffc` ``` ```bash // Base64('{clientId}:{secretKey}') Base64('af0d116236df437f831483ee9c500bc4:433a8421be754b34989048cf148a5ffc') >> `YWYwZDExNjIzNmRmNDM3ZjgzMTQ4M2VlOWM1MDBiYzQ6NDMzYTg0MjFiZTc1NGIzNDk4OTA0OGNmMTQ4YTVmZmM=` ``` -------------------------------- ### GET /v1/card/interest-free Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Retrieves information about interest-free installment plans for card payments. This endpoint allows querying for both authenticated and unauthenticated transactions. ```APIDOC ## GET /v1/card/interest-free ### Description Retrieves information about interest-free installment plans for card payments. This endpoint allows querying for both authenticated and unauthenticated transactions. ### Method GET ### Endpoint /v1/card/interest-free ### Parameters #### Query Parameters - **useAuth** (Boolean) - Required - Indicates whether the transaction is authenticated (true) or unauthenticated (false). - **ediDate** (String) - Required - The date and time the transaction was created, in ISO 8601 format. - **mid** (String) - Optional - The merchant ID. If provided, it is prioritized and verified against the client ID. - **signData** (String) - Optional - Data for verifying integrity. Generated by hex(sha256(ediDate + SecretKey)). The SecretKey can be found in the merchant administration. - **returnCharSet** (String) - Optional - The encoding format for the response parameters. Examples: utf-8 (Default), euc-kr. ### Response #### Success Response (200) - **resultCode** (String) - Result code. '0000' for success, others for failure. - **resultMsg** (String) - Result message. - **ediDate** (String) - The date and time the response was generated, in ISO 8601 format. - **signature** (String) - Data for verifying integrity. Generated by hex(sha256(ediDate + SecretKey)). Provided only for valid transactions. It is recommended to compare this data at the merchant level for validation. The SecretKey can be found in the merchant administration. #### 무이자 할부정보 (Array) - **interestFree** (Array) - An array containing all provided interest-free installment information. This includes both default NICEPAY and merchant-specific interest-free plans. One interest-free object is returned per card code. - **cardCode** (String) - Required - The card company code. - **cardName** (String) - Required - The name of the card company (e.g., BC). - **freeInstallment** (Array) - Required - Detailed information about the interest-free installment. - **minAmt** (Int) - Required - The minimum amount for the event to apply (e.g., 50000). - **maxAmt** (Int) - Required - The maximum amount for the event to apply (e.g., 99999999999999). - **installment** (String) - Required - The interest-free installment months, listed as a colon-separated string (e.g., '02:03:04:05' indicating 2, 3, 4, and 5 months interest-free). - **eventToDate** (String) - Required - The expiration date of the event, in ISO 8601 format. ### Request Example ``` GET /v1/card/interest-free?useAuth=false&ediDate=2023-10-27T10:00:00+09:00 Host: api.nicepay.co.kr Authorization: Basic or Bearer Content-type: application/json;charset=utf-8 ``` ### Response Example ```json { "resultCode": "0000", "resultMsg": "Success", "ediDate": "2023-10-27T10:05:00+09:00", "signature": "a1b2c3d4e5f6...", "interestFree": [ { "cardCode": "04", "cardName": "BC", "freeInstallment": [ { "minAmt": 50000, "maxAmt": 99999999999999, "installment": "02:03:04:05", "eventToDate": "2024-12-31T23:59:59+09:00" } ] } ] } ``` ``` -------------------------------- ### Initialize and Load WebView for Payment Source: https://github.com/nicepayments/nicepay-manual/blob/main/api/app-ios.md Sets up a WKWebView and loads a payment request URL. Ensure PAY_URL is defined elsewhere. ```swift override func viewDidLoad() { super.viewDidLoad() title = "구매하기 TEST" webView = WKWebView(frame: self.view.frame) webView?.navigationDelegate = self webView?.uiDelegate = self self.view.addSubview(webView!) let url = URL(string: PAY_URL) let request = URLRequest(url: url!) webView?.load(request) } ``` -------------------------------- ### Card Interest-Free Inquiry Sample Code Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/ToC.md Example code for inquiring about card interest-free installments. Use this to check available interest-free options for card payments. ```javascript function fn_card_interest_free_inquiry(form) { // 카드 무이자 조회 요청 // form : 조회 조건이 담긴 form 객체 // 예시: Nicepay.request(form, 'cardinterestfree', 'inquiry'); console.log('카드 무이자 조회 요청'); } ``` -------------------------------- ### Initialize NicePay JS SDK and Request Payment Source: https://github.com/nicepayments/nicepay-manual/blob/main/README.md Include the NicePay JS SDK and use the `AUTHNICE.requestPay()` method to initiate a payment. Ensure your `clientId` is from a test merchant and `returnUrl` points to your API endpoint for handling responses. Errors during the payment process are handled by the `fnError` callback. ```javascript ``` -------------------------------- ### GET Request for Interest-Free Card Information Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Use this endpoint to retrieve information about available interest-free installment plans for card payments. Ensure correct authentication and date formatting. ```bash GET /v1/card/interest-free?useAuth=false&ediDate={..} HTTP/1.1 Host: api.nicepay.co.kr Authorization: Basic or Bearer Content-type: application/json;charset=utf-8 ``` -------------------------------- ### Initiate Payment with JS SDK (Server Approval) Source: https://context7.com/nicepayments/nicepay-manual/llms.txt Use the `AUTHNICE.requestPay()` function to launch the payment window. In the Server Approval model, after card authentication, `authResultCode` and `tid` are sent to the `returnUrl`. Your server must then call a separate approval API to finalize the payment. ```html ``` -------------------------------- ### Initialize Payment JS SDK for Sandbox Source: https://github.com/nicepayments/nicepay-manual/blob/main/common/test.md Include the Nicepay JS SDK from the sandbox domain. Use your test merchant's client ID. Remember to switch to the production domain after testing. ```html ``` -------------------------------- ### JS SDK Initialization (Server & Client Approval) Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Include the JS SDK and initialize payment request. The clientId determines the approval model (Server or Client). For Client approval, post-payment amount verification is mandatory. ```html ``` -------------------------------- ### Get Card Event Inquiry API Example Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md This endpoint retrieves card issuer event information based on a specified amount. It helps in providing users with details for card selection, such as interest-free periods. Note that interest-free options may not be provided for amounts under 50,000 KRW. ```bash curl -X GET 'https://api.nicepay.co.kr/v1/card/event?amount={금액}&useAuth=false&ediDate={ISO 8601 형식}&...' -H 'Content-Type: application/json' -H 'Authorization: Basic YWYwZDExNjIzNmRmNDM3ZjgzMT...' ``` -------------------------------- ### Example of Bearer Token Generation using curl Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Demonstrates how to call the Access Token API using curl with Basic authentication. ```shell curl -X POST "https://api.nicepay.co.kr/v1/access-token" \ -H "Content-Type: application/json" \ -H "Authorization: Basic YWYwZDExNjIzNmRm..." ``` -------------------------------- ### Interest-Free Installment Information Structure Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md This section details the structure for interest-free installment information, which is an array of objects. Each object contains card details and available free installment periods. ```json { "interestFree": [ { "cardCode": "String", "cardName": "String", "freeInstallment": "String" } ] } ``` -------------------------------- ### Sandbox Environment Configuration Source: https://context7.com/nicepayments/nicepay-manual/llms.txt This section provides configuration details for using the NicePay sandbox environment for testing. It includes the sandbox API and JS SDK domains, firewall IP addresses for both sandbox and production, and recommended timeout settings. A sample sandbox `clientId` is also provided. ```text # 샌드박스 도메인 (테스트용) # JS SDK: https://sandbox-pay.nicepay.co.kr/v1/js/ # API: https://sandbox-api.nicepay.co.kr # 운영 도메인 (실서비스용) # JS SDK: https://pay.nicepay.co.kr/v1/js/ # API: https://api.nicepay.co.kr # 방화벽 아웃바운드 허용 IP # 결제창 SDK (운영): 121.133.126.85/27 # API (운영): 121.133.126.83/27 # API (샌드박스): 121.133.126.84/27 # 타임아웃 설정 권장값 # Connection timeout: 5초 # Read(Receive) timeout: 30초 # ※ Read-timeout 발생 시 망취소 API 반드시 호출 필요 # 샌드박스 테스트 clientId 예시 clientId: 'S2_af4543a0be4d49a98122e01ec2059a56' ``` -------------------------------- ### 결제창 Server 승인 모델 JS SDK Source: https://github.com/nicepayments/nicepay-manual/blob/main/api/payment-window-server.md JS SDK를 사용하여 결제창을 노출하고 결제를 요청합니다. clientId 필드에 클라이언트 키를 설정해야 합니다. 결제 결과는 returnUrl로 전달된 end-point로 POST됩니다. ```html //Client 승인 ``` -------------------------------- ### Android Kotlin WebView Basic Setup and JavaScript Enable Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Initialize a WebViewActivity, set its client, and enable JavaScript execution by setting `settings.javaScriptEnabled` to true. ```kotlin class WebViewActivity : AppCompatActivity() { companion object { const val MERCHANT_URL = "https://web.nicepay.co.kr/demo/v3/mobileReq.jsp" } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_webview) webview.webViewClient = WebViewClientClass() val settings = webview.settings settings.javaScriptEnabled = true } } ``` -------------------------------- ### Initialize NicePay Payment (Server Auth) Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Include the NicePay JavaScript SDK and call the requestPay method with your client details to initiate a payment. The payment result is posted to the returnUrl. ```html ``` -------------------------------- ### Example of Bearer Token Header Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/README.md Shows how to set the obtained access token in the HTTP header for Bearer authentication. ```bash Authorization: Bearer 6d0a7caa1b7358c8aa06ef3706e01bb1feb2c65dacc7147b258dfdd6191b5279 ``` -------------------------------- ### Billing: AES-256 Encryption Example for encData Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/ToC.md Example of encrypting data using AES-256 for the 'encData' field, commonly used in billing requests. ```javascript const plainText = "your_plain_text_data"; const key = "your_256_bit_key"; // 32 bytes const iv = "your_iv_vector"; // 16 bytes const encryptedData = NicePay.encryptAES256(plainText, key, iv); console.log(encryptedData); ``` -------------------------------- ### 빌키 발급 API 요청 Source: https://github.com/nicepayments/nicepay-manual/wiki/subscribe-integration 정기결제 서비스를 위한 빌키 발급 API 요청 예시입니다. encData는 결제 정보를 암호화한 데이터이며, orderId는 가맹점의 고유 거래 번호입니다. encMode는 암호화 방식을 지정합니다. ```bash curl -X POST 'https://api.nicepay.co.kr/v1/subscribe/regist' \ -H 'Content-Type: application/json' \ -H 'Authorization: Basic ZWVjOGQzNTA4Y2IwNDI1ZGI5NTViMzBiZjM5...' \ -D '{ \ "encData":"{암호화된 결제정보 데이터}" # (2) 결제정보 암호화 AES128 or AES256 , "orderId":"{상점 거래 고유번호}" # (3) 결제 요청이 중복으로 발생하지 않도록 가맹점에서 생성하는 유니크한 ID , "encMode":"{null or A2}" # null: AES128, A2: AES256 # (4) 암호화 모드 (null: AES128, A2: AES256) }' ``` -------------------------------- ### Billing: AES-128 Encryption Example for encData Source: https://github.com/nicepayments/nicepay-manual/blob/main/migration/ToC.md Example of encrypting data using AES-128 for the 'encData' field, commonly used in billing requests. ```javascript const plainText = "your_plain_text_data"; const key = "your_128_bit_key"; // 16 bytes const iv = "your_iv_vector"; // 16 bytes const encryptedData = NicePay.encryptAES128(plainText, key, iv); console.log(encryptedData); ``` -------------------------------- ### Samsung Card Payment Request Example Source: https://github.com/nicepayments/nicepay-manual/blob/main/api/payment-epay.md Example of a payment authorization request for Samsung Card. This includes CAVV, XID, and ECI values. ```text authFlag=0 cardNo=5310123412341234 track2Data=375310123412341234=0000 cardExpire=0000 CAVV=AAABCGkWZSAhBwIIGRZlBSAAAAA= XID=MjAyMTA3MDIwNzEyNTQ2MzE5OTg= ECI=05 ``` -------------------------------- ### Sample Code Links Source: https://github.com/nicepayments/nicepay-manual/blob/main/README.md Access sample code for various programming languages by clicking the respective icons. These links direct to GitHub repositories. ```html ```