はじめに

API エンドポイント
- https://api.veritrans.co.jp/vtdirect
各APIのパス
- /v2/veritrans.min.js
- /v2/charges
- /v2/capture
- /v2/void
- /v2/search
- /v2/account
- /v2/account_card
- /v2/account_charges
- /v2/entry_with_charges
- /v2/mpi_charges
- /v2/entry_with_mpi_charges
- /v2/account_mpi_charges
- /v2/tokens
- /v2/cvs
用語集
- マーチャント
- 3G-Directをご利用される事業者様を指します。
- マーチャントサイト
- 事業者様が運営される3G-Direct利用サイトのことを指します。
- MAP
- 当社が提供する、マーチャント様向けの取引管理サイトのことを指します。
3G-Directで実施した決済はMAPにて取引検索を行うことで確認ができます。
- API
- 3G-Directが提供するWeb APIを指します。
3G-Directの各機能は別々のURIに分かれており、利用したい機能のURIに対して、HTTPヘッダに認証情報、BODY部にパラメータをJSONシリアライズした文字列を指定し、GETやPOSTメソッドで送信することで処理が行われます。
処理結果もJSONで応答されますので、マーチャントサイトにて簡単に処理することが可能です。
- APIライブラリ
- 3G-DirectのAPIにリクエストを送信するためのプログラムライブラリです。
API自体は容易な仕様になっておりますので、APIライブラリを利用せず、マーチャント様で独自に実装いただくことも可能です。
- Client Key
- Tokens APIを利用する際、要求パラメータに含める必要のある認証キー。HTMLやJavaScript上に記述して利用します。
- Server Key
- Tokens APIを除く、各APIを利用するための認証キー。HTTPヘッダにAuthorizationヘッダとして指定して利用します。重要な認証キーであるため、マーチャントサイトのサーバにのみ保存し、外部に漏らさないよう注意してください。
- veritrans.min.js (veritrans.js)
- カード情報を3G-Directに送信し、Token Idを取得するためのJavaScriptプログラムです。
マーチャントサイトのカード情報入力画面にて読み込み、関数にカード情報を渡すことで、ブラウザから3G-Directに直接カード情報が送信されます。
詳しい利用方法についてはveritrans.min.jsを参照ください。
- トークン、Token Id
- Tokens APIにカード情報を送信することで払い出される、英数ハイフンで構成された文字列です。
ランダムな36桁の文字と、クレジットカード番号の上6桁、下4桁で構成されます。Token Idはおよそ1分間有効であり、送信されたカード情報を識別するために必要なパラメータとなります。Charges API等で利用しますが、一度送信すると失効し、再利用できません。
- Order Id
- 3G-Directで決済を行うためには、マーチャントサイトで採番された一意の文字列をOrder Idとして、APIに送信する必要があります。
Order Idは後述のCapture API等で、3G-Directに登録された注文を識別するために必要なパラメータとなりますので、マーチャントサイト様のデータベースにて保存しておく必要があります。 多くの場合、マーチャントサイト側注文データベースのキー値をOrder Idとして利用できます。
- Tokens API
- 3G-Directに一時的にカード情報を保持するためのAPIです。登録されたカード情報を識別するためのToken Idを応答します。
- Charges API
- クレジットカードでの与信または与信同時売上を実施するためのAPIです。
払い出されたToken Id、採番したOrder Id、決済金額の3つが最低限必要なパラメータとなります。
Token Idには有効期限がありますので、veritrans.min.jsにてブラウザがToken Idを取得したら即座にマーチャントサイトに送信し、Charges APIで決済を実施してください。
- Account Id、会員ID
- 3G-Directに会員登録を行うためには、マーチャントサイトで採番された一意の文字列をAccount Idとして、APIに送信する必要があります。
多くの場合、マーチャントサイト側顧客データベースのキー値をAccount Idとして利用できます。
- Card Id、カードID
- 登録済みの会員に対して、カード情報を追加した際に払い出されるIDです。Account IdとCard Idを利用することで、登録済みのカード情報を利用し、カード決済を行うことが可能です。
- 支払種別情報(分割払い用パラメータ)
- ベリトランスと包括契約(収納代行サービス)により利用される場合は、制限がありますので以下の表をご参照ください。
支払方法 セット値 セット値の意味 収納代行サービス契約で
ご利用可能な支払方法VISA/
MASTERJCB AMEX DINERS 一括 10 ○ ○ ○ ○ 指定なし 分割 61Cxx Cは分割回数指定、
xxは回数○ ○ ○ × リボルビング 80 ○ ○ × ○
※一括払いのみ利用可能な加盟店様は、一括以外の支払方法を選択することができません。
※収納代行サービス(旧クレジットオールインワン)ご利用の場合は、分割2回、ボーナス払い、 ボーナス併用払いはご利用できません。あらかじめご了承ください。 また、指定可能な分割回数は、03、05、06、10、12、15、18、20、24回のいずれかとなります。
認証処理
Server Key
Acceptヘッダ、Content-Typeヘッダに加えて、以下のようにAuthorization HTTPヘッダを追加してください。
ヘッダ名 | 値 |
---|---|
Accept | application/json |
Content-Type | application/json |
Authorization | Basic {Server KeyをBase64エンコードした文字列} |
Client Key
詳しくはveritrans.min.jsまたはTokens APIを参照してください。
エラー処理
応答結果を判定するための情報を以下に記載します。
Http Status Code
APIライブラリでは、Http Status Codeが200でなかった場合、例外をスローします。
code
status
message
どのような処理に成功したか、または何が原因で失敗したか、といった情報が含まれます。
errors
messagesに含まれるものと内容は同じですが、パラメータ不備が複数あった場合等は、errorsにString配列で失敗原因が一つずつ格納されます。
タイムアウトについて
応答パターン
code | 意味 |
---|---|
Q000 |
処理が成功した場合。 |
Q001 |
送信パラメータに不備があった場合や、検証ができなかった場合。また、決済が失敗した場合。 |
Q002 |
veritrans.min.jsを利用してTokens APIにカード情報を送信する際、Client Keyが空だった場合。 |
Q099 |
3G-Directにて想定外のエラーが発生した場合。 |
status | 意味 |
---|---|
success |
codeがQ000の場合 |
failure |
codeがQ001の場合 |
fatal |
codeがQ099の場合 |
transaction_type (カード決済) |
意味 |
---|---|
init |
エラー発生時 |
a |
与信 |
ax |
与信(期限切れ) |
ac |
与信売上 |
pa |
売上 |
va,rad,rae |
与信→取消 |
vac,racd,race |
与信売上→取消 |
vpa,rpad,rpae |
売上→取消 |
transaction_type (コンビニ決済) |
意味 |
---|---|
authorize |
申込完了(失敗含む) |
cancel_authorize |
キャンセル済み |
fix_capture |
入金済み |
failureエラーサンプル
failureエラーが発生した場合の応答JSONのサンプルです。
{ "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エラーサンプル
fatalエラーが発生した場合の応答JSONです。
{ "code": "Q099", "status": "fatal", "message": "Fatal error, please contact veriTrans" }
veritrans.min.js
通常はマーチャントサイトに用意したカード情報入力画面にて、入力された情報をveritrans.min.jsのメソッドを利用し、ブラウザから直接Tokens APIに送信します。
読み込み
<script src="https://api.veritrans.co.jp/vtdirect/v2/veritrans.min.js">
カード情報送信
// Client Keyをセット Veritrans.client_key = "Client Key"; function _error(d) { var message = d.message; // 失敗時のナビゲーションを行うコードを記述 } function _success(d) { var token_id = d.data.token_id; // 取得したToken Idをマーチャントサイトに送信するコードを記述 } function _cardSet() { return { "card_number": "カード番号", // 入力されたカード番号をセット "card_exp_month": "有効期限(MM)", // 入力された有効期限(月)をセット "card_exp_year": "有効期限(YYYY)", // 入力された有効期限(年)をセット "card_cvv": "セキュリティコード" // 入力されたセキュリティコードをセット } } // ボタンが押下されたらカード情報を送信するコードを記述 $("button.submit").bind("click", function () { Veritrans.tokenGet(_cardSet, _success, _error); });
クレジットカード決済 (/charges)
Token Idにはおよそ1分間の有効期限があるため、ブラウザからToken Idがマーチャントサイトに送信されたら、即座に本APIを利用してカード決済を実施する必要があります。
Uri
https://api.veritrans.co.jp/vtdirect/v2/charges
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* token_id | Tokens APIによって払い出されたTokenIdを指定する。 |
---|---|
* order_id | 決済ごとにユニークな番号を指定する。利用可能文字は半角英数とハイフン、アンダースコアで100桁以内であること。 |
* gross_amount | 決済金額を1~99999999で指定する。 |
with_capture | 同時売上するかどうかをBooleanで指定する。指定しなかった場合は与信のみ実施する。trueを指定した場合は与信と同時に売上も行う。 |
test_mode | 決済をダミー取引とするかどうかをBooleanで指定する。指定しなかった場 合は本取引となり、ダミー取引とならない。テスト時はtrueを指定すること。 |
memo1 | 取引に関するメモ情報を指定する。100文字以内であること。 |
free_key | 取引に関するキー情報(マーチャント様にて別途管理しているID等)を指定する。半角英数で256桁以内であること。 |
jpo | 支払種別情報(分割払い用パラメータ)を指定する。指定しなかった場合は一括支払となる。 |
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 = "abcdef12-1234-abcd-ef12-abcdef1234ab-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 = 'abcdef12-1234-abcd-ef12-abcdef1234ab-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("abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111"); ChargeResponse response = api.chargeWithToken(input);
リクエストサンプル1
{ "token_id": "abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111", "order_id": "TEST0001", "gross_amount": 1980 }
成功時のレスポンスの内容
{ "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" }
カード決済処理エラー
Charges APIでは以下の記載内容を参考に、応答結果により画面遷移等の制御を実装してください。
mstatus
与信または与信同時売上に成功した場合のみ、successとなります。
mstatus | 意味 |
---|---|
success | 正常終了 |
failure | 異常終了 |
pending | 保留 |
vresult_code
必要に応じてナビゲーションを表示するよう実装してください。
結果コードの一覧は、テスト利用サポートページ の「結果コード一覧」からダウンロードが可能です。
失敗時のレスポンスの内容
Token有効期限切れ
{ "code": "Q001", "status": "failure", "message": "[Token was expired]", "errors": [ "Token was expired" ] }
OrderID重複時
{ "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" ] }
カードエラー
{ "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" ] }
会員管理
会員登録 (/account)
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* account_id | マーチャントサイト側会員の識別ID(マーチャントが採番したもの)を指定する。利用可能文字は半角英数とドット、アットマーク、ハイフン、アンダースコアで100桁以内であること。 |
---|---|
test_mode | リクエストをダミーとするかどうかをBooleanで指定する。テスト時はtrueを指定すること。 |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new VtDirect\Client\Request\Account\CreateAccountParameter(); $input->account_id = "TestAccount0001"; $api = new VtDirect\Client\Account($setting); $response = $api->CreateAccount($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::Account::CreateAccountParameter.new input.account_id = 'TestAccount0001' api = VtDirect::Account.new setting response = api.create_account input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); AccountRequest input = new AccountRequest(); input.setAccountId("TestAccount0001"); Account api = new Account(clientConfiguration); AccountCreateResponse response = api.createAccount(input);
リクエストサンプル
{ "account_id": "TestAccount0001" }
成功時のレスポンスの内容
{ "data": { "account_id": "TestAccount0001" }, "mstatus": "success", "vresult_code": "X001000000000000", "code": "Q000", "status": "success", "message": "Account add request was successful" }
失敗時のレスポンスの内容
登録済みの会員IDを指定
{ "mstatus": "failure", "vresult_code": "XH11000000000000", "code": "Q001", "status": "failure", "message": "[Registered account error]", "errors": [ "Registered account error" ] }
削除済みの会員IDを指定
{ "mstatus": "failure", "vresult_code": "XH12000000000000", "code": "Q001", "status": "failure", "message": "[Withdrew account error]", "errors": [ "Withdrew account error" ] }
会員削除 (/account)
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* account_id | 対象の会員IDを指定する。 |
---|---|
test_mode | リクエストをダミーとするかどうかをBooleanで指定する。テスト時はtrueを指定すること。 |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new VtDirect\Client\Request\Account\DeleteAccountParameter(); $input->account_id = "TestAccount0001"; $api = new VtDirect\Client\Account($setting); $response = $api->DeleteAccount($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::Account::DeleteAccountParameter.new input.account_id = 'TestAccount0001' api = VtDirect::Account.new setting response = api.delete_account input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); AccountRequest input = new AccountRequest(); input.setAccountId("TestAccount0001"); Account api = new Account(clientConfiguration); AccountDeleteResponse response = api.deleteAccount(input);
リクエストサンプル
"https://api.veritrans.co.jp/vtdirect/v2/account?account_id=TestAccount0001"
成功時のレスポンスの内容
{ "data": { "account_id": "TestAccount0001" }, "mstatus": "success", "vresult_code": "X001000000000000", "code": "Q000", "status": "success", "message": "Account delete request was successful" }
失敗時のレスポンスの内容
削除済みの会員IDを指定した場合
{ "mstatus": "failure", "vresult_code": "XH12000000000000", "code": "Q001", "status": "failure", "message": "[Withdrew account error]", "errors": [ "Withdrew account error" ] }
会員情報取得 (/account)
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* account_id | 対象の会員IDを指定する。 |
---|---|
test_mode | リクエストをダミーとするかどうかをBooleanで指定する。テスト時はtrueを指定すること。 |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new VtDirect\Client\Request\Account\GetAccountInfoParameter(); $input->account_id = "TestAccount0001"; $api = new VtDirect\Client\Account($setting); $response = $api->GetAccountInfo($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::Account::GetAccountInfoParameter.new input.account_id = 'TestAccount0001' api = VtDirect::Account.new setting response = api.get_account_info input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); AccountRequest input = new AccountRequest(); input.setAccountId("TestAccount0001"); Account api = new Account(clientConfiguration); AccountInfoResponse response = api.getAccountInfo(input);
リクエストサンプル
"https://api.veritrans.co.jp/vtdirect/v2/account?account_id=TestAccount0001"
成功時のレスポンスの内容
{ "data": { "account_id": "TestAccount0001", "cards": [ { "card_brand": "VISA", "card_number": "411111********11", "card_id": "ABCDE123456789ABCDEFGHIJK", "card_expire": "08/2015" } ] }, "mstatus": "success", "vresult_code": "X001000000000000", "code": "Q000", "status": "success", "message": "Card information query was successful" }
カードが未登録の場合
{ "data": { "account_id": "TestAccount0001", "cards": [] }, "mstatus": "success", "vresult_code": "X001000000000000", "code": "Q000", "status": "success", "message": "Card information query was successful" }
失敗時のレスポンスの内容
削除済みの会員IDを指定した場合
{ "mstatus": "failure", "vresult_code": "XH12000000000000", "code": "Q001", "status": "failure", "message": "[Withdrew account error]", "errors": [ "Withdrew account error" ] }
カード登録 (/account_card)
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* token_id | Tokens APIによって払い出されたTokenIdを指定する。 |
---|---|
* account_id | カードを追加するAccount Idを指定する。 |
test_mode | リクエストをダミーとするかどうかをBooleanで指定する。テスト時はtrueを指定すること。 |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new VtDirect\Client\Request\Account\Card\AddParameter(); $input->account_id = "TestAccount0002"; $input->token_id = "abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111"; $api = new VtDirect\Client\AccountCard($setting); $response = $api->AddCard($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::Account::Card::AddParameter.new input.account_id = 'TestAccount0001' input.token_id = 'abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111' api = VtDirect::AccountCard.new setting response = api.add_card input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); AccountCardRequest input = new AccountCardRequest(); input.setAccountId("TestAccount0002"); input.setTokenId("abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111"); AccountCard api = new AccountCard(clientConfiguration); AccountCardAddResponse response = api.addCard(input);
リクエストサンプル
{ "account_id": "TestAccount0002", "token_id": "abcdef12-1234-abcd-ef12-abcdef1234ab-555555-4444" }
成功時のレスポンスの内容
{ "data": { "account_id": "TestAccount0002", "card_brand": "MASTER", "card_number": "555555********44", "card_expire": "08/2015", "card_id": "ABCDE123456789ABCDEFGHIJK" }, "mstatus": "success", "vresult_code": "X001000000000000", "code": "Q000", "status": "success", "message": "Request to register the card information to the account was successful" }
失敗時のレスポンスの内容
登録済みのカードを再度登録しようとした場合
{ "data": { "account_id": "TestAccount0002" }, "mstatus": "failure", "vresult_code": "XH04000000000000", "code": "Q001", "status": "failure", "message": "[Duplicate registration error]", "errors": [ "Duplicate registration error" ] }
有効期限切れのTokenIdを指定した場合
{ "code": "Q001", "status": "failure", "message": "[Token was expired]", "errors": [ "Token was expired" ] }
カードの有効性チェックで失敗した場合
{ "data": { "account_id": "TestAccount0002" }, "mstatus": "failure", "vresult_code": "XH41000000000000", "code": "Q001", "status": "failure", "message": "[Internal card authorization error]", "errors": [ "Internal card authorization error" ] }
カード削除 (/account_card)
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* account_id | 対象の会員IDを指定する。 |
---|---|
* card_id | 対象のカードIDを指定する。 |
test_mode | リクエストをダミーとするかどうかをBooleanで指定する。テスト時はtrueを指定すること。 |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new VtDirect\Client\Request\Account\Card\DeleteParameter(); $input->account_id = "TestAccount0002"; $input->card_id = "ABCDE123456789ABCDEFGHIJK"; $api = new VtDirect\Client\AccountCard($setting); $response = $api->DeleteCard($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::Account::Card::DeleteParameter.new input.account_id = 'TestAccount0002' input.card_id = 'ABCDE123456789ABCDEFGHIJK' api = VtDirect::AccountCard.new setting response = api.delete_card input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); AccountCardRequest input = new AccountCardRequest(); input.setAccountId("TestAccount0002"); input.setCardId("ABCDE123456789ABCDEFGHIJK"); AccountCard api = new AccountCard(clientConfiguration); AccountCardDeleteResponse response = api.deleteCard(input);
リクエストサンプル
"https://api.veritrans.co.jp/vtdirect/v2/account_card?account_id=TestAccount0002&card_id=ABCDE123456789ABCDEFGHIJK"
成功時のレスポンスの内容
{ "data": { "account_id": "TestAccount0002" }, "mstatus": "success", "vresult_code": "X001000000000000", "code": "Q000", "status": "success", "message": "Request to delete card from account was successful" }
失敗時のレスポンスの内容
削除済みのカードIDを指定した場合
{ "data": { "account_id": "TestAccount0002" }, "mstatus": "failure", "vresult_code": "XH05000000000000", "code": "Q001", "status": "failure", "message": "[Deleted error]", "errors": [ "Deleted error" ] }
未登録のカードIDを指定した場合
{ "data": { "account_id": "TestAccount0002" }, "mstatus": "failure", "vresult_code": "XH09000000000000", "code": "Q001", "status": "failure", "message": "[Unregistered card error]", "errors": [ "Unregistered card error" ] }
会員決済 (/account_charges)
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* order_id | 決済ごとにユニークな番号を指定する。利用可能文字は半角英数とハイフン、アンダースコアで100桁以内であること。 |
---|---|
* account_id | 登録済みのAccount Idを指定する。 |
* card_id | 会員に登録済みのCard Idを指定する。 |
* gross_amount | 決済金額を1~99999999で指定する。 |
with_capture | 同時売上するかどうかをBooleanで指定する。指定しなかった場合は与信のみ実施する。trueを指定した場合は与信と同時に売上も行う。 |
test_mode | 決済をダミー取引とするかどうかをBooleanで指定する。指定しなかった場 合は本取引となり、ダミー取引とならない。テスト時はtrueを指定すること。 |
memo1 | 取引に関するメモ情報を指定する。100文字以内であること。 |
free_key | 取引に関するキー情報(マーチャント様にて別途管理しているID等)を指定する。半角英数で256桁以内であること。 |
jpo | 支払種別情報(分割払い用パラメータ)を指定する。指定しなかった場合は一括支払となる。 |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new VtDirect\Client\Request\Account\AccountChargesParameter(); $input->order_id = "TEST1002"; $input->account_id = "TestAccount0002"; $input->card_id = "ABCDE123456789ABCDEFGHIJK"; $input->gross_amount = 1980; $api = new VtDirect\Client\AccountCharges($setting); $response = $api->ChargeWithCardId($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::Account::AccountChargesParameter.new input.order_id = 'Test1002' input.account_id = 'TestAccount0002' input.card_id = 'ABCDE123456789ABCDEFGHIJK' input.gross_amount = 1980 api = VtDirect::AccountCharges.new setting response = api.charge_with_card_id input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); AccountChargeRequest input = new AccountChargeRequest(); input.setAccountId("TestAccount0002"); input.setCardId("ABCDE123456789ABCDEFGHIJK"); input.setOrderId("TEST1002"); input.setGrossAmount(1980); AccountCharges api = new AccountCharges(clientConfiguration); AccountChargeResponse response = api.chargeWithCardId(input);
リクエストサンプル
{ "order_id": "TEST1002", "account_id": "TestAccount0002", "card_id": "ABCDE123456789ABCDEFGHIJK", "gross_amount": 1980, }
成功時のレスポンスの内容
{ "data": { "order_id": "TEST1002", "gross_amount": 1980, "account_id": "TestAccount0002", "card_number": "555555********44", "card_expire": "08/2015", "card_brand": "MASTER", "card_id": "ABCDE123456789ABCDEFGHIJK", "with_capture": false }, "mstatus": "success", "vresult_code": "A001H001X0010000", "transaction_type": "a", "pending": "0", "acquirer_code": "05", "trad_url": "https://www.example.com/abcde;fghij;klmno", "code": "Q000", "status": "success", "message": "Registered account charge transaction was successful" }
失敗時のレスポンスの内容
未登録のカードIDを指定した場合
{ "data": { "order_id": "TEST1003", "gross_amount": 1980, "card_brand": "", "with_capture": false }, "mstatus": "failure", "vresult_code": "AC22XH0900000000", "code": "Q001", "status": "failure", "message": "[Parameter Error, Unregistered card error]", "errors": [ "Parameter Error", "Unregistered card error" ] }
会員登録同時決済 (/entry_with_charges)
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* order_id | 決済ごとにユニークな番号を指定する。利用可能文字は半角英数とハイフン、アンダースコアで100桁以内であること。 |
---|---|
* account_id | マーチャントサイト側会員の識別ID(マーチャントが採番したもの)を指定する。利用可能文字は半角英数とドット、アットマーク、ハイフン、アンダースコアで100桁以内であること。 |
* token_id | Tokens APIによって払い出されたTokenIdを指定する。 |
* gross_amount | 決済金額を1~99999999で指定する。 |
with_capture | 同時売上するかどうかをBooleanで指定する。指定しなかった場合は与信のみ実施する。trueを指定した場合は与信と同時に売上も行う。 |
test_mode | 決済をダミー取引とするかどうかをBooleanで指定する。指定しなかった場 合は本取引となり、ダミー取引とならない。テスト時はtrueを指定すること。 |
memo1 | 取引に関するメモ情報を指定する。100文字以内であること。 |
free_key | 取引に関するキー情報(マーチャント様にて別途管理しているID等)を指定する。半角英数で256桁以内であること。 |
jpo | 支払種別情報(分割払い用パラメータ)を指定する。指定しなかった場合は一括支払となる。 |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new VtDirect\Client\Request\Account\EntryWithChargesParameter(); $input->order_id = "TEST1001"; $input->account_id = "TestAccount0003"; $input->token_id = "abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111"; $input->gross_amount = 1980; $api = new VtDirect\Client\EntryWithCharges($setting); $response = $api->ChargeWithEntry($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::Account::EntryWithChargesParameter.new input.order_id = 'TEST1001' input.account_id = 'TestAccount0003' input.token_id = 'abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111' input.gross_amount = 1980 api = VtDirect::EntryWithCharges.new setting response = api.charge_with_entry input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); EntryWithChargeRequest input = new EntryWithChargeRequest(); input.setOrderId("TEST1001"); input.setAccountId("TestAccount0003"); input.setTokenId("abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111"); input.setGrossAmount(1980); EntryWithCharges api = new EntryWithCharges(clientConfiguration); EntryWithChargeResponse response = api.chargeWithEntry(input);
リクエストサンプル
{ "account_id": "TestAccount0003", "token_id": "abcdef12-1234-abcd-ef12-abcdef1234ab-555555-4444", "order_id": "TEST1001", "gross_amount": 1980 }
成功時のレスポンスの内容
{ "data": { "order_id": "TEST1001", "gross_amount": 1980, "account_id": "TestAccount0003", "card_number": "555555********44", "card_id": "ABCDE123456789ABCDEFGHIJK", "card_expire": "08/2015", "card_brand": "MASTER", "with_capture": false }, "mstatus": "success", "vresult_code": "A001H001X0010000", "transaction_type": "a", "pending": "0", "acquirer_code": "05", "trad_url": "https://www.example.com/abcde;fghij;klmno", "code": "Q000", "status": "success", "message": "Add account and charge transaction was successful" }
失敗時のレスポンスの内容
与信に失敗した場合
{ "data": { "order_id": "TEST1001", "gross_amount": 1980, "card_brand": "", "with_capture": false }, "mstatus": "failure", "vresult_code": "AG72000000000000", "transaction_type": "init", "acquirer_code": "02", "code": "Q001", "status": "failure", "message": "[Card Error]", "errors": [ "Card Error" ] }
本人認証
下記APIの応答結果にて、statusがsuccessだった場合はresponse_contentsを印字し、ブラウザを本人認証フローにリダイレクトさせてください。
本人認証決済 (/mpi_charges)
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* order_id | 決済ごとにユニークな番号を指定する。利用可能文字は半角英数とハイフン、アンダースコアで100桁以内であること。 |
---|---|
* token_id | Tokens APIによって払い出されたTokenIdを指定する。 |
* gross_amount | 決済金額を1~99999999で指定する。 |
* service_option_type | 次のどれかを指定する。 "mpi-complete":完全認証 "mpi-company":通常認証(カード会社リスク負担) "mpi-merchant":通常認証(カード会社、加盟店リスク負担) |
push_uri | 本人認証結果Push通知の送信先マーチャントサイトURLを指定する。半角256桁以内であること。 |
* redirection_uri | ブラウザの戻り先マーチャントサイトURLを指定する。半角256桁以内であること。 |
* http_user_agent | ブラウザのHTTP User-Agentヘッダを指定する。 |
* http_accept | ブラウザのHTTP Acceptヘッダを指定する。 |
with_capture | 同時売上するかどうかをBooleanで指定する。指定しなかった場合は与信のみ実施する。trueを指定した場合は与信と同時に売上も行う。 |
test_mode | 決済をダミー取引とするかどうかをBooleanで指定する。指定しなかった場 合は本取引となり、ダミー取引とならない。テスト時はtrueを指定すること。 |
memo1 | 取引に関するメモ情報を指定する。100文字以内であること。 |
free_key | 取引に関するキー情報(マーチャント様にて別途管理しているID等)を指定する。半角英数で2560桁以内であること。 |
jpo | 支払種別情報(分割払い用パラメータ)を指定する。指定しなかった場合は一括支払となる。 |
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);
リクエストサンプル
{ "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, */*" }
成功時のレスポンスの内容
{ "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 ....(省略", "res_corporation_id": "05", "res_brand_id": "5" }, "mstatus": "success", "vresult_code": "G001H00100000000", "code": "Q000", "status": "success", "message": "mpi authorize request was successful" }
失敗時のレスポンスの内容
本人認証実行不可(イシュアまたは会員が未参加)
{ "mstatus": "failure", "vresult_code": "GE02000000000000", "code": "Q001", "status": "failure", "message": "[Cannot perform the authentication]", "errors": [ "Cannot perform the authentication" ] }
会員登録登録本人認証決済 (/entry_with_mpi_charges)
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* order_id | 決済ごとにユニークな番号を指定する。利用可能文字は半角英数とハイフン、アンダースコアで100桁以内であること。 |
---|---|
* token_id | Tokens APIによって払い出されたTokenIdを指定する。 |
* account_id | マーチャントサイト側会員の識別ID(マーチャントが採番したもの)を指定する。利用可能文字は半角英数とドット、アットマーク、ハイフン、アンダースコアで100桁以内であること。 |
* gross_amount | 決済金額を1~99999999で指定する。 |
* service_option_type | 次のどれかを指定する。 "mpi-complete":完全認証 "mpi-company":通常認証(カード会社リスク負担) "mpi-merchant":通常認証(カード会社、加盟店リスク負担) |
push_uri | 本人認証結果Push通知の送信先マーチャントサイトURLを指定する。半角256桁以内であること。 |
* redirection_uri | ブラウザの戻り先マーチャントサイトURLを指定する。半角256桁以内であること。 |
* http_user_agent | ブラウザのHTTP User-Agentヘッダを指定する。 |
* http_accept | ブラウザのHTTP Acceptヘッダを指定する。 |
with_capture | 同時売上するかどうかをBooleanで指定する。指定しなかった場合は与信のみ実施する。trueを指定した場合は与信と同時に売上も行う。 |
test_mode | 決済をダミー取引とするかどうかをBooleanで指定する。指定しなかった場 合は本取引となり、ダミー取引とならない。テスト時はtrueを指定すること。 |
memo1 | 取引に関するメモ情報を指定する。100文字以内であること。 |
free_key | 取引に関するキー情報(マーチャント様にて別途管理しているID等)を指定する。半角英数で256桁以内であること。 |
jpo | 支払種別情報(分割払い用パラメータ)を指定する。指定しなかった場合は一括支払となる。 |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new VtDirect\Client\Request\Account\EntryWithMpiChargesParameter(); $input->token_id = "abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111"; $input->order_id = "TEST1007"; $input->account_id = "TestAccount0004"; $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\EntryWithMpiCharges($setting); $response = $api->EntryWithMpiCharge($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::Account::EntryWithChargesParameter.new input.token_id = 'abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111' input.order_id = 'TEST1007' input.account_id = 'TestAccount0004' 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::EntryWithMpiCharges.new setting response = api.entry_with_mpi_charge input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); EntryWithMpiChargeRequest input = new EntryWithMpiChargeRequest(); input.setTokenId("abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111"); input.setOrderId("TEST1010"); input.setAccountId("TestAccount0004"); input.setGrossAmount(1980); input.setServiceOptionType("mpi-company"); 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"); EntryWithMpiCharges api = new EntryWithMpiCharges(clientConfiguration); MpiChargeResponse response = api.entryWithMpiCharge(input);
リクエストサンプル
{ "token_id": "abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111", "order_id": "TEST1007", "account_id": "TestAccount0004", "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, */*" }
成功時のレスポンスの内容
{ "data": { "order_id": "TEST1007", "account_id": "TestAccount0004", "gross_amount": 1980, "with_capture": false, "service_option_type": "mpi-complete", "response_contents": "\u003c!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 ....(省略", "res_corporation_id": "05", "res_brand_id": "5" }, "mstatus": "success", "vresult_code": "G001H00100000000", "code": "Q000", "status": "success", "message": "mpi authorize request was successful" }
会員本人認証決済 (/account_mpi_charges)
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* order_id | 決済ごとにユニークな番号を指定する。利用可能文字は半角英数とハイフン、アンダースコアで100桁以内であること。 |
---|---|
* token_id | Tokens APIによって払い出されたTokenIdを指定する。 |
* account_id | 対象の会員IDを指定する。 |
* card_id | 登録済みのカードIDを指定する。 |
* gross_amount | 決済金額を1~99999999で指定する。 |
* service_option_type | 次のどれかを指定する。 "mpi-complete":完全認証 "mpi-company":通常認証(カード会社リスク負担) "mpi-merchant":通常認証(カード会社、加盟店リスク負担) |
push_uri | 本人認証結果Push通知の送信先マーチャントサイトURLを指定する。半角256桁以内であること。 |
* redirection_uri | ブラウザの戻り先マーチャントサイトURLを指定する。半角256桁以内であること。 |
* http_user_agent | ブラウザのHTTP User-Agentヘッダを指定する。 |
* http_accept | ブラウザのHTTP Acceptヘッダを指定する。 |
with_capture | 同時売上するかどうかをBooleanで指定する。指定しなかった場合は与信のみ実施する。trueを指定した場合は与信と同時に売上も行う。 |
test_mode | 決済をダミー取引とするかどうかをBooleanで指定する。指定しなかった場 合は本取引となり、ダミー取引とならない。テスト時はtrueを指定すること。 |
memo1 | 取引に関するメモ情報を指定する。100文字以内であること。 |
free_key | 取引に関するキー情報(マーチャント様にて別途管理しているID等)を指定する。半角英数で256桁以内であること。 |
jpo | 支払種別情報(分割払い用パラメータ)を指定する。指定しなかった場合は一括支払となる。 |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new VtDirect\Client\Request\Account\AccountMpiChargesParameter(); $input->order_id = "TEST1008"; $input->account_id = "TestAccount0004"; $input->card_id = "ABCDE123456789ABCDEFGHIJK"; $input->gross_amount = 1980; $input->service_option_type = "mpi-merchant"; $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\AccountMpiCharges($setting); $response = $api->AccountMpiCharge($input);
Ruby code
setting = VtDirect::Setting.new setting.server_key = 'aaaaaaaa-1111-ffff-bbbb-000000000000' input = VtDirect::Request::Account::AccountMpiChargesParameter.new input.order_id = 'TEST1008' input.account_id = 'TestAccount0004' input.card_id = 'ABCDE123456789ABCDEFGHIJK' 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::AccountMpiCharges.new setting response = api.account_mpi_charge input
Java code
ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); AccountMpiChargeRequest input = new AccountMpiChargeRequest(); input.setOrderId("TEST1011"); input.setAccountId("TestAccount0004"); input.setCardId("ABCDE123456789ABCDEFGHIJK"); input.setGrossAmount(1980); input.setServiceOptionType("mpi-merchant"); 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"); AccountMpiCharges api = new AccountMpiCharges(clientConfiguration); MpiChargeResponse response = api.accountMpiCharge(input);
リクエストサンプル
{ "order_id": "TEST1008", "account_id": "TestAccount0004", "card_id": "ABCDE123456789ABCDEFGHIJK", "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, */*" }
成功時のレスポンスの内容
{ "data": { "order_id": "TEST1008", "account_id": "TestAccount0004", "gross_amount": 1980, "with_capture": false, "service_option_type": "mpi-complete", "response_contents": "\u003c!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 ....(省略", "res_corporation_id": "05", "res_brand_id": "5" }, "mstatus": "success", "vresult_code": "G001H00100000000", "code": "Q000", "status": "success", "message": "mpi authorize request was successful" }
売上処理 (/capture)
与信取得時の金額で売上が行われます。
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* order_id | Charges APIにて与信を行った際に指定したOrder Idを指定する。 |
---|---|
amount | 売上金額を与信時の金額以下の数値で指定する。未指定時は与信金額が売上金額となる。 |
memo1 | 取引に関するメモ情報を指定する。100文字以内であること。 |
free_key | 取引に関するキー情報(マーチャント様にて別途管理しているID等)を指定する。半角英数で256桁以内であること。 |
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 clientConfiguration = new ClientConfiguration(); clientConfiguration.setServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); CaptureRequest input = new CaptureRequest(); input.setOrderId("TEST0050"); Capture api = new Capture(clientConfiguration); CaptureResponse response = api.captureOrder(input);
リクエストサンプル
{ "order_id": "TEST0001" }
成功時のレスポンスの内容
正常時
{ "data": { "order_id": "TEST0001", "transaction_status": "capture" }, "vresult_code": "A001000000000000", "code": "Q000", "status": "success", "message": "Success do capture transaction" }
失敗時のレスポンスの内容
2回Captureしようとした場合
{ "vresult_code": "NH18000000000000", "code": "Q001", "status": "failure", "message": "[This order is already captured]", "errors": [ "This order is already captured" ] }
キャンセル済みの注文をCaptureしようとした場合
{ "vresult_code": "NH02000000000000", "code": "Q001", "status": "failure", "message": "[Order invalid]", "errors": [ "Order invalid" ] }
存在しない注文をCaptureしようとした場合
{ "code": "Q001", "status": "failure", "message": "[Order not found]", "errors": [ "Order not found" ] }
決済トランザクション情報取得 (/search)
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文
本人認証結果取得時はRequest Idのみ指定、それ以外の場合はOrder Idのみ指定するorder_id | 決済トランザクション情報を取得する対象の注文のOrder Idを指定する。 |
---|---|
request_id | 本人認証結果を取得するためのキー項目であるRequest Idを指定する。 |
test_mode | ダミー取引を検索する場合はTrueを指定する。 |
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 setting 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);
リクエストサンプル
"https://api.veritrans.co.jp/vtdirect/v2/search?order_id=TEST0011"
成功時のレスポンスの内容
正常時
{ "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" }
失敗時のレスポンスの内容
存在しないオーダーIDを指定した場合
{ "vresult_code": "N001000000000000", "mstatus": "success", "code": "Q001", "status": "failure", "message": "[such an order was not found]", "errors": ["such an order was not found"] }
決済のキャンセル (/void)
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* order_id | キャンセルを行う注文のOrder Idを指定する。 |
---|---|
amount | カード売上の一部キャンセル金額を指定する。売上金額以下の数値を指定する必要がある。未指定時は全額取消となる。 |
memo1 | 取引に関するメモ情報を指定する。100文字以内であること。 |
free_key | 取引に関するキー情報(マーチャント様にて別途管理しているID等)を指定する。半角英数で256桁以内であること。 |
PHP code
$setting = new \VtDirect\Client\Setting(); $setting->SetServerKey("aaaaaaaa-1111-ffff-bbbb-000000000000"); $input = new \VtDirect\Client\Request\VoidParameter(); $input->order_id = "TEST0011"; $api = new \VtDirect\Client\Cancel($setting); $response = $api->VoidOrder($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);
リクエストサンプル
{ "order_id": "TEST0002" }
成功時のレスポンスの内容
正常時
{ "data": { "order_id": "TEST0002", "transaction_status": "cancel" }, "vresult_code": "A001000000000000", "code": "Q000", "status": "success", "message": "Success do void transaction" }
失敗時のレスポンスの内容
キャンセル済みの注文をキャンセル
{ "vresult_code": "NH18000000000000", "code": "Q001", "status": "failure", "message": "[This order is already cancelled]", "errors": [ "This order is already cancelled" ] }
トークン発行 (/tokens)
通常はveritrans.min.jsにより、ブラウザから本APIにカード情報が送信されますので、マーチャントサイト側プログラムから本APIを利用することはありません。
Uri
リクエストパラメータ
リクエスト本文 *…必須
* card_cvv | セキュリティコードを指定する。3~4ケタ数字。 |
---|---|
* card_exp_month | カード有効期限の月を指定する。2桁数字。 |
* card_exp_year | カード有効期限の年を指定する。4桁数字。 |
* card_number | カード番号を指定する。 |
* client_key | Client Keyを指定する。 |
callback | veritrans.min.jsから本APIが呼び出された場合は自動的に値がセットされ、応答形式がJSONPになります。callbackを指定しない場合は、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);
※上記コードはマーチャントサイト側での実装サンプルですが、Tokens APIは原則としてveritrans.min.jsから利用されるAPIとなります。
リクエストサンプル
"https://api.veritrans.co.jp/vtdirect/v2/tokens?card_number=4111111111111111&card_exp_month=08&card_exp_year=2015&card_cvv=123&client_key=bbbbbbbb-2222-cccc-3333-eeeeeeeeeeee&callback=json1"
成功時のレスポンスの内容
{ "data": { "token_id": "abcdef12-1234-abcd-ef12-abcdef1234ab-411111-1111" }, "code": "Q000", "status": "success", "message": "Success request new token" }
※正常にTokenIdが払い出された場合は、token_idの最後にカード番号の上6桁と下4桁が付与されます。
失敗時のレスポンスの内容
client_keyが正しくない
{ "code": "Q001", "status": "failure", "message": "[Cannot find merchant]", "errors": [ "Cannot find merchant" ] }
card_numberの書式が正しくない
{ "code": "Q001", "status": "failure", "message": "[Invalid card number]", "errors": [ "Invalid card number" ] }
コンビニ決済 (/cvs)
Uri
リクエストパラメータ
リクエストヘッダ
Accept | application/json |
---|---|
Content-Type | application/json |
Authorization | Basic {base64encoded_server_key} {base64encoded_server_key}には、Base64エンコードしたServer Keyを指定する。 |
リクエスト本文 *…必須
* option_type |
"sej" : セブン-イレブン "econ" : ローソン、ファミリーマート、サークルKサンクス、ミニストップ、セイコーマート "other" : その他(デイリーヤマザキ) |
---|---|
* order_id | 決済ごとにユニークな番号を指定する。利用可能文字は半角英数とハイフン、アンダースコアで100桁以内であること。 |
* gross_amount | 決済金額を1~300000で指定する。 |
* tel | 顧客電話番号を半角数字10~11桁で指定する。ハイフンは不可。固定値としないこと。 |
* name1 | 顧客姓を全角20バイトで指定する。利用可能な文字は以下の通り。 長音符 ー 同の字点 々 一の字点 ヽ ヾ ゝ ゞ ノノ字点 〃 しめ 〆 数字・アルファベット、平仮名、カタカナ、第一水準漢字、第二水準漢字 ※全角は2バイト換算となります |
* name2 | 顧客名を全角20バイトで指定する。利用可能な文字はname1パラメータと同様。 |
pay_limit | 支払有効期限を半角数字8桁、yyyymmddの形式で指定する。 option_typeパラメータに"sej"を指定した場合は当日~150日後を指定可能。 "econ"を指定した場合は当日~60日後を指定可能。 未指定の場合は既定値が利用される。 |
test_mode | 決済をダミー取引とするかどうかをBooleanで指定する。指定しなかった場 合は本取引となり、ダミー取引とならない。テスト時はtrueを指定すること。 |
memo1 | 取引に関するメモ情報を指定する。100文字以内であること。 |
free_key | 取引に関するキー情報(マーチャント様にて別途管理しているID等)を指定する。半角英数で256桁以内であること。 |
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 = 'テスト'; $input->name2 = 'タロウ'; $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' input = VtDirect::Request::CvsParameter.new input.order_id = 'TEST0041' input.gross_amount = 1980 input.name1 = 'テスト' input.name2 = 'タロウ' 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("テスト"); input.setName2("タロウ"); input.setOptionType("sej"); input.setTel("09000000000"); // 固定値不可 Cvs api = new Cvs(clientConfiguration); CvsResponse response = api.paymentAtCvs(input);
リクエストサンプル
{ "order_id": "TEST0013", "tel": "0900000000", "name1": "テスト", "name2": "タロウ", "gross_amount": 1980, "option_type": "sej" }
入金通知
通知先URLは各種URL変更より確認ください。
パラメータ | 詳細 |
---|---|
numberOfNotify | 通知数 1回の入金完了情報に含まれる通知件数は最大1000件 1001件以上は次回通知となる |
pushTime | 通知した日時(YYYYMMDDhhmmss) |
pushId | 通知が送信されるたびに採番されるID 最大8文字 |
通知件数分下記の項番を繰り返す。尚、フィールド名の後ろに4ケタの連番(0000~0999)を付与する。 | |
orderId | 注文申込時に指定されたOrder Id 最大100文字 |
cvsType | 支払を行ったコンビニの識別文字列 "sej":セブン-イレブン "econ-lw" : ローソン "econ-fm" : ファミリーマート "econ-mini" : ミニストップ "econ-other" : セイコーマート ※option_typeとして"econ"を指定したダミー取引の場合は"econ-lw"固定となる。 "other" : デイリーヤマザキ |
receiptNo | 受付番号文字列 半角英数記号で最大32文字 |
receiptDate | 支払完了日(YYYYMMDDhhmmss) |
rcvAmount | 入金金額 数値で最大6桁 |
dummy | ダミー取引の場合は"1" |
成功時のレスポンスの内容
{ "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ライブラリ
PHP
3G-Direct-php
PHP 5.4以降対応。PHPのcURLモジュールにてSSL通信が可能である必要があります。
Ruby
3G-Direct-ruby
Ruby 2.0以降対応。依存するRubyGemをBundlerでインストールする必要があります。
Java
3G-Direct-java
JDK1.7対応。依存するライブラリをMavenでインストールする必要があります。一部のクラスにGroovyを利用しています。
- Prev:< [稼働確認]を見る