What's Air-Direct

API End Point
- https://air.veritrans.co.jp/vtdirect
EndPoint for each API
- /v1/veritrans.min.js
- /v1/charges
- /v1/recharges
- /v1/creditcard/list
- /v1/creditcard/destroy
- /v1/capture
- /v1/search
- /v1/status
- /v1/void
- /v1/mpi_charges
- /v1/tokens
- /v1/cvs
Glossary
- Merchants
- Business operator or person using Air-Direct
- Merchant Site
- Site operated with Air-Direct by business operator or person
- MAP
- Merchant Administration Portal (MAP) is system offered by VeriTrans to Merchants, for transaction management.
Merchant can search the transactions on MAP made with Air-Direct
- API
- Web API offered by Air Direct.
Air-Direct has different end point for each API. Merchant can call API for the function he want to use by putting authentication information in header and request parameters in body part, and then send the GET or POST request by serializing the JSON object.
Merchant website can easily parse the response as it is in JSON format.
- API library
- Program library to send requests to Air-Direct API.
Without using library provided, merchant can implement and use their library as the specifications for API are very simple.
- Client Key
- In case using Tokens API, it's necessary to include this authentication key in Requested parameter. Make use of this key in HTML or Java Script.
- Server Key
- Authentication key to use each API except Tokens API. Specified and used as authorization header on HTTP header. As it is quite important authentication key, it should be saved only at merchants' server and be careful to prevent from leaking to the outside.
- veritrans.min.js (veritrans.js)
- Java Script program to send credit card information to Air-Direct and obtain Token Id.
Credit card information is being sent direct from browser to Air-Direct by loading it on credit card information entry screen of merchants' website.
Please refer to "veritrans.min.js" for more detailed usage.
- Token, Token Id
- Single use token of alphabet and hyphens that wraps the details of a credit card information when Token IP is called with credit card information.
Token contains with 36 random characters and the first 6 digits and the last 4 digits of credit card numbers. Token Id is valid only for 1 minute and required parameter to identify the credit card information. Used only for Charges API, expire if sent once, and cannot be reused.
- Order Id
- A unique and mandatory identifier set by merchant website to identify payment made by Air-Direct.
As Order Id is required as parameter for other Air-Direct API like Capture API, etc. as described later,, merchant should save in their own database. In many cases, key value of database of merchants' websites can be used as an Order Id.
- Tokens API
- API to keep credit card information temporally on Air-Direct. Response with Token Id to identify the registered credit card information.
- Charges API
- API to perform authorization or authorization and capture by credit card.
Token Id issued by Air-Direct, numbered Order Id and payment amount are minimal 3 parameters.
As there is a time limit for Token Id, please send it to merchants' sites as soon as the browser obtains Token Id at veritrans.min.js and process the payment with Charges API.
And to make it possible to process the payment without reentering credit card information, it is necessary to specify option parameter at Charges API and make it linked to the member ID at merchants' sites.
- ReCharges API
- API to process the payment without re-entry of credit card information by reusing the past payment information.
Available by specifying Register Id as described later and re-entry of credit card information is not needed.
By searching transaction at MAP and it is possible to ReOrder by using the same payment information.
- Customer Id
- Customer ID from the response of Charges API can be specified in ReCharges API.
By doing this, it is possible to extract the registered credit card information associated with Customer Id by using Creditcard/list API. In many cases, key value of database of merchants' websites c can be used as Order Id.
Air-Direct keep Customer Id and past payment information for ReOrder as one-to-many relation, it's not necessary to manage branch numbers at merchants' sites.
- Register Id
- Register Id issued by Air-Direct when register parameter is specified in Charges API and payment is successful, can be used as ReCharges API parameter.
Store the Register Id in your database as Customer Id associated with Register ID and card information can be retrieved with Creditcard/list.
Authentication Process
Server Key
Header | Value |
---|---|
Accept | application/json |
Content-Type | application/json |
Authorization | Basic {Base 64 encoded value of Server Key} |
Client Key
For more detail, please refer to veritrans.min.js or Tokens API.
Error Handling
Below is the information for result decision.
Http Status Code
API library throws exception if Http Status Code is not 200.
code
status
message
Also contains information that which process is successful or the reason why the process was failed, etc.
errors
The contents are as same as that of message,but when there are several incorrect parameters, String array containing all the reasons will be sent.
About Timeout
Response Patterns
code | Description |
---|---|
Q000 |
When the process is successful |
Q001 |
When the incorrect parameter is sent or when cannot be verified. Or payment is failed. |
Q002 |
In case if Client ley is empty when credit card information is sent Tokens API by using veritrans.min.js. |
Q099 |
When unexpected error occurs at Air-Direct. |
status | Description |
---|---|
success |
When the code is Q000. |
failure |
When the code is Q001. |
fatal |
When the code is Q099. |
transaction_type (Credit Card) |
Description |
---|---|
init |
At the time error |
a |
Authorization |
ax |
Authorization(Expired) |
ac |
Authorization & Capture |
pa |
Capture |
va,rad,rae |
Authorization -> Cancel |
vac,racd,race |
Authorization & Capture -> Cancel |
vpa,rpad,rpae |
Capture -> Cancel |
transaction_type (CVS) |
Description |
---|---|
authorize |
Request completion(includes failure) |
cancel_authorize |
Cancelled |
fix_capture |
Has been credited |
failure error samples
Samples of JSON response when failure error occurs.
{ "data": { "order_id": "TEST0005", "gross_amount": 1980, "card_number": "4111XXXXXXXXXX11", "with_capture": false }, "mstatus": "failure", "vresult_code": "NH18000000000000", "code": "Q001", "status": "failure", "message": "[Order already succeeded]", "errors": [ "Order already succeeded" ] }
fatal error sample
JSON response when fatal error occurs.
{ "code": "Q099", "status": "fatal", "message": "Fatal error, please contact veriTrans" }
veritrans.min.js
Normally, the browser directly calls Tokens API with the information entered on credit card information entry screen on merchants' site by using the method of veritrans.min.js.
Loading
<script src="https://air.veritrans.co.jp/vtdirect/v1/veritrans.min.js">
Sending credit card information
// Set the Client Key Veritrans.client_key = "Client Key"; function _error(d) { var message = d.message; // Set the code for Navigation in case of failure. } function _success(d) { var token_id = d.data.token_id; // Set the code to send the obtained Token Id to merchants' site. } function _cardSet() { return { "card_number": "card number", // Set the card number entered "card_exp_month": "expire date(MM)", // Set the expire date (month) entered "card_exp_year": "expire date(YYYY)", // Set the expire date (year) entered "card_cvv": "security code" // Set the security code entered. } } // Set the code to send the credit card information when the button is pressed $("button.submit").bind("click", function () { Veritrans.tokenGet(_cardSet, _success, _error); });
Credit Card Payment (/charges)
As Token Id has upper limit for expiry of 1 minute, needs to make credit card payment with API as soon as Token Id is sent to merchant site from browser.
Uri
https://air.veritrans.co.jp/vtdirect/v1/charges
Request Parameter
Request Header
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key} Set base 64 encoded Server Key. |
Request text *…mandatory
* token_id | Set Token Id issued by Tokens API |
---|---|
* order_id | Set unique numbers for each payment. Half-width alphanumeric, hyphen and underscore can be use and must be within 100 digits. |
* gross_amount | Set payment amount between 1~99999999. |
with_capture | Set the Boolean value if you want to capture at the time of authorization. If it's not set, then only authorization will be performed. When set "true", capture will be performed at the time of authorization. |
register | Set by boolean value to associate member id of merchants' website with this payment. If not set, the member id will not be associated. When set "true", transaction ID of real payment will be registered at Air-Direct. (If the payment is failed, it won't be registered.) |
customer_id | Set member ID (Member id issued by merchant website) of merchants' sites. If "true" is set at Register, Register Id will be issued even if Customer Id is not specified, but in that case, merchant must store the Register Id issue. |
test_mode | Set by Boolean to make dummy transaction. If it's not set, it will be real transaction, and not dummy transaction. Necessary to set "true" during testing. |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new \VtDirect\Client\Request\ChargesParameter(); $input->order_id = "TEST0003"; $input->token_id = "1c0cc4c0-9973-40db-bf81-8caf5349037d-411111-1111"; $input->gross_amount = 1980; $charges = new \VtDirect\Client\Charges($setting); $response = $charges->ChargeWithToken($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::ChargesParameter.new api = VtDirect::Charges.new setting input.order_id = 'TEST0030' input.token_id = 'c4a94573-3b03-4289-be1a-bb4d8dbcce04-411111-1111' input.gross_amount = 1980 response = api.charge_with_token input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); ChargeRequest input = new ChargeRequest(); Charges api = new Charges(clientConfiguration); input.setGrossAmount(1980); input.setOrderId("TEST0050"); input.setTokenId("3d499de5-b009-47b2-a331-2d9b2a00b288-411111-1111"); ChargeResponse response = api.ChargeWithToken(input);
Request Sample 1
{ "token_id": "7caebe94-b39c-4468-aad0-4da4e42648a8-411111-1111", "order_id": "TEST0001", "gross_amount": 1980 }
Request Sample 2
To associate the member Id with the payment and use it in subsequent payment on merchant website, send the JSON like below.
{ "token_id": "64761c74-3b1c-4d73-b6e9-18d0bf721db7-411111-1111", "order_id": "TEST0002", "register": true, "customer_id": "C0001", "gross_amount": 1980 }
Contents of successful response
When register is disabled
{ "data": { "order_id": "TEST0004", "gross_amount": 1980, "card_number": "4111XXXXXXXXXX11", "with_capture": false }, "mstatus": "success", "vresult_code": "A001H00100000000", "transaction_type": "a", "pending": "0", "acquirer_code": "05", "trad_url": "https://www.example.com/abcde;fghij;klmno", "code": "Q000", "status": "success", "message": "Success do charge transaction" }
When register is enable
{ "data": { "order_id": "TEST0005", "gross_amount": 1980, "card_number": "4111XXXXXXXXXX11", "with_capture": false }, "mstatus": "success", "vresult_code": "A001H00100000000", "transaction_type": "a", "pending": "0", "acquirer_code": "05", "trad_url": "https://www.example.com/abcde;fghij;klmno", "register_id": "3a582e5c-4d68-47c5-861e-74bb1b50a05d1384309014", "customer_id": "C0001", "code": "Q000", "status": "success", "message": "Success do charge transaction" }
※customer_id has the value that was specified in charge request.
Credit card payment error
For Charges API or ReCharges API, perform the page transition based on the response result and by referring the contents below.
mstatus
mstatus is success only when authorization and authorization with capture is successful.
mstatus | Meanings |
---|---|
success | Successful |
failure | Unsuccessful |
pending | pending |
vresult_code
Following are some of the error code and reason when mstatus is not "success".
Please do the navigation as per your needs.
First 4 digits of vresult_code | Reason |
---|---|
AG33 | Impossible to use credit card. |
AG39 | Judgment for transaction (Manual decision) is pending. |
AG41 | Security code is wrong. |
AG44 | Limit for utilization of account or amount exceeded. |
AG45 | Credit card limit for a day is exceeded |
AG46 | Credit card is invalid. |
AG47 | Fraud card. |
AG48 | Invalid card. |
AG49 | Account number error. |
AG51 | Error for amount specified. |
AG61 | Payment type error. |
AG64 | Credit card expiry date error. |
AG70 | Request rejected. |
AG71 | Error as this transaction is out of our business |
AG72 | Connection request rejected. |
ACD6 | No original transaction. |
Contents of failed response
When Token is expired
{ "code": "Q001", "status": "failure", "message": "[Token was expired]", "errors": [ "Token was expired" ] }
When OrderID is duplicated
{ "data": { "order_id": "TEST0005", "gross_amount": 1980, "card_number": "4111XXXXXXXXXX11", "with_capture": false }, "mstatus": "failure", "vresult_code": "NH18000000000000", "code": "Q001", "status": "failure", "message": "[Order already succeeded]", "errors": [ "Order already succeeded" ] }
Card error
{ "data": { "order_id": "TEST0007", "gross_amount": 1980, "card_number": "4111XXXXXXXXXX11", "with_capture": false }, "mstatus": "failure", "vresult_code": "AG72000000000000", "transaction_type": "init", "pending": "", "acquirer_code": "05", "code": "Q001", "status": "failure", "message": "[Card Error]", "errors": [ "Card Error" ] }
Credit Card Re-Order payments (/recharges)
Uri
Request Parameter
Request header
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key} Set base 64 encoded Server Key. |
Request text *…mandatory
* order_id | Set unique numbers for each payment. Half-width alphanumeric, hyphen and underscore can be use and must be within 100 digits. |
---|---|
* register_id | Set ID issued by Charges when the payment is made with register parameter as "true". |
* gross_amount | Set payment amount between 1~99999999. |
with_capture | Set the Boolean value if you want to capture at the time of authorization. If it's not set, then only authorization will be performed. When set "true", capture will be performed at the time of authorization. |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new \VtDirect\Client\Request\ReChargesParameter(); $input->register_id = "3a582e5c-4d68-47c5-861e-74bb1b50a05d1384309014"; $input->order_id = "TEST0009"; $input->gross_amount = 1980; $charges = new \VtDirect\Client\ReCharges($setting); $response = $charges->ReChargeWithRegisterId($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::ReChargesParameter.new input.order_id = 'TEST0032' input.gross_amount = 1980 input.register_id = 'bd7067e7-275e-47d4-b7e1-8986ee897caf1384337330' api = VtDirect::ReCharges.new setting response = api.re_charge_with_register_id input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); ReChargeRequest input = new ReChargeRequest(); input.setOrderId("TEST0052"); input.setGrossAmount(1980); input.setRegisterId("8e5456ed-966a-44fb-bb69-d4b0a377bed21384413841"); ReCharges api = new ReCharges(clientConfiguration); ReChargeResponse response = api.ReChargeWithRegisterId(input);
Request Sample
{ "order_id": "TEST0007", "register_id": "3a582e5c-4d68-47c5-861e-74bb1b50a05d1384309014", "gross_amount": 1980 }
Contents of successful response
{ "data": { "order_id": "TEST0007", "gross_amount": 1980, "with_capture": false }, "mstatus": "success", "vresult_code": "A001000000000000", "transaction_type": "a", "pending": "0", "acquirer_code": "05", "register_id": "3a582e5c-4d68-47c5-861e-74bb1b50a05d1384309014", "customer_id": "C0001", "trad_url": "https://www.example.com/abcde;fghij;klmno", "code": "Q000", "status": "success", "message": "Success do recharge transaction" }
Credit card payment error
And as transaction data is deleted after 400 days, the payment can be failed if successful the transaction made in Charges/ReCharges API is considerably old.
Please enable navigation same as Charges API in case the response result is error.
Contents of failed response
When OrderID is duplicated.
{ "data": { "order_id": "TEST0007", "gross_amount": 1980, "with_capture": false }, "mstatus": "failure", "vresult_code": "NH18000000000000", "code": "Q001", "status": "failure", "message": "[Order already succeeded]", "errors": [ "Order already succeeded" ] }
In case specified register_id is not registered.
{ "code": "Q001", "status": "failure", "message": "[No such credit card bind]", "errors": [ "No such credit card bind" ] }
Credit Card Information Management (/creditcard)
Obtainment of credit card information list (Creditcard/list)
Uri
Request Parameter
Request header
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key} Set base 64 encoded Server Key. |
Request text *…mandatory
* customer_id | Set members' ID of the merchants' website. |
---|
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new \VtDirect\Client\Request\CreditCardListParameter(); $input->customer_id = "C0001"; $api = new \VtDirect\Client\CreditCardList($setting); $response = $api->ListCreditCardBind($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::CreditCardListParameter.new input.customer_id = 'C0002' api = VtDirect::CreditCardList.new setting response = api.list_credit_card_bind input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); CreditCardListRequest input = new CreditCardListRequest(); input.setCustomerId("C0006"); CreditCardList api = new CreditCardList(clientConfiguration); CreditCardListResponse response = api.ListCreditCardBind(input);
Request Sample
{ "customer_id": "C0001" }
Contents of successful response
{ "cards": [ { "register_id": "414264f0-87da-4bba-8da8-25df92fd35dc1384314166", "brand": "MASTER", "last4": "4444", "original_order_id": "TEST0010", "last_updated": "2013-11-13 12:40:08", "customer_id": "C0001" }, { "register_id": "3a582e5c-4d68-47c5-861e-74bb1b50a05d1384309014", "brand": "VISA", "last4": "1111", "original_order_id": "TEST0009", "last_updated": "2013-11-13 11:40:16", "customer_id": "C0001" } ], "customer_id": "C0001", "code": "Q000", "status": "success", "message": "Success do query credit card list" }
Credit Card Information Destroy (Creditcard/destroy)
Uri
Request Parameter
Request header
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key} Set base 64 encoded Server Key. |
Request text *…mandatory
* register_id | ID issued from Air-Direct when register flag is on. |
---|
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new \VtDirect\Client\Request\CreditCardDestroyParameter(); $input->register_id = "3a582e5c-4d68-47c5-861e-74bb1b50a05d1384309014"; $api = new \VtDirect\Client\CreditCardDestroy($setting); $response = $api->DestroyCreditCardBind($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::CreditCardDestroyParameter.new input.register_id = 'bd7067e7-275e-47d4-b7e1-8986ee897caf1384337330' api = VtDirect::CreditCardDestroy.new setting response = api.destroy_credit_card_bind input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); CreditCardDestroyRequest input = new CreditCardDestroyRequest(); input.setRegisterId("8e5456ed-966a-44fb-bb69-d4b0a377bed21384413841"); CreditCardDestroy api = new CreditCardDestroy(clientConfiguration); CreditCardDestroyResponse response = api.DestroyCreditCardBind(input);
Request Sample
{ "register_id": "414264f0-87da-4bba-8da8-25df92fd35dc1384314166" }
Contents of successful response
{ "customer_id": "C0001", "register_id": "414264f0-87da-4bba-8da8-25df92fd35dc1384314166", "code": "Q000", "status": "success", "message": "Success do destroy credit card bind" }
Contents of unsuccessful response
In case specified register_id is not registered.
{ "register_id": "414264f0-87da-4bba-8da8-25df92fd35dc1384314166", "code": "Q001", "status": "failure", "message": "[No such credit card bind]", "errors": [ "No such credit card bind" ] }
Sales process (/capture)
Sales are performed with the amount at the time of credit obtainment.
Uri
Request Parameter
Request header
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key} Set base 64 encoded Server Key. |
Request text *…mandatory
* order_id | Specify the same OrderId that was specified when the authorization was performed on Charges API. |
---|---|
amount | Specify the amount to be capture. Amount should be less than the amount at the time of authorization. When it's not specified, amount specified at the time of authorization will be captured. |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new \VtDirect\Client\Request\CaptureParameter(); $input->order_id = "TEST0005"; $api = new \VtDirect\Client\Capture($setting); $response = $api->CaptureOrder($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::CaptureParameter.new input.order_id = 'TEST0040' api = VtDirect::Capture.new setting response = api.capture_order input
Java code
clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); CaptureRequest input = new CaptureRequest(); input.setOrderId("TEST0050"); Capture api = new Capture(clientConfiguration); CaptureResponse response = api.CaptureOrder(input);
Request Sample
{ "order_id": "TEST0001" }
Contents of successful response
In normal case
{ "data": { "order_id": "TEST0001", "transaction_status": "capture" }, "vresult_code": "A001000000000000", "code": "Q000", "status": "success", "message": "Success do capture transaction" }
Contents of unsuccessful response
In case of trying "Capture" twice.
{ "vresult_code": "NH18000000000000", "code": "Q001", "status": "failure", "message": "[This order is already captured]", "errors": [ "This order is already captured" ] }
In case of trying "Capture" the order that has been already cancelled.
{ "vresult_code": "NH02000000000000", "code": "Q001", "status": "failure", "message": "[Order invalid]", "errors": [ "Order invalid" ] }
In case of try to Capture the order that order doesn't exist.
{ "code": "Q001", "status": "failure", "message": "[Order not found]", "errors": [ "Order not found" ] }
Search Payment Transaction Information (/search)
Uri
Request Parameter
Request Header
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} Set the Base64 encoded Server Key to {base64encoded_server_key}. |
Request Body
When searching for 3-D Secure results, use Request Id. At other times, use Order Id.order_id | Set the Order Id for the order that you applies to the payment transaction information. |
---|---|
request_id | Set the Request Id for the key item to retrieve 3-D Secure result. |
test_mode | Sets Boolean value to run either dummy or real transaction. Set to true during testing. |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new \VtDirect\Client\Request\SearchParameter(); $input->order_id = "TEST0011"; $api = new \VtDirect\Client\Search($setting); $response = $api->GetOrderTransactionInfo($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::SearchParameter.new input.order_id = 'TEST0011' api = VtDirect::Search.new settings response = api.get_order_transaction_info input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); SearchRequest input = new SearchRequest(); input.setOrderId("TEST1011"); Search api = new Search(clientConfiguration); SearchResponse response = api.getOrderTransactionInformation(input);
Request Example
"https://air.veritrans.co.jp/vtdirect/v1/search?order_id=TEST0011"
Details upon successful response
In normal case
{ "order_info": { "order_id": "TEST0011", "service_type_code": "mpi", "last_success_command": "Capture", "success_detail_transaction_type": "pa", "proper_order_info": {}, "memo1": "memo", "free_key": "keyinfo", "transaction_info_array": [ { "amount": 100, "command": "Authorize", "mstatus": "success", "vresult_code": "G001H00100000000", "transaction_datetime": "2014-12-16 12:06:21.048", "properTransactionInfo": { "transaction_kind": "mpi", "transaction_type": "auth", "corporation_id": "05", "res_3d_message_version": "1.0.2" } }, { "amount": 100, "command": "Verify", "mstatus": "success", "vresult_code": "G011A00100000000", "transaction_datetime": "2014-12-16 12:06:46.74", "properTransactionInfo": { "transaction_kind": "mpi", "transaction_type": "vd", "res_3d_cavv": "OTg3NjU0MzIxMDk4NzY1NDMyMT\u003d\u003d", "res_3d_cavv_algorithm": "2", "res_3d_eci": "05", "res_3d_message_version": "1.0.2", "res_3d_transaction_id": "MDEyMzQ1Njc4OT\u003dxMjM0NTY3ODk\u003d", "res_3d_transaction_status": "Y" } }, { "amount": 100, "command": "Verify", "mstatus": "success", "vresult_code": "G011A00100000000", "transaction_datetime": "2014-12-16 12:06:46.932", "properTransactionInfo": { "transaction_kind": "card", "res_auth_code": "000000", "res_center_error_code": " " } }, { "amount": 100, "command": "Capture", "mstatus": "success", "vresult_code": "A001000000000000", "transaction_datetime": "2014-12-18 14:46:10.94", "properTransactionInfo": { "transaction_kind": "card", "res_auth_code": "000000", "res_center_error_code": " " } } ] }, "vresult_code": "N001000000000000", "mstatus": "success", "code": "Q000", "status": "success", "message": "Search request was successful" }
Contents of unsuccessful response
In case the specifying order that doesn't exist.
{ "vresult_code": "N001000000000000", "mstatus": "success", "code": "Q001", "status": "failure", "message": "[such an order was not found]", "errors": ["such an order was not found"] }
Payment transaction information status (/status)
You can get a lot more information if the /search API. Please use the usually /search API.
Uri
Request Parameter
Request header
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key} Set base 64 encoded Server Key. |
Request text *…mandatory
* order_id | Specify the OrderId of the order whose payment transaction information status will be obtained. |
---|
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new \VtDirect\Client\Request\StatusParameter(); $input->order_id = "TEST0011"; $api = new \VtDirect\Client\Status($setting); $response = $api->GetOrderStatus($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::StatusParameter.new input.order_id = 'TEST0031' api = VtDirect::Status.new setting response = api.get_order_status input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); StatusRequest input = new StatusRequest(); String orderId = "TEST0052"; input.setOrderId(orderId); Status api = new Status(clientConfiguration); StatusResponse response = api.GetOrderStatus(input);
Request Sample
{ "order_id": "TEST0011" }
Contents of successful response
In normal case
{ "data": { "order_id": "TEST0011", "service_type_code": "card", "order_status": "end", "last_success_transaction_type": "Authorize", "success_detail_transaction_type": "a", "amount": 1980, "transaction_type": "a", "gateway_request_date": "2013-11-13 15:41:37", "gateway_response_date": "2013-11-13 15:41:37", "pending": "0", "auth_code": "000000", "action_code": "000" }, "vresult_code": "N001000000000000", "code": "Q000", "status": "success", "message": "Success search card order transaction" }
Contents of unsuccessful response
In case the specifying order that doesn't exist.
{ "vresult_code": "N001000000000000", "code": "Q001", "status": "failure", "message": "[such an order was not found]", "errors": [ "such an order was not found" ] }
Cancellation of payment (/void)
Uri
Request Parameter
Request header
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key} Set base 64 encoded Server Key. |
Request text *…mandatory
* order_id | Specify OrderId of the order to be cancelled. |
---|---|
amount | Specify the amount for cancellation. Partial refund for credit card is possible. Specify the amount less than that of Capture amount. When it's not specified, whole amount will be cancelled. |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new \VtDirect\Client\Request\CancelParameter(); $input->order_id = "TEST0011"; $api = new \VtDirect\Client\Cancel($setting); $response = $api->CancelOrder($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::VoidParameter.new input.order_id = 'TEST0040' api = VtDirect::Void.new setting response = api.void_order input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); VoidRequest input = new VoidRequest(); String orderId = "TEST0052"; input.setOrderId(orderId); Void api = new Void(clientConfiguration); VoidResponse response = api.VoidOrder(input);
Request Sample
{ "order_id": "TEST0002" }
Contents of successful response
In normal case
{ "data": { "order_id": "TEST0002", "transaction_status": "cancel" }, "vresult_code": "A001000000000000", "code": "Q000", "status": "success", "message": "Success do void transaction" }
Contents of unsuccessful response
When try to cancel the order that was already cancelled.
{ "vresult_code": "NH18000000000000", "code": "Q001", "status": "failure", "message": "[This order is already cancelled]", "errors": [ "This order is already cancelled" ] }
3-D Secure Payment (/mpi_charges)
When the status is "success" for the results for the API below, with the received response_contents from the response, redirect the browser to the 3-D Secure flow.
Uri
Request Parameter
Request Header
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} Set the Base64 encoded Server Key to {base64encoded_server_key}. |
Request Body *…Required
* order_id | Set unique number for each payment. Valid characters are Half-width alphanumeric, hyphen and underscore, up to 100 characters in length. |
---|---|
* token_id | Set the TokenID issued by the Token API. |
* gross_amount | Set the payment amount from 1 to 99999999. |
* service_option_type | Set one of the following "mpi-complete": Complete verification "mpi-company": Normal Verification (Card Company bears risk) |
push_uri | Set the URL of the merchant's website for notification of 3-D Secure result. 256 half-width characters. |
* redirection_uri | Browser's return URL after completion of 3-D Secure. Up to 256 half-width characters. |
* http_user_agent | Set the browser's HTTP User-Agent header. |
* http_accept | Set the browser's HTTP Accept header. |
with_capture | Set the Boolean value if you want to charge at the time of authorization. When not set, authorization will be executed. When set to true, capture and authorization will execute together |
test_mode | Sets Boolean value to run either dummy or real transaction. Set to true during testing. |
memo1 | Set a memo for order. Up to 100 characters in length. |
free_key | Set a key information etc for order. Valid characters are Half-width alphanumeric, up to 256 characters in length. |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new VtDirect\Client\Request\MpiChargesParameter(); $input->token_id = "abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111"; $input->order_id = "TEST1005"; $input->gross_amount = 1980; $input->service_option_type = "mpi-complete"; $input->push_uri = "https://example.com/push_receive"; $input->redirection_uri = "https://example.com/complete"; $input->http_user_agent = "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"; $input->http_accept = "text/html, application/xhtml+xml, */*"; $api = new VtDirect\Client\MpiCharges($setting); $response = $api->MpiChargeWithToken($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::MpiChargesParameter.new input.token_id = 'abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111' input.order_id = 'TEST1005' input.gross_amount = 1980 input.service_option_type = 'mpi-complete' input.push_uri = 'https://example.com/push_receive' input.redirection_uri = 'https://example.com/complete' input.http_user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko' input.http_accept = 'text/html, application/xhtml+xml, */*' api = VtDirect::MpiCharges.new setting response = api.mpi_charge_with_token input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); MpiChargeRequest input = new MpiChargeRequest(); input.setTokenId("abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111"); input.setOrderId("TEST1005"); input.setGrossAmount(1980); input.setServiceOptionType("mpi-complete"); input.setPushUri("https://example.com/push_receive"); input.setRedirectionUri("https://example.com/complete"); input.setHttpAccept("text/html, application/xhtml+xml, */*"); input.setHttpUserAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"); MpiCharges api = new MpiCharges(clientConfiguration); MpiChargeResponse response = api.mpiChargeWithToken(input);
Request Example
{ "token_id": "abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111", "order_id": "TEST1006", "gross_amount": 1980, "service_option_type": "mpi-complete", "push_uri": "https://example.com/push_receive", "redirection_uri": "https://example.com/complete", "http_user_agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko", "http_accept": "text/html, application/xhtml+xml, */*" }
Details upon successful response.
{ "data": { "order_id": "TEST1006", "gross_amount": 1980, "with_capture": false, "service_option_type": "mpi-complete", "response_contents": "\u003c!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 ....(abbr", "res_corporation_id": "05", "res_brand_id": "5" }, "mstatus": "success", "vresult_code": "G001H00100000000", "code": "Q000", "status": "success", "message": "mpi authorize request was successful" }
Contents of failed response
Cannot execute 3-D secure authorization (Issuer or card member has not participate.)
{ "mstatus": "failure", "vresult_code": "GE02000000000000", "code": "Q001", "status": "failure", "message": "[Cannot perform the authentication]", "errors": [ "Cannot perform the authentication" ] }
Issue of Token (/tokens)
As normally the browser send credit card information to this API by veritrans.min.js, it's not necessary to use this API from merchant websites' program at all.
Uri
Request Parameter
Request text *…mandatory
* card_cvv | Set the security code. 3-4 digits number. |
---|---|
* card_exp_month | Set the month of credit card expiration date. 2 digits number. |
* card_exp_year | Set the year of credit card expiration year. 4 digits number. |
* card_number | Set the credit card number. |
* client_key | Set the client key. |
callback | In case veritrans.min.js calls this API, values will be set automatically and response will be in the form of JSONP. When callback is not specified, the response will be JSON. |
PHP code
$setting = new \VtDirect\Client\Setting(); $input = new \VtDirect\Client\Request\TokensParameter(); $input->card_number = "4111111111111111"; $input->card_exp_month = "12"; $input->card_exp_year = "2018"; $input->card_cvv = "1234"; $input->client_key = "bbbbbbbb-2222-cccc-3333-eeeeeeeeeeee"; $tokens = new \VtDirect\Client\Tokens($setting); $response = $tokens->GetToken($input);
Ruby code
setting = VtDirect::Setting.new tokens = VtDirect::Tokens.new setting response = tokens.get_token( 'bbbbbbbb-2222-cccc-3333-eeeeeeeeeeee', '4111111111111111', '2018', '12', '123')
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); TokenRequest input = new TokenRequest(); input.setClientKey("bbbbbbbb-2222-cccc-3333-eeeeeeeeeeee"); input.setCardNumber("4111111111111111"); input.setCardExpireYear("2018"); input.setCardExpireMonth("12"); input.setCardCvv("123"); Tokens tokens = new Tokens(clientConfiguration); TokenResponse response = tokens.GetToken(input);
* The codes sample implementation on for merchant wesite side, but in principle, Tokens API is callback from veritrans.min.js
Request Sample
"https://air.veritrans.co.jp/vtdirect/v1/tokens?card_number=4111111111111111&card_exp_month=08&card_exp_year=2015&card_cvv=123&client_key=bbbbbbbb-2222-cccc-3333-eeeeeeeeeeee&callback=json1"
Content of successful response
{ "data": { "token_id": "8ebec161-b054-4d31-83a1-4b58de696f89-411111-1111" }, "code": "Q000", "status": "success", "message": "Success request new token" }
* When Token Id is issued, token_id contains the first 6 digits and the last 4 digits of credit card number on its last part.
Content of unsuccessful response
In case client_key is not correct.
{ "code": "Q001", "status": "failure", "message": "[Cannot find merchant]", "errors": [ "Cannot find merchant" ] }
In case card_number format is not in correct.
{ "code": "Q001", "status": "failure", "message": "[Invalid card number]", "errors": [ "Invalid card number" ] }
Convenience Store Payment (/cvs)
Uri
Request Parameter
Request header
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key} Set base 64 encoded Server Key. |
Request text *…mandatory
* option_type | In case of 7-Eleven, set "sej" and for LAWSON, FamiliyMart, MINI STOP, Seicomart set "econ". |
---|---|
* order_id | et unique numbers for each payment. Half-width alphanumeric, hyphen and underscore can be use and must be within 100 digits. |
* gross_amount | Set payment amount between 1~300000. |
* tel | Set consumers' telephone number in half-width between 10~11 digits without hyphen. Never use fixed value. |
* name1 | Set consumers' full width last name with maximum size 20 byte. Letters available are below : ー、々、ヽ、ヾ ゝ、ゞ、〃、〆 Numbers, alphabet, Hira-gana, Kata-kana, Level 1 Kanji, Level 2 Kanji |
* name2 | Set consumers' full width first name with maximum size 20 bytes. Other restrictions are same as name1 parameter. |
pay_limit | Set due date for payment in 8half-width numbers in format yyyymmdd. When option _type parameter value is set as "sej" then pay_limit can vary from same day till 150 days later. When option _type parameter value is set "econ", then pay_limit can vary from same day till 60 days later. If not specified, default value is applied. |
test_mode | Set the Boolean value to make dummy transaction. If it's not set, it will be real transaction, and not dummy transaction. Necessary to set "true" during testing.. |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new \VtDirect\Client\Request\CvsParameter(); $input->order_id = "TEST0014"; $input->gross_amount = 1980; $input->name1 = 'Test'; $input->name2 = 'Taro'; $input->option_type = "sej"; $input->tel = '09000000000'; $api = new \VtDirect\Client\Cvs($setting); $response = $api->PaymentAtCvs($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' setting.ca_cert_path = 'D:\\cacert.pem' input = VtDirect::Request::CvsParameter.new input.order_id = 'TEST0041' input.gross_amount = 1980 input.name1 = 'Test' input.name2 = 'Taro' input.option_type = 'sej' input.tel = '09000000000' api = VtDirect::Cvs.new setting response = api.payment_at_cvs input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); CvsRequest input = new CvsRequest(); input.setOrderId("TEST0053"); input.setGrossAmount(1980); input.setName1("Test"); input.setName2("Taro"); input.setOptionType("sej"); input.setTel("09000000000"); Cvs api = new Cvs(clientConfiguration); CvsResponse response = api.PaymentAtCvs(input);
Request Sample
{ "order_id": "TEST0013", "tel": "0900000000", "name1": "Test", "name2": "Taro", "gross_amount": 1980, "option_type": "sej" }
Notification of deposit
Please refer here to service setting method about notification URL.
Parameter | Details |
---|---|
numberOfNotify | numberOfNotify Single notification contains 1,000 records, For 1,001 and above, please use next notifications. |
pushTime | Notification time. (YYYYMMDDhhmmss) |
pushId | ID is incremented each time a PUSH notification is processed. Maximum 8 letters. |
Below parameters repeats for number of records in notification. Furthermore, a four digit sequential number (0000~9999) is appended to the end of the Field Name. | |
orderId | Order Id specified when the order is sent. Maximum 100 letters. |
cvsType | Text to identify the convenience store where payment is performed. "sej":7-Eleven "econ-lw":LAWSON "econ-fm":FamilyMart "econ-mini":MINI STOP "econ-other":Seicomart * In dummy transaction where "econ" is specified as option_type, fixed value "econ-lw" is returned. |
receiptNo | Text of receipt number Maximum 32 Half-width letters and numbers. |
receiptDate | Date of completion of payment (YYYYMMDDhhmmss) |
rcvAmount | Deposited amount Maximum 6 digits numbers |
dummy | "1" in case of dummy transaction. |
Please use one of the certificate authority issued SSL certificate.
* Please note that self-signed SSL certificate can't be use.
Content of successful response
{ "data": { "order_id": "TEST0013", "gross_amount": 1980 }, "mstatus": "success", "vresult_code": "D001H00100000000", "url": "https://payment.sej.co.jp/od/hi.asp?HARAIKOMIXXXXXXXXXXXXX0000010001", "receipt_no": "2000000010001", "trad_url": "https://www.example.com/abcde;fghij;klmno", "code": "Q000", "status": "success", "message": "Success do cvs authorize transaction" }
API library
PHP
Air-Direct-php
Support for PHP 5.4 or later. Enable SSL connection for https in cURL module of PHP.
Ruby
Air-Direct-ruby
Support for Ruby 2.0 or later. Necessary to install the dependent RubyGem by Bundler.
Java
Air-Direct-java
Support for JDK1.7. Necessary to install the dependency library by Maven. Groovy is used in some classes.
Error Code List
Credit Card Payment
vresult_code the first 4 digits | Reason |
---|---|
NH18 | "charge" API is called by specifying Order Id for which payment is already processed. |
NH02 | In case the status of transaction is not right, for example, the specified Order Id was cancelled. Also, parameter values specified for dummy transaction request are not as per testing specifications, or real transaction is performed while application is in process. |
AG** | When credit card authorization is failed. |
NH04 | Transaction is duplicated. |
NH40 | Order id is already used in other service. |
AC25 | Format of credit card number parameter is wrong. |
AC27 | Credit card number parameter validation error. |
AC30 | Format of credit card expiration date parameter is wrong. |
NH05 | Transaction in process. |
NC06 | Parameter invalid. |
AE10 | Transaction in pending. |
ACD3 | Transaction is expired. |
ACD4 | Original transaction is not success. |
Convenient Store Payment
vresult_code the first 4 digits | Reason |
---|---|
DC47, NH11 | When the invalid option_type parameter is specified. |
NC04, NC06 | Parameter invalid. |
DC05 | Due date for payment is already passed. |
DC07 | Customer name (katakana) is specified in wrong format. |
DC08 | Due date for payment is specified in wrong format. |
DE05, DG37 | Condition for payment of test transaction is wrong. |
DH15 | Transaction is failed due to the error in VeriTrans Gateway. |
NH18 | Already success. |
NH02 | Invalid transaction. Also, parameter values specified for dummy transaction request are not as per testing specifications, or real transaction is performed while application is in process. |
NH04 | Transaction is duplicated. |
NH40 | Order id is already used in other service. |
NH05 | Transaction in process. |
DC06 | Parameter invalid. |
DC09 | Parameter invalid. |
DC10 | Order payment status is not appropriate. |
DC48 | Parameter invalid. |
DC49 | Parameter invalid. |
DG19 | Failed in cancellation as customer is issuing receipt for payment. |
DH15 | Failed in transaction. |
Sales process
vresult_code the first 4 digits | Reason |
---|---|
NH18 | The order of specified Order Id was already captured. |
NH02 | The order of specified Order Id was already cancelled. |
NH05 | Transaction in process. |
AC38 | Amount specified by parameter is out of range. |
NH40 | Order id is already used in other service. |
Cancellation of payment
vresult_code the first 4 digits | Reason |
---|---|
NH18 | The order of specified Order Id was already cancelled. |
NH02 | Invalid Transaction. |
NH05 | Transaction in process. |
AC38 | Amount specified by parameter is out of range. |
DG19 | Failed in cancellation as customer is issuing receipt for payment. |
DC10 | Order payment status is not appropriate. |
3-D Secure
vresult_code the first 4 digits | Reason |
---|---|
GC** | Invalid parameter. |
GE** | 3-D Secure is not possible or failure. * Please refer [3-D Secure Payment] document. |
- Prev:< [Testing Air-Direct]
- Next:[3-D Secure Payment] >