Get started
PCRM supports not only games but also various businesses with complex structures with blockchain to create an efficient and future-oriented business environment and provides an integrated service ecosystem of WEB 3.0.
PCRM consists of a framework that has been developed and operated on its own to respond to the limitations of blockchain functions, security issues, high development difficulty, and management inefficiency, and provides convenient service through flexible message management and various interfaces. You can get it.
MMaximizes management efficiency through functions such as monitoring, statistics, and reports for PCRM internal and external linkage, service management, and PiE (Profit in Everything) service.
1. PCRM X-To-Earn Interface APIs
API is classified into Sync type and Async type in consideration of performance. Affiliates apply functions corresponding to each API and support various development languages such as JSON, C/C++, and JAVA.
- Affiliation/Interworking Testing and Development Inquiries : testingplanner@gmail.com
API | REQUEST | RESPONSE | FUNCTION | NOTE |
---|---|---|---|---|
Exchange Rate Inquiry | Partners | PCRM |
Item/Point/etc to PlayToken Exchange Rate Inquiry PlayToken to Item/Point/etc Exchange Rate Inquiry (Partner's various benefits to users, etc.) |
|
Exchange | Partners | PCRM |
Item/Point/etc to PlayToken Exchange PlayToken to Item/Point/etc Exchange |
Async |
Passport | Partners | PCRM |
Certification services for execution of key APIs - Exchange API - Withdrawal Address API - Withdrawal |
|
Withdrawal Address | Partners | PCRM | Verification and registration of externally available addresses held by users of the Partners (withdrawal address) | |
Withdrawal pre-trade | Partners | PCRM | Withdrawal preliminary transactions | |
Withdraw | Partners | PCRM | Withdraw withdrawable tokens(PlayToken) to an external address | Async |
Block Notify | PCRM | Partners | Exchange API, Blockchain processing result of Withdrawal API sent (Confirm completed or not) | Async |
- All APIs are operated based on HTTPS (SSL, TLS 1.2 or higher). Be sure to link with HTTPS.
- The channel number and sub-channel number are provided separately.
- Encryption/decryption related information of the encryption target field is provided separately.
- A signature function for API validation is provided separately.
1.1. Exchange Rate Inquiry (Partners → PCRM)
The Exchange Rate Inquiry API provides exchange rate information(Item/Point/etc to PlayToken, PlayToken to Item/Point/etc). Exchange rate information must be applied to the Exchange API through this API.
The exchange rate, which is the result of the Exchange Rate Inquiry API, needs to be registered as a separate ADMIN transaction. If the exchange rate information is not registered in advance, an error is returned.
To get characters you need to make a POST call to the following url :
https://PCRM.verseb.com/api/ExchangeRate.json
Exchange Rate Inquiry UI Wireframe
Exchange Rate Inquiry Sequence
### Request Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"fromCurrency" : "GOLD",
"toCurrency" : "SLAYB",
"fromAmount" : "100",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Exchange Rate Inquiry Request Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
fromCurrency | Y | 10 | Request unit | Conversion request currency code (Item, Token, etc.) |
toCurrency | Y | 10 | Conversion unit | Conversion target currency code (Item, Token, etc.) |
fromAmount | Y | 20 | Request Quantity | Item, Point, Token quantity (Error returned when requested below the minimum unit specified by the exchange rate registration administrator) |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Application Guide") |
### SUCCESS Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"fromCurrency" : "GOLD",
"toCurrency" : "SLAYB",
"fromAmount" : "100",
"toAmount" : "1",
"exchangeRate" : "10%",
"status" : "SUCCESS",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Exchange Rate Inquiry Response Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
fromCurrency | Y | 10 | Request unit | Conversion request currency code (Item, Token, etc.) |
toCurrency | Y | 10 | Conversion unit | Conversion target currency code (Item, Token, etc.) |
fromAmount | Y | 20 | Request Quantity | Item, Point, Token quantity (Error returned when requested below the minimum unit specified by the exchange rate registration administrator) |
toAmount | N | 20 | Conversion Quantity | Conversion quantity = Requested quantity * Exchange rate |
exchangeRate | N | 20 | Exchange Rate | Exchange rate information for request unit and conversion unit |
status | Y | 10 | Result | Success (SUCCSS), Failure (DECLINED) |
errorInformation.errCd | N | 8 | Error code | NULL for Success, Code for Error |
errorInformation.reasonn | N | 192 | Error message | Corresponding error message when an error occurs |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Application Guide") |
### DECLINED Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"fromCurrency" : "GOLD",
"toCurrency" : "SLAYB",
"fromAmount" : "99",
"toAmount" : "",
"exchangeRate" : "",
"status" : "DECLINED",
"errorInformation.errCd" : "7007",
"errorInformation.reason" : "Insufficient minimum amount",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Exchange Rate Inquiry Errors
Detailed error codes are provided separately
1.2. Exchange (Partners → PCRM)
Converts the request unit (item, point, token, etc.) held by the user of the partners into a transition unit. Exchange requests require the application of exchange rate information
The Exchange API is Async. The processing result of the blockchain is finally delivered through Block Notify API. Exchange is not complete until PCRM provides a response through the Block Notify API.
A user-specific key is essential to manage the user's assets even if changes occur due to the loss or damage of the user's device (mobile, PC, etc.).
To get characters you need to make a POST call to the following url :
https://PCRM.verseb.com/api/ExchangeRequest.json
Exchange UI Wireframe
Exchange Sequence
### Request Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"fromCurrency" : "GOLD",
"toCurrency" : "SLAYB",
"fromAmount" : "100",
"outPassword" : "f3a0ea7f63724bbd18194bf3a77974df0c8be6a58264ec2df860ad636b31fac6",
"Papers" : "77974df0c8be6a58264ec2df860af3a0ea7f63724bbd18194bf3ad636b31fac6",
"notifyUrl" : "https://Partners_URL/API/backNotify"
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Exchange Request Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
customerId | Y | 64 | User ID | The only user-specific ID (KEY) in the entire ecosystem. Even if a change occurs due to the loss or damage of a user's device (mobile, PC, etc.), a user's unique key is essential to manage the user's assets. |
fromCurrency | Y | 10 | Request unit | Conversion request currency code (Item, Token, etc.) |
toCurrency | Y | 10 | Conversion unit | Conversion target currency code (Item, Token, etc.) |
fromAmount | Y | 20 | Request Quantity | Item, Point, Token quantity (Error returned when requested below the minimum unit specified by the exchange rate registration administrator) |
exchangeRate | N | 20 | Exchange Rate | Use Exchange rate received by Exchange Rate Inquiry API |
outPassword | Y | 192 | Password (encryption) | Password (encryption applied transmission, see "2. Security Application Guide") |
Papers | Y | 192 | Transaction verification key | Transaction verification KEY received after Passport API call |
notifyUrl | N | 128 | Processing result receiving URL | URL to receive asynchronous processing results (requires development to receive and process blockchain processing results from the channel side) |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Application Guide") |
### SUCCESS Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"fromCurrency" : "GOLD",
"toCurrency" : "SLAYB",
"fromAmount" : "100",
"toAmount" : "1",
"exchangeRate" : "10%",
"internalAddress" : "0xb440a6cdfbfe4870fc06385d0533476344bdc557",
"txId" : "0x7104afd5b61c5df952c8e9afd2dafa222d543111b2ee3862c80502b3f2aed93b ",
"status" : "SUCCESS",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Exchange Response Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
customerId | Y | 64 | User ID | The only user-specific ID (KEY) in the entire ecosystem. |
fromCurrency | Y | 10 | Request unit | Conversion request currency code (Item, Token, etc.) |
toCurrency | Y | 10 | Conversion unit | Conversion target currency code (Item, Token, etc.) |
fromAmount | Y | 20 | Request Quantity | Item, Point, Token quantity (Error returned when requested below the minimum unit specified by the exchange rate registration administrator) |
toAmount | N | 20 | Conversion Quantity | Conversion quantity = Requested quantity * Exchange rate |
exchangeRate | N | 20 | Exchange Rate | Use Exchange rate received by Exchange Rate Inquiry API |
internalAddress | N | 128 | Internal Address | PlayToken(Internal Token) Address |
txId | N | 128 | TXID | Blockchain Transaction ID |
status | Y | 10 | Result | Success (SUCCSS), Failure (DECLINED) |
errorInformation.errCd | N | 8 | Error code | NULL for Success, Code for Error |
errorInformation.reasonn | N | 192 | Error message | Corresponding error message when an error occurs |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Application Guide") |
### DECLINED Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"fromCurrency" : "GOLD",
"toCurrency" : "SLAYB",
"fromAmount" : "99",
"toAmount" : "",
"exchangeRate" : "13%",
"internalAddress" : "0xb440a6cdfbfe4870fc06385d0533476344bdc557",
"customerId" : "userid@usermail.url",
"txId" : "",
"status" : "DECLINED",
"errorInformation.errCd" : "7010",
"errorInformation.reason" : "Amount verification error",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Exchange Errors
Detailed error codes are provided separately
1.3. Passport (Partners → PCRM)
Major services such as registration, change, conversion, and withdrawal through Exchange API, Passport API (password change), Withdrawal Address API, API, and Withdrawal API must be executed after Passport API is authenticated.
Various methods such as FIDO, pattern, and 2FACT can be applied to the authentication method after consultation with the partner company.
To get characters you need to make a POST call to the following url :
https://PCRM.verseb.com/api/PasswordRegistration.json
Passport(Password Registration) UI Wireframe
Passport(Password Registration) Sequence
Passport(Password Change) UI Wireframe
Passport(Password Change) Sequence
### Request Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"outPassword" : "f3a0ea7f63724bbd18194bf3a77974df0c8be6a58264ec2df860ad636b31fac6",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Passport Required Option (PassportOption)
KEY | Register Request |
Register Response |
Certify Request |
Certify Response |
Change Request |
Change Response |
---|---|---|---|---|---|---|
outPassword | N | - | Y | - | Y | - |
newPassword | Y | - | N | - | Y | - |
Papers | N | Y | N | Y | Y | Y |
Passport Request Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
customerId | Y | 64 | User ID | The only user-specific ID (KEY) in the entire ecosystem. |
PassportOption | Y | 32 | Password Option | Password processing option (Register: At initial registration, Certify: At password verification, Change: When password is changed) |
outPassword | Y | 192 | Password (encryption) | When registering or changing a password for the first time (encryption applied transmission, see "2. Security Application Guide") |
newPassword | Y | 192 | New password (encryption) | When registering or changing a password for the first time (encryption applied transmission, see "2. Security Application Guide") |
Papers | Y | 192 | Transaction verification key | Papers received after Passport API authentication |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Application Guide") |
### SUCCESS Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"Papers" : "77974df0c8be6a58264ec2df860af3a0ea7f63724bbd18194bf3ad636b31fac6",
"status" : "SUCCESS",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Passport Response Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
customerId | Y | 64 | User ID | The only user-specific ID (KEY) in the entire ecosystem. |
Papers | Y | 192 | Transaction verification key | Used by Exchange API, Withdrawal API, Passport API. The authentication expires 5 minutes after the Papers are created |
status | Y | 10 | Result | Success (SUCCSS), Failure (DECLINED) |
errorInformation.errCd | N | 8 | Error code | NULL for Success, Code for Error |
errorInformation.reasonn | N | 192 | Error message | Corresponding error message when an error occurs |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Application Guide") |
### DECLINED Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"status" : "DECLINED",
"errorInformation.errCd" : "B010",
"errorInformation.reason" : "User Unique ID Error",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Passport Errors
Detailed error codes are provided separately
1.4. Withdrawal Address (Partners → PCRM)
Performs verification and registration of the external address (available on exchanges, etc.) so that the PlayToken held by the user of the partner company can be used externally. The user is responsible for the loss caused by the user's failure to enter the external address correctly.
Currently, only Ethereum-based blockchain is supported, but it can be expanded to various blockchain models depending on partner companies and business partnership models.
To get characters you need to make a POST call to the following url :
https://PCRM.verseb.com/api/WithdrawalAddressVerification.json
Withdrawal Address(Registration) UI Wireframe
Withdrawal Address(Registration) Sequence
Withdrawal Address(Change) UI Wireframe
Withdrawal Address(Change) Sequence
### Request Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"outPassword" : "f3a0ea7f63724bbd18194bf3a77974df0c8be6a58264ec2df860ad636b31fac6",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Withdrawal Address Request Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
customerId | Y | 64 | User ID | The only user-specific ID (KEY) in the entire ecosystem. |
outAddress | Y | 128 | Withdrawal Address | The public blockchain address of the channel user available on the exchange, etc. |
outPassword | Y | 192 | Password (encryption) | Password (encryption applied transmission, see "2. Security Application Guide") |
Papers | Y | 192 | Transaction verification key | Papers received after Passport API authentication |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Application Guide")) |
### SUCCESS Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"outAddress" : "0xcce4726a8bca553e31c5341fa456a43062b46520",
"status" : "SUCCESS",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Withdrawal Address Response Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
customerId | Y | 64 | User ID | The only user-specific ID (KEY) in the entire ecosystem. |
status | Y | 10 | Result | Success (SUCCSS), Failure (DECLINED) |
errorInformation.errCd | N | 8 | Error code | NULL for Success, Code for Error |
errorInformation.reasonn | N | 192 | Error message | Corresponding error message when an error occurs |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Application Guide") |
### DECLINED Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"outAddress" : "0xb440a6cdfbfe4870fc06385d0533476344bdc557",
"status" : "DECLINED",
"errorInformation.errCd" : "B100",
"errorInformation.reason" : "Wallet address is not valid",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Withdrawal Address Errors
Detailed error codes are provided separately
1.5. Withdrawal pre-trade (Partners → PCRM)
The Withdrawal pre-trade API must be run before invoking the Withdrawal API. Key data among the results of the Withdrawal pre-trade API should be reflected in the Withdrawal API.
To get characters you need to make a POST call to the following url :
https://PCRM.verseb.com/api/Reqpretrade.json
Withdrawal pre-trade UI Wireframe
Withdrawal pre-trade Sequence
### Request Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"outPassword" : "f3a0ea7f63724bbd18194bf3a77974df0c8be6a58264ec2df860ad636b31fac6",
"fromCurrency" : "SLAYB",
"toCurrency" : "VEGO",
"fromAmount" : "1",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Withdrawal pre-trade Request Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
customerId | Y | 64 | User ID | The only user-specific ID (KEY) in the entire ecosystem. |
fromCurrency | Y | 10 | Request unit | Conversion request token code |
toCurrency | Y | 10 | Conversion unit | Conversion target token code |
fromAmount | Y | 20 | Request Quantity | Token quantity |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Application Guide") |
### SUCCESS Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"outAddress" : "0xcce4726a8bca553e31c5341fa456a43062b46520",
"fromCurrency" : "SLAYB",
"toCurrency" : "VEGO",
"fromAmount" : "1",
"withdrawalRate" : "100%",
"toAmount" : "1",
"withdrawalFee" : "0",
"withdrawalAmount" : "1",
"ReserveWID" : "d18194bf3a77974df0c8be6a58264ec2df860ad636b31fac6f3a0ea7f63724bb",
"pinNumber" : "880154",
"status" : "SUCCESS",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Withdrawal pre-trade Response Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
customerId | Y | 64 | User ID | The only user-specific ID (KEY) in the entire ecosystem. |
fromCurrency | Y | 10 | Request unit | Conversion request token code |
toCurrency | Y | 10 | Conversion unit | Conversion target token code |
fromAmount | Y | 20 | Request Quantity | Token quantity |
withdrawalRate | N | 20 | Withdrawal Rate | Withdrawal Rate |
toAmount | N | 20 | Conversion Quantity | Conversion quantity = Requested quantity * Withdrawal rate |
withdrawalFee | N | 20 | Withdrawal Fee | Withdrawal Fee |
withdrawalAmount | N | 20 | Withdrawal Quantity | Withdrawal quantity = Conversion quantity * Withdrawal Fee |
ReserveWID | N | 192 | Withdrawal Reserve WID | Transaction verification WID for performing withdrawal transactions |
pinNumber | N | 6 | Withdrawal Pin Number | Pin Number used in the Withdrawal main transaction |
status | Y | 10 | Result | Success (SUCCSS), Failure (DECLINED) |
errorInformation.errCd | N | 8 | Error code | NULL for Success, Code for Error |
errorInformation.reasonn | N | 192 | Error message | Corresponding error message when an error occurs |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Application Guide") |
### DECLINED Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"outAddress" : "0xcce4726a8bca553e31c5341fa456a43062b46520",
"fromCurrency" : "SLAYB",
"toCurrency" : "VEGO",
"fromAmount" : "1",
"status" : "DECLINED",
"errorInformation.errCd" : "B011",
"errorInformation.reason" : "Password validation error",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Withdrawal pre-trade Errors
Detailed error codes are provided separately
1.6. Withdrawal (Partners → PCRM)
Withdrawal is a function of transferring PlayToken to an external address. PlayToken, which has been sent to an external address, can be used freely in various fields such as exchanges.
The Withdrawal API is asynchronous. The processing result of the blockchain is finally delivered through the Block Notify API. Partner must not complete withdrawal results until non-synchronously provided response results are received. ※ The withdrawal is made only to the registered withdrawal address, and the withdrawal problem due to a mistake in the withdrawal address lies with the user who registered the withdrawal address.
To get characters you need to make a POST call to the following url :
https://PCRM.verseb.com/api/Withdrawal.json
Withdrawal UI Wireframe
Withdrawal Sequence
### Request Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"outAddress" : "0xcce4726a8bca553e31c5341fa456a43062b46520",
"fromCurrency" : "SLAYB",
"toCurrency" : "VEGO",
"fromAmount" : "1",
"withdrawalRate" : "100%",
"toAmount" : "1",
"withdrawalFee" : "0",
"withdrawalAmount" : "1",
"ReserveWID" : "d18194bf3a77974df0c8be6a58264ec2df860ad636b31fac6f3a0ea7f63724bb",
"pinNumber" : "880154",
"Papers" : "77974df0c8be6a58264ec2df860af3a0ea7f63724bbd18194bf3ad636b31fac6",
"notifyUrl" : "https://Partners_URL/API/backNotify"
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Withdrawal Request Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
customerId | Y | 64 | User ID | The only user-specific ID (KEY) in the entire ecosystem. |
outAddress | Y | 128 | Withdrawal Address | The public blockchain address of the channel user available on the exchange, etc. |
fromCurrency | Y | 10 | Request unit | fromCurrency value received from Withdrawal pre-trade API |
toCurrency | Y | 10 | Conversion unit | toCurrency value received from Withdrawal pre-trade API |
fromAmount | Y | 20 | Request Quantity | fromAmount value received from Withdrawal pre-trade API |
withdrawalRate | N | 20 | Withdrawal Rate | withdrawalRate value received from Withdrawal pre-trade API |
toAmount | N | 20 | Conversion Quantity | toAmount value received from Withdrawal pre-trade API |
withdrawalFee | N | 20 | Withdrawal Fee | withdrawalFee value received from Withdrawal pre-trade API |
withdrawalAmount | N | 20 | Withdrawal Quantity | withdrawalAmount value received from Withdrawal pre-trade API |
ReserveWID | N | 192 | Withdrawal Reserve WID | ReservePin value received from Withdrawal pre-trade API |
pinNumber | N | 6 | Withdrawal Pin Number | pinNumber value received from Withdrawal pre-trade API |
outPassword | Y | 192 | Password (encryption) | Password (encryption applied transmission, see "2. Security Application Guide") |
Papers | Y | 192 | Transaction verification key | Transaction verification KEY received after Passport API call |
notifyUrl | Y | 128 | Processing result receiving URL | URL to receive asynchronous processing results (requires development to receive and process blockchain processing results from the channel side) |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Application Guide") |
### SUCCESS Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"outAddress" : "0xcce4726a8bca553e31c5341fa456a43062b46520",
"fromCurrency" : "SLAYB",
"toCurrency" : "VEGO",
"fromAmount" : "1",
"withdrawalRate" : "100%",
"toAmount" : "1",
"withdrawalFee" : "0",
"withdrawalAmount" : "1",
"txId" : "0x7104afd5b61c5df952c8e9afd2dafa222d543111b2ee3862c80502b3f2aed93b ",
"status" : "SUCCESS",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Withdrawal Response Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
customerId | Y | 64 | User ID | The only user-specific ID (KEY) in the entire ecosystem. |
fromCurrency | Y | 10 | Request unit | Conversion request token code |
toCurrency | Y | 10 | Conversion unit | Conversion target token code |
fromAmount | Y | 20 | Request Quantity | Token quantity |
withdrawalRate | N | 20 | Withdrawal Rate | Withdrawal Rate |
toAmount | N | 20 | Conversion Quantity | Conversion quantity = Requested quantity * Withdrawal rate |
withdrawalFee | N | 20 | Withdrawal Fee | Withdrawal Fee |
withdrawalAmount | N | 20 | Withdrawal Quantity | Withdrawal quantity = Conversion quantity * Withdrawal Fee |
txId | N | 128 | TXID | Blockchain Transaction ID |
status | Y | 10 | Result | Success (SUCCSS), Failure (DECLINED) |
errorInformation.errCd | N | 8 | Error code | NULL for Success, Code for Error |
errorInformation.reasonn | N | 192 | Error message | Corresponding error message when an error occurs |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Application Guide") |
### DECLINED Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"outAddress" : "0xcce4726a8bca553e31c5341fa456a43062b46520",
"fromCurrency" : "SLAYB",
"toCurrency" : "VEGO",
"fromAmount" : "1",
"toAmount" : "",
"exchangeRate" : "",
"txId" : "",
"status" : "DECLINED",
"errorInformation.errCd" : "B011",
"errorInformation.reason" : "비밀번호 검증 오류",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Withdrawal Errors
Detailed error codes are provided separately
1.7. Block Notify API (PCRM → Partners)
Block Notify API notifies transaction processing results (block confirmation or not) in an asynchronous manner, considering the efficiency of major transactions related to blockchain transactions such as Exchange API and Withdrawal API.
To get characters you need to make a POST call to the following url :
https://Partners_URL
Block Notify Sequence
### Request Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"netDivision" : "SLAY",
"customerId" : "userid@usermail.url",
"outAddress" : "0xcce4726a8bca553e31c5341fa456a43062b46520",
"txid" : "0x7104afd5b61c5df952c8e9afd2dafa222d543111b2ee3862c80502b3f2aed93b",
"status" : "confirm",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Block Notify Request Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
customerId | Y | 64 | User ID | The only user-specific ID (KEY) in the entire ecosystem |
netDivision | Y | 20 | Network Classification | Blockchain network classification |
outAddress | Y | 128 | Withdrawal Address | Internal address (Exchange API) or External address (Withdrawal API) |
toCurrency | Y | 20 | Conversion unit | Unit in case of conversion to partner's Item or Point with PlayToken |
toAmount | N | 20 | Request Quantity | Quantity in case of conversion to Partner's Item or Point with PlayToken |
txId | N | 128 | TXID | Blockchain Transaction ID |
status | Y | 32 | TXID status | Blockchain Transaction Status |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Enforcement Guide") |
### SUCCESS Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"status" : "SUCCESS",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}}
Block Notify Response Interface Layout
Field | RQD | Max Len |
Name | Description |
---|---|---|---|---|
merchantInformation.merchantId | Y | 50 | Channel number | Channel number allocated by PCRM |
merchantInformation.merchantSiteId | Y | 30 | Channel sub-number | Subchannel number assigned by PCRM |
clientReferenceInformation.code | Y | 20 | Transaction number | Transaction generated by channel only (ex) System ID or Server ID+yyyMMdd+hhmmss+miliscond) |
customerId | Y | 64 | User ID | The only user-specific ID (KEY) in the entire ecosystem. |
status | Y | 10 | Result | Success (SUCCSS), Failure (DECLINED) |
errorInformation.errCd | N | 8 | Error code | NULL for Success, Code for Error |
errorInformation.reasonn | N | 192 | Error message | Corresponding error message when an error occurs |
sign | Y | 64 | Signature verification value | Security Signatures (see "2. Security Application Guide") |
### DECLINED Response Example :
{
"merchantInformation.merchantId" : "000000000001",
"merchantInformation.merchantSiteId" : "000001",
"clientReferenceInformation.code" : "20220316192601000",
"customerId" : "userid@usermail.url",
"status" : "DECLINED",
"errorInformation.errCd" : "3",
"errorInformation.reason" : "GAS too low",
"sign" : "DEDC93DB5CFE0F06CBB54B937266D378C27E2DE985E999B7F319666857E6C9EE"
}
Block Notify Errors
Detailed error codes are provided separately
2. Security Application Guide
AES265 encryption method to protect key fields when sending and receiving messages and HMAC SHA256 signature method to prevent forgery of messages are applied.
If the development language is C/C++ rather than Java, separate OpenSSL API application is required. If you need a separate sample, please ask.
2.1. Field encryption/decryption
- Encrypt fields that require decryption, such as withdrawal address/password.
- After AES256 encryption, Base64Encoding is performed before transmission.
- AES256 encryption with CBC for operation mode and PKCS5Padding for padding.
- IV Key and encryption key are delivered separately for each channel.
- Based on Java, the encryption/decryption API source checks the body attachment.[Java_API.zip]
- When called in AES256Util.encryptAES256 (encryption target text, Key, Iv) format, an encrypted String is returned. (However, if there is a problem with the key, “” is returned.)
- Decryption: When called in AES256Util.decryptAES256 (decryption target text, Key, Iv) format, the decrypted String is returned. (However, if there is a problem with the key, “” is returned.)
### JAVA Encryption Example :
import com.cholocb.util.crypto.AES256Util;
String plainText = "1234567890"; // data to be encrypted
String sKey = "The encryption/decryption key are provided by PCRM."; // Key
String sIv = "The initial vector are provided by PCRM."; // Initial Vector
String encText = AES256Util.encryptAES256(plainText, sKey, sIv);
if ("".equals(encText)) {
// error handling
} else {
// normal progression
}
### JAVA Decryption Example :
import com.cholocb.util.crypto.AES256Util;
String encText = "TVIljHeNOsRs1tbzavru5g=="; // Data to be Decrypted
String sKey = "The encryption/decryption key are provided by PCRM."; // Key
String sIv = "The initial vector are provided by PCRM."; // Initial Vector
String plainText = AES256Util.decryptAES256(encText, sKey, sIv);
if ("".equals(plainText)) {
// DECLINED
} else {
// SUCCESS
}
Java AES256 Encryption Sample
- Add the commons-codec-1.9.jar file to the Java library so that the encryption/decryption function can be used by decompressing the compressed file in the "2.1 Field Encryption/Decryption" chapter of this document.
- For the above sample source test, copy the "AES256Util.java" and "Base64Util.java" sources of the compressed file to the sample source location.
- Write and test the above sample source
- Apply the exception handling after including the function in the sending/receiving function
2.2. Sign the message
- HMAC SHA256 signature is added to the entire JSON and transmitted.
- The key for signing uses the key used for field encryption and decryption.
(1) Converting to String after generating JSON without signature
(2) HmacSHA256 processing
(3) HEX conversion
(4) Add "sign" field at the end
- When called in the format HmacSha256Util.signFromJSONStr(JSONString, Key) to be signed, the signed String is returned. (However, if there is a problem with the key, a JSON String without a signature value is returned.)
- When called in the format of HmacSha256Util.signFromJSONStr(JSONString, Key) to be signed, the signature value is returned. (However, if there is a problem with the key, “” is returned.)
### JAVA Signature Example :
import com.cholocb.util.crypto.HmacSha256Util;
String sJson = "{\"merchantInformation.merchantId\" : \"000000000001\",
\"merchantInformation.merchantSiteId\" : \"000001\",
\"clientReferenceInformation.code\" : \"20220316192601000\",
\"fromCurrency\" : \"GOLD\",
\"toCurrency\" : \"SLAYB\",
\"fromAmount\" : \"100\"}";
String sKey = "The Signature key are provided by PCRM."; // Sign Key
String sSignJson= HmacSha256Util.signFromJSONStr(sJson, sKey);
if (sSignJson.indexOf("\"sign\"") < 0) {
// DECLINED
} else {
// SUCCESS (Add sign and generate key to JSON object)
}
Java Signature Sample
- Add the commons-codec-1.9.jar file to the Java library so that the encryption/decryption function can be used by decompressing the compressed file in the "2.1 Field Encryption/Decryption" chapter of this document.
- For the above sample source test, copy the "HmacSha256Util.java" and "HexUtil.java" sources of the compressed file to the sample source location.
- Write and test the above sample source
- After including the function in the sending/receiving function, add the sign key extracted from each sending/receiving function to the json object and handling exceptions
3. Erros
구분 | Code | Sub-Code | Occurrence | Message |
---|---|---|---|---|
intl. | 0000 | SUCCESS | ||
intl. | 0001 | The same transaction exists | ||
intl. | 7001 | It's a duplicate transaction | ||
intl. | 7002 | When the transaction number does not match | Transaction does not exist | |
intl. | 7005 | If it is not an Exchange target unit | It's an impossible unit | |
intl. | 7007 | Request Quantity Incorrect | Requested quantity is less than minimum unit | |
intl. | 7008 | Request Quantity Incorrect | Requested quantity exceeded | |
intl. | 7009 | Quantity Numeric error (including text, etc.) | Only numbers are allowed | |
intl. | 7010 | Calculation errors such as exchange rate/ratio | Quantity verification error occurred | |
intl. | 7011 | User SUSPEND status | User is disabled | |
intl. | 7012 | 내Internal address SUSPEND status | Internal address has been suspended | |
intl. | 7013 | Withdrawal address SUSPEND status | The withdrawal address has been suspended | |
intl. | 7014 | ITEM/PlayToken SUSPEND status | ITEM/PlayToken is disabled | |
intl. | 8001 | Input variable error | Invalid parameter | |
intl. | 8002 | Channel number verification error | Channel number does not exist | |
intl. | 8003 | Signature verification error | Signature information is invalid | |
intl. | 8004 | Data decryption failed | Data decryption error occurred | |
intl. | 8005 | Unregistered unit | Unregistered unit | |
intl. | 8006 | In case of channel stop | This channel has been suspended | |
intl. | 8007 | In case of channel stop | Transaction unavailable channel | |
intl. | 8008 | In case of channel stop | This channel has expired | |
intl. | 9999 | In case of undefined error | An error has occurred | |
intl. | B010 | User Unique ID Error | ID verification error occurred | |
intl. | B011 | Password verification error | A password error has occurred | |
intl. | B100 | Internal address, external address error | Request Wallet Address Error | |
JSON | -32700 | Parse error | JSON parsing error | |
JSON | -32600 | Invalid Request | Request JSON Object Validation Error | |
JSON | -32601 | Method not found | Not available (Method) | |
JSON | -32602 | Invalid params | Input variable validation error | |
JSON | -32603 | Internal error | Internal JSON-RPC error | |
JSON | -32000 ~ -32099 |
Server error | JSON-RPC Server Error | |
Custom | 1 | Unauthorized | Unauthorized | |
Custom | 2 | Action not allowed | Action not allowed | |
Custom | 3 | Execution error | Execution error | |
Custom | 3 | 100 | "X" doesn’t exist | 거래 검증 오류 |
Custom | 3 | 101 | Requires ether | Requires ether |
Custom | 3 | 102 | Gas too low | Gas too low |
Custom | 3 | 103 | Gas limit exceeded | as limit exceeded |
Custom | 3 | 104 | Rejected | Rejected |
Custom | 3 | 105 | Ether too low | Ether too low |
Custom | 3 | 106 | Timeout | Timeout |
Custom | 3 | 107 | Conflict | Conflict |
4. SAMLES
4.1. JAVA Sample
package com.PCRM.p2e;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import com.cholocb.util.common.JsonUtil;
import com.cholocb.util.crypto.HmacSha256Util;
import com.PCRM.p2e.api.VerseB;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;
import sun.net.www.protocol.http.HttpURLConnection;
public class APITest {
protected static final String VIEW_NAME_JSON = "common/jsonview";
public static void main(String[] args) {
if (args.length == 0) {
System.out.println("Usage : VerseB exRate|exReq|OutAddrVerify|OutPaswordReg|WithdrawReq|StatusReq");
return;
}
// Test 설정
VerseB.setIMode(0);
// Real 설정
//VerseB.setIMode(1);
HashMap hmIn = new HashMap();
HashMap hmOut = new HashMap();
switch (args[0]) {
// Exchange Rate
case "exRate" :
// 파라메터 설정
hmIn.put("merchantInformation.merchantId", "000000000001");
hmIn.put("merchantInformation.merchantSiteId", "000001");
hmIn.put("customerId", "000000000001");
hmIn.put("fromCurrency", "GOLD");
hmIn.put("toCurrency", "SLAYB");
hmIn.put("fromAmount", "100");
hmIn.put("key", "9F2488BFAE5FB03B9B483FA1CF1EC94B3B4B2E52780A2B53ED67E581110CC980");
hmIn.put("initialVector", "64750805549512089392625993734535");
// API 호출
hmOut = VerseB.exRate(hmIn);
System.out.println(hmOut);
if ("SUCCESS".equals(hmOut.get("status"))) {
// 정상 처리 응답 수신
String exRate = hmOut.get("exRate");
String toAmount = hmOut.get("toAmount");
System.out.println("exRate="+exRate+" toAmount="+toAmount);
} else {
// 오류 처리 응답 수신
String errCd = hmOut.get("errorInformation.errCd");
String reason = hmOut.get("errorInformation.reason");
System.out.println("errCd="+errCd+" reason="+reason);
}
return;
// Exchange
case "exReq" :
// 파라메터 설정
hmIn.put("merchantInformation.merchantId", "000000000001");
hmIn.put("merchantInformation.merchantSiteId", "000001");
hmIn.put("customerId", "000000000001");
hmIn.put("fromCurrency", "GOLD");
hmIn.put("toCurrency", "SLAYB");
hmIn.put("fromAmount", "100");
hmIn.put("exchangeRate", "10%");
hmIn.put("notifyUrl", "http://10.30.1.51:8180/p2e/AsyncResult.jsp");
hmIn.put("key", "9F2488BFAE5FB03B9B483FA1CF1EC94B3B4B2E52780A2B53ED67E581110CC980");
hmIn.put("initialVector", "64750805549512089392625993734535");
// API 호출
hmOut = VerseB.exReq(hmIn);
System.out.println(hmOut);
if ("SUCCESS".equals(hmOut.get("status"))) {
// 정상 처리 응답 수신
String txId = hmOut.get("txId");
System.out.println("txId="+txId);
} else {
// 오류 처리 응답 수신
String errCd = hmOut.get("errorInformation.errCd");
String reason = hmOut.get("errorInformation.reason");
System.out.println("errCd="+errCd+" reason="+reason);
}
return;
// OutAddrVerify
case "OutAddrVerify" :
// 파라메터 설정
hmIn.put("merchantInformation.merchantId", "000000000001");
hmIn.put("merchantInformation.merchantSiteId", "000001");
hmIn.put("customerId", "000000000001");
hmIn.put("outAddress", "0x8bDfa1f6393146f005F1C84050c553367c1e27d2");
hmIn.put("key", "9F2488BFAE5FB03B9B483FA1CF1EC94B3B4B2E52780A2B53ED67E581110CC980");
hmIn.put("initialVector", "64750805549512089392625993734535");
// API 호출
hmOut = VerseB.OutAddrVerify(hmIn);
System.out.println(hmOut);
if ("SUCCESS".equals(hmOut.get("status"))) {
// 정상 처리 응답 수신
System.out.println("Recv Success");
} else {
// 오류 처리 응답 수신
String errCd = hmOut.get("errorInformation.errCd");
String reason = hmOut.get("errorInformation.reason");
System.out.println("errCd="+errCd+" reason="+reason);
}
return;
case "OutPaswordReg" :
// 파라메터 설정
hmIn.put("merchantInformation.merchantId", "000000000001");
hmIn.put("merchantInformation.merchantSiteId", "000001");
hmIn.put("customerId", "000000000001");
hmIn.put("outAddress", "0x8bDfa1f6393146f005F1C84050c553367c1e27d2");
hmIn.put("outPassword", "Q!w2e3r4");
hmIn.put("key", "9F2488BFAE5FB03B9B483FA1CF1EC94B3B4B2E52780A2B53ED67E581110CC980");
hmIn.put("initialVector", "64750805549512089392625993734535");
// API 호출
hmOut = VerseB.OutPaswordReg(hmIn);
System.out.println(hmOut);
if ("SUCCESS".equals(hmOut.get("status"))) {
// 정상 처리 응답 수신
System.out.println("Recv Success");
} else {
// 오류 처리 응답 수신
String errCd = hmOut.get("errorInformation.errCd");
String reason = hmOut.get("errorInformation.reason");
System.out.println("errCd="+errCd+" reason="+reason);
}
return;
case "WithdrawReq" :
// 파라메터 설정
hmIn.put("merchantInformation.merchantId", "000000000001");
hmIn.put("merchantInformation.merchantSiteId", "000001");
hmIn.put("customerId", "000000000001");
hmIn.put("outAddress", "0x8bDfa1f6393146f005F1C84050c553367c1e27d2");
hmIn.put("outPassword", "Q!w2e3r4");
hmIn.put("fromCurrency", "SLAYB");
hmIn.put("toCurrency", "SLAYB");
hmIn.put("fromAmount", "10");
hmIn.put("notifyUrl", "http://10.30.1.51:8180/p2e/AsyncResult.jsp");
hmIn.put("key", "9F2488BFAE5FB03B9B483FA1CF1EC94B3B4B2E52780A2B53ED67E581110CC980");
hmIn.put("initialVector", "64750805549512089392625993734535");
// API 호출
hmOut = VerseB.WithdrawReq(hmIn);
System.out.println(hmOut);
if ("SUCCESS".equals(hmOut.get("status"))) {
// 정상 처리 응답 수신
String txId = hmOut.get("txId");
System.out.println("txId="+txId);
} else {
// 오류 처리 응답 수신
String errCd = hmOut.get("errorInformation.errCd");
String reason = hmOut.get("errorInformation.reason");
System.out.println("errCd="+errCd+" reason="+reason);
}
return;
default :
System.out.println("Usage : VerseB exRate|exReq|OutAddrVerify|OutPaswordReg|WithdrawReq|StatusReq");
return;
}
}
/* 채널 서버에서 수신 처리 개발 필요 */
/* Spring Framework WAS 기반으로 처리 예시로 채널 서버의 상황에 따라 자체 개발 필요 */
/* 수신 처리 Start */
public ModelAndView recvNotify(HttpServletRequest request, HttpServletResponse response) {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName(VIEW_NAME_JSON);
String key = "9F2488BFAE5FB03B9B483FA1CF1EC94B3B4B2E52780A2B53ED67E581110CC980";
try {
String sIn = readInputStream(request.getInputStream());
@SuppressWarnings("rawtypes")
Map mJsonReq = new HashMap();
try {
String contentType = request.getContentType();
if(contentType == null || contentType.indexOf("application/json") == -1){
response.setStatus(HttpURLConnection.HTTP_NOT_ACCEPTABLE);
JSONObject resJson = new JSONObject();
resJson.put("status", "ERROR");
resJson.put("errCode", 406);
resJson.put("reason", "Not Acceptable");
resJson.put("version", "1.0");
modelAndView.addObject("jsonData", resJson.toString());
modelAndView.setViewName(VIEW_NAME_JSON);
return modelAndView;
}
mJsonReq = JSONObject.fromObject(sIn);
} catch (JSONException e) {
e.printStackTrace();
response.setStatus(HttpURLConnection.HTTP_BAD_REQUEST);
JSONObject resJson = new JSONObject();
resJson.put("status", "ERROR");
resJson.put("errCode", 500);
resJson.put("reason", "Bad request.");
resJson.put("version", "1.0");
modelAndView.addObject("jsonData", resJson.toString());
modelAndView.setViewName(VIEW_NAME_JSON);
return modelAndView;
}
// 실제 수신 처리 수행 Start
String errCd = "0000";
String sSign = HmacSha256Util.unSignFromJSONStr(sIn, key);
if ("".equals(sSign)) {
// 에러 처리
errCd = "8003";
}
if ("confirm".equals(mJsonReq.get("status"))) {
// 채널 DB 업데이트 처리
System.out.println("DB Transaction Status Update");
} else {
errCd = "9999";
}
HashMap hmOut = new HashMap();
if ("0000".equals(errCd)) {
hmOut.put("merchantInformation.merchantId", (String) mJsonReq.get("merchantInformation.merchantId"));
hmOut.put("merchantInformation.merchantSiteId", (String) mJsonReq.get("merchantInformation.merchantSiteId"));
hmOut.put("clientReferenceInformation.code", (String) mJsonReq.get("clientReferenceInformation.code"));
hmOut.put("customerId", (String) mJsonReq.get("customerId"));
hmOut.put("status", "SUCCESS");
} else {
hmOut.put("merchantInformation.merchantId", (String) mJsonReq.get("merchantInformation.merchantId"));
hmOut.put("merchantInformation.merchantSiteId", (String) mJsonReq.get("merchantInformation.merchantSiteId"));
hmOut.put("clientReferenceInformation.code", (String) mJsonReq.get("clientReferenceInformation.code"));
hmOut.put("customerId", (String) mJsonReq.get("customerId"));
hmOut.put("status", "DECLINED");
hmOut.put("errorInformation.errCd", errCd);
hmOut.put("errorInformation.reason", "ERROR");
}
// 응답 전송 처리
JSONObject oSendJson = JsonUtil.makeJsonFromMap(hmOut);
String sSendJson = oSendJson.toString();
sSendJson = HmacSha256Util.signFromJSONStr(sSendJson, key);
modelAndView.addObject("jsonData", sSendJson);
// 실제 수신 처리 수행 End
modelAndView.setViewName(VIEW_NAME_JSON);
return modelAndView;
} catch (Exception e) {
response.setStatus(HttpURLConnection.HTTP_INTERNAL_ERROR);
// 반환값인 ModelAndView 인스턴스 생성
modelAndView = new ModelAndView();
modelAndView.setViewName(VIEW_NAME_JSON);
//modelAndView.addObject(RES_STATUS, ae.getErrCd());
String errCd = "500";
JSONObject resJson = new JSONObject();
resJson.put("status", "ERROR");
resJson.put("errCode", 500);
resJson.put("reason", "["+errCd+"] Error");
resJson.put("version", "1.0");
modelAndView.addObject("jsonData", resJson.toString());
return modelAndView;
}
}
private String readInputStream(InputStream is) {
BufferedReader brIn = new BufferedReader(new InputStreamReader(is));
StringBuilder sbIn = new StringBuilder();
String sStr = null;
try {
while ((sStr = brIn.readLine()) != null) {
sbIn.append(sStr);
}
} catch (Exception e) {
return "";
}
return sbIn.toString();
}
/* 수신 처리 End */
}
JAVA API Sample download
4.2. C/C++ Sample
/*
* APITest.c
*
* Created on: 2022. 7. 11.
* Author: NextBankDev
*/
#include <stdio.h>
#include <string.h>
#include <VerseB.h>
int main(int argc, char *args[])
{
if (argc != 3){
printf("[Usage] %s [API] [exRate|exReq|outAddr|outPwd|reqWithdraw]\n", args[0]);
return -1;
}
// Test 설정
iMode = 0;
// Real 설정
//iMode = 1;
char* mctKey = "9F2488BFAE5FB03B9B483FA1CF1EC94B3B4B2E52780A2B53ED67E581110CC980";
char* mctInitialVector = "64750805549512089392625993734535";
char* mctNotifyUrl = "http://10.30.1.51:8180/p2e/AsyncResult.jsp";
int iRet = 0;
if (strcmp("API",args[1]) == 0) {
// exRate
if (strcmp("exRate", args[2]) == 0) {
exRate_IN exRateIn;
exRate_OUT exRateOut;
strncpy(exRateIn.merchantId, "000000000001", sizeof(exRateIn.merchantId));
strncpy(exRateIn.merchantSiteId, "000001", sizeof(exRateIn.merchantSiteId));
strncpy(exRateIn.customerId, "000000000001", sizeof(exRateIn.customerId));
strncpy(exRateIn.fromCurrency, "GOLD", sizeof(exRateIn.fromCurrency));
strncpy(exRateIn.toCurrency, "SLAYB", sizeof(exRateIn.toCurrency));
strncpy(exRateIn.fromAmount, "100", sizeof(exRateIn.fromAmount));
strncpy(exRateIn.key, mctKey, sizeof(exRateIn.key));
strncpy(exRateIn.initialVector, mctInitialVector, sizeof(exRateIn.initialVector));
iRet = exRate(&exRateIn, &exRateOut);
printf("API exRate ret=%d\n\tmerchantId=%s\n\tmerchantSiteId=%s\n\tcode=%s\n\tcustomerId=%s\n"
"\tfromCurrency=%s\n\ttoCurrency=%s\n\tfromAmount=%s\n\ttoAmount=%s\n\texchangeRate=%s\n"
"\tstatus=%s\n\terrCd=%s\n\treason=%s\n",
iRet, exRateOut.merchantId, exRateOut.merchantSiteId, exRateOut.code, exRateOut.customerId,
exRateOut.fromCurrency, exRateOut.toCurrency, exRateOut.fromAmount, exRateOut.toAmount, exRateOut.exchangeRate,
exRateOut.status, exRateOut.errCd, exRateOut.reason);
}
// exReq
else if (strcmp("exReq", args[2]) == 0) {
exReq_IN exReqIn;
exReq_OUT exReqOut;
strncpy(exReqIn.merchantId, "000000000001", sizeof(exReqIn.merchantId));
strncpy(exReqIn.merchantSiteId, "000001", sizeof(exReqIn.merchantSiteId));
strncpy(exReqIn.customerId, "000000000001", sizeof(exReqIn.customerId));
strncpy(exReqIn.fromCurrency, "GOLD", sizeof(exReqIn.fromCurrency));
strncpy(exReqIn.toCurrency, "SLAYB", sizeof(exReqIn.toCurrency));
strncpy(exReqIn.fromAmount, "100", sizeof(exReqIn.fromAmount));
strncpy(exReqIn.exchangeRate, "10%", sizeof(exReqIn.exchangeRate));
strncpy(exReqIn.notifyUrl, mctNotifyUrl, sizeof(exReqIn.notifyUrl));
strncpy(exReqIn.key, mctKey, sizeof(exReqIn.key));
strncpy(exReqIn.initialVector, mctInitialVector, sizeof(exReqIn.initialVector));
iRet = exReq(&exReqIn, &exReqOut);
printf("API exReq ret=%d\n\tmerchantId=%s\n\tmerchantSiteId=%s\n\tcode=%s\n\tcustomerId=%s\n"
"\tfromCurrency=%s\n\ttoCurrency=%s\n\tfromAmount=%s\n\ttoAmount=%s\n\texchangeRate=%s\n"
"\tinternalAddress=%s\n\ttxId=%s\n"
"\tstatus=%s\n\terrCd=%s\n\treason=%s\n",
iRet, exReqOut.merchantId, exReqOut.merchantSiteId, exReqOut.code, exReqOut.customerId,
exReqOut.fromCurrency, exReqOut.toCurrency, exReqOut.fromAmount, exReqOut.toAmount, exReqOut.exchangeRate,
exReqOut.internalAddress, exReqOut.txId,
exReqOut.status, exReqOut.errCd, exReqOut.reason);
}
// outAddr
else if (strcmp("outAddr", args[2]) == 0) {
outAddr_IN outAddrIn;
outAddr_OUT outAddrOut;
strncpy(outAddrIn.merchantId, "000000000001", sizeof(outAddrIn.merchantId));
strncpy(outAddrIn.merchantSiteId, "000001", sizeof(outAddrIn.merchantSiteId));
strncpy(outAddrIn.customerId, "000000000001", sizeof(outAddrIn.customerId));
strncpy(outAddrIn.outAddress, "0x8bDfa1f6393146f005F1C84050c553367c1e27d2", sizeof(outAddrIn.outAddress));
strncpy(outAddrIn.key, mctKey, sizeof(outAddrIn.key));
strncpy(outAddrIn.initialVector, mctInitialVector, sizeof(outAddrIn.initialVector));
iRet = outAddr(&outAddrIn, &outAddrOut);
printf("API outAddr ret=%d\n\tmerchantId=%s\n\tmerchantSiteId=%s\n\tcode=%s\n\tcustomerId=%s\n"
"\toutAddress=%s\n"
"\tstatus=%s\n\terrCd=%s\n\treason=%s\n",
iRet, outAddrOut.merchantId, outAddrOut.merchantSiteId, outAddrOut.code, outAddrOut.customerId,
outAddrOut.outAddress,
outAddrOut.status, outAddrOut.errCd, outAddrOut.reason);
}
// outPwd
else if (strcmp("outPwd", args[2]) == 0) {
outPwd_IN outPwdIn;
outPwd_OUT outPwdOut;
strncpy(outPwdIn.merchantId, "000000000001", sizeof(outPwdIn.merchantId));
strncpy(outPwdIn.merchantSiteId, "000001", sizeof(outPwdIn.merchantSiteId));
strncpy(outPwdIn.customerId, "000000000001", sizeof(outPwdIn.customerId));
strncpy(outPwdIn.outAddress, "0x8bDfa1f6393146f005F1C84050c553367c1e27d2", sizeof(outPwdIn.outAddress));
strncpy(outPwdIn.outPassword, "Q!w2e3r4", sizeof(outPwdIn.outPassword));
strncpy(outPwdIn.key, mctKey, sizeof(outPwdIn.key));
strncpy(outPwdIn.initialVector, mctInitialVector, sizeof(outPwdIn.initialVector));
iRet = outPwd(&outPwdIn, &outPwdOut);
printf("API outPwd ret=%d\n\tmerchantId=%s\n\tmerchantSiteId=%s\n\tcode=%s\n\tcustomerId=%s\n"
"\tstatus=%s\n\terrCd=%s\n\treason=%s\n",
iRet, outPwdOut.merchantId, outPwdOut.merchantSiteId, outPwdOut.code, outPwdOut.customerId,
outPwdOut.status, outPwdOut.errCd, outPwdOut.reason);
}
// reqWithdraw
else if (strcmp("reqWithdraw", args[2]) == 0) {
reqWdraw_IN reqWdrawIn;
reqWdraw_OUT reqWdrawOut;
strncpy(reqWdrawIn.merchantId, "000000000001", sizeof(reqWdrawIn.merchantId));
strncpy(reqWdrawIn.merchantSiteId, "000001", sizeof(reqWdrawIn.merchantSiteId));
strncpy(reqWdrawIn.customerId, "000000000001", sizeof(reqWdrawIn.customerId));
strncpy(reqWdrawIn.outAddress, "0x8bDfa1f6393146f005F1C84050c553367c1e27d2", sizeof(reqWdrawIn.outAddress));
strncpy(reqWdrawIn.outPassword, "Q!w2e3r4", sizeof(reqWdrawIn.outPassword));
strncpy(reqWdrawIn.fromCurrency, "SLAYB", sizeof(reqWdrawIn.fromCurrency));
strncpy(reqWdrawIn.toCurrency, "SLAYB", sizeof(reqWdrawIn.toCurrency));
strncpy(reqWdrawIn.fromAmount, "10", sizeof(reqWdrawIn.fromAmount));
strncpy(reqWdrawIn.notifyUrl, mctNotifyUrl, sizeof(reqWdrawIn.notifyUrl));
strncpy(reqWdrawIn.key, mctKey, sizeof(reqWdrawIn.key));
strncpy(reqWdrawIn.initialVector, mctInitialVector, sizeof(reqWdrawIn.initialVector));
iRet = reqWithdraw(&reqWdrawIn, &reqWdrawOut);
printf("API reqWithdraw ret=%d\n\tmerchantId=%s\n\tmerchantSiteId=%s\n\tcode=%s\n\tcustomerId=%s\n"
"\toutAddress=%s\n"
"\tfromCurrency=%s\n\ttoCurrency=%s\n\tfromAmount=%s\n\ttoAmount=%s\n\texchangeRate=%s\n"
"\ttxId=%s\n"
"\tstatus=%s\n\terrCd=%s\n\treason=%s\n",
iRet, reqWdrawOut.merchantId, reqWdrawOut.merchantSiteId, reqWdrawOut.code, reqWdrawOut.customerId,
reqWdrawOut.outAddress,
reqWdrawOut.fromCurrency, reqWdrawOut.toCurrency, reqWdrawOut.fromAmount, reqWdrawOut.toAmount, reqWdrawOut.exchangeRate,
reqWdrawOut.txId,
reqWdrawOut.status, reqWdrawOut.errCd, reqWdrawOut.reason);
}
}
return 0;
}