Source (ソース) API
Source(ソース)APIを使用すると、決済ソースを作成および取得することができます。 ソースとは、Charge APIを使用して、クレジットカード以外のチャネル (Alipay、コンビニエンスストア決済、internet banking(ネットバンク、installment payments(分割払い)を含む)を通して決済を受け入れる方法です。 新しいソースは、公開鍵(パブリックキー)のみを使用し作成できます。
Attributes
| Name | Type | Description |
|---|---|---|
| object | string | 固定値 |
| id | string |
|
| livemode | boolean | 本番モード ( |
| location | string | 現在の |
| absorption_type | string | 分割払い使用時に誰が利息を負担するかを決定する。 |
| amount | integer | smallest currency unit(最小通貨単位)で表したソースの金額 |
| bank | string | 金融機関 (type=fpx) |
| barcode | string | バーコード番号 ( |
| billing | object | 請求先住所。詳細はソース作成パラメーターを参照してください。 |
| charge_status | string | 該当する場合)このソースを使用して作られた課金のステータス。 値は次のいずれかになります。charge.status の値、または、課金が作成されていない場合は unknown。 |
| created_at | string | ISO 8601形式 ( |
| currency | string | 3文字で表示されるソース通貨[ISO 4217](http://ja.wikipedia.org/wiki/ISO_4217)コード |
| discounts | array | 割引 ( |
| string | ソースに紐づけられたメールアドレス。 ( |
|
| flow | string | 顧客が決済を完了するために使用する決済フロー。 値は次のいずれかになります。: offline:顧客は、オフラインで決済するために決済情報を受け取ります。 例:百貨店での請求書決済。 |
| installment_term | integer | (分割払い使用時のみ) オプションについてはinstallmentsを参照してください |
| ip | string | ソース作成時にOmiseに提供されるIPアドレス。IPv4またはIPv6。 |
| items | array | 注文に含まれるアイテムの詳細。詳細はソース作成パラメーターを参照してください。 |
| mobile_number | string | 顧客の電話番号( |
| name | string | 顧客名 ( |
| phone_number | string | 顧客の電話番号( |
| platform_type | string | 支払者が支払いを行うプラットフォーム。ブラウザ、iOS、Androidのいずれか |
| promotion_code | string | TBD |
| provider_references | object | 決済が正常に処理されたアイテムへの参照を表示します。以下の決済方法が取引参照に表示されます。
他の決済プロバイダーの場合、 |
| qr_settings | object | 応答QRコードのフォーマットと見た目をカスタマイズする設定オブジェクト(type=promptpay)
|
| receipt_amount | integer | 明細書の金額 ( |
| references | object | 支払いに関する参照情報( |
| scannable_code | barcode | バーコードオブジェクト |
| shipping | object | 配送先住所。詳細はソース作成パラメーターを参照してください。 |
| store_id | string | 取引した店舗ID ( |
| store_name | string | 取引した店舗名 ( |
| supplier_id | string | TBD |
| terminal_id | string | 取引で使用したターミナル端末ID ( |
| type | string | ソース決済タイプ |
| zero_interest_installments | boolean | 加盟店が分割払いの支払いに関する利子を負担するかどうか( |
Example
-
JSON Response
{ "object": "source", "id": "src_test_no1t4tnemucod0e51mo", "livemode": false, "location": "/sources/src_test_no1t4tnemucod0e51mo", "amount": 12345, "barcode": "1234567890", "bank": null, "created_at": "2019-12-31T12:59:59Z", "currency": "THB", "email": null, "flow": "offline", "installment_term": null, "absorption_type": null, "name": null, "mobile_number": null, "phone_number": null, "platform_type": null, "scannable_code": null, "qr_settings": null, "billing": null, "shipping": null, "items": [], "references": null, "provider_references": null, "store_id": "store_1", "store_name": "store 1", "terminal_id": "POS-01", "type": "barcode_alipay", "zero_interest_installments": null, "charge_status": "unknown", "receipt_amount": null, "discounts": [], "promotion_code": null }
ソースを作成する
- POST https://api.omise.co/sources新しいソースを作成して返します。 注:この動作は、public and secret key authenticationの両方を受け入れます。 Charge APIを使用し、ソースを直接作成し課金できます。
Request Parameters
| Name | Type | Description |
|---|---|---|
| amount | integer | (必須) smallest currency unit(最小通貨単位)で表したソースの金額 |
| currency | string | (必須) 3文字で表示されるソース通貨[ISO 4217](http://ja.wikipedia.org/wiki/ISO_4217)コード |
| type | string | (必須, one of: |
| bank | string | (任意、 場合によって必須) 金融機関 (type=fpx) |
| barcode | string | (任意、 場合によって必須) バーコード番号 ( |
| billing | object | (任意) (任意) 請求先住所
|
| string | (任意、 場合によって必須) ソースに紐づけられたメールアドレス。 ( |
|
| installment_term | integer | (任意、 場合によって必須) (分割払い使用時のみ) オプションについてはinstallmentsを参照してください |
| ip | string | (任意) ソース作成時にOmiseに提供されるIPアドレス。IPv4またはIPv6。 |
| items | array | (任意) (任意) 注文に含まれるアイテムの詳細。以下の属性を持つオブジェクトの配列。 Array of objects with the following attributes:
|
| mobile_number | string | (任意、 場合によって必須) 顧客の電話番号( |
| name | string | (任意、 場合によって必須) 顧客名 ( |
| platform_type | string | (任意、 場合によって必須) (任意、 場合によって必須) 支払者が支払いを行うプラットフォーム。ブラウザ、iOS、Androidのいずれか。
以下の決済方法が
|
| promotion_code | string | (任意) TBD |
| qr_settings | object | (任意) 応答QRコードのフォーマットと見た目をカスタマイズする設定オブジェクト(type=promptpay)
|
| shipping | object | (任意) (任意) 配送先住所
|
| store_id | string | (任意、 場合によって必須) 取引した店舗ID ( |
| store_name | string | (任意、 場合によって必須) 取引した店舗名 ( |
| supplier_id | string | (任意) TBD |
| terminal_id | string | (任意、 場合によって必須) 取引で使用したターミナル端末ID ( |
| zero_interest_installments | boolean | (任意, one of: |
Example
-
ソースを作成する
- Omise.js
- Android SDK
- iOS SDK
- curl
- php
- node.js
- java
- python
- go
Omise.setPublicKey("OMISE_PUBLIC_KEY"); Omise.createSource("internet_banking_bbl", { "amount": 12345, "currency": "THB" }, function(statusCode, response) { console.log(response["id"]) });private val client = Client("pkey_test_123") val request = Source.CreateSourceRequestBuilder(25000L, "thb", SourceType.InternetBanking.Bbl).build() client.send(request, object: RequestListener<Source>{ override fun onRequestSucceed(model: Source) { // you created a source } override fun onRequestFailed(throwable: Throwable) { // something bad happened } })let paymentInformation = PaymentInformation.internetBanking(.bbl) let sourceParameter = CreateSourceParameter( paymentInformation: paymentInformation, amount: amount, currency: currency ) let request = Request<Source>(parameter: sourceParameter) let requestTask = client.requestTask(with: request, completionHandler: completionHandler) requestTask.resume()curl https://api.omise.co/sources \ -u $OMISE_PUBLIC_KEY: \ -d "amount=100000" \ -d "currency=THB" \ -d "type=bill_payment_tesco_lotus"<?php $source = OmiseSource::create(array( 'amount' => 100000, 'currency' => 'thb', 'type' => 'bill_payment_tesco_lotus' ));'use strict'; exports.__esModule = true; var omise = require('../index')({ 'publicKey': 'pkey_test_56bywcp7sk1qselsyqb' }); var source = { 'type': 'internet_banking_bbl', 'amount': 500000, 'currency': 'thb' }; omise.sources.create(source).then(function(resSource) { console.log(`created source: ${resSource.id}`); }).catch(function(err) { console.log(err); });Client client = new Client("pkey_test_56bywcp7sk1qselsyqb"); Source source = client.sources().create(new Source.Create() .type(SourceType.InternetBankingScb) .amount(10000) .currency("thb")); System.out.println("created source: " + source.getId());import omise omise.api_secret = "skey_test_no1t4tnemucod0e51mo" omise.api_version = "2017-11-02" source = omise.Source.create( amount=100000, currency="thb", type="bill_payment_tesco_lotus" )client, _ := omise.NewClient( "pkey_test_no1t4tnemucod0e51mo", "skey_test_no1t4tnemucod0e51mo", ) result := &omise.Source{} err := client.Do(result, &operations.CreateSource{ Amount: 100000, Currency: "thb", Type: "bill_payment_tesco_lotus", }) if err != nil { log.Fatalln(err) } log.Println(result)
ソースを取得する
- GET https://api.omise.co/sources/{id}すでに作成されているソースを取得します。
Example
-
ソースを取得する
- curl
curl https://api.omise.co/sources/src_test_5g5in1we65199wlsyji \ -u $OMISE_SECRET_KEY: