Source (ソース) API
Source(ソース)APIを使用すると、決済ソースを作成および取得することができます。 ソースとは、Charge APIを使用して、クレジットカード以外のチャネル (Alipay、コンビニエンスストア決済、internet banking(ネットバンク、installment payments(分割払い)を含む)を通して決済を受け入れる方法です。 新しいソースは、公開鍵(パブリックキー)のみを使用し作成できます。
Attributes
Name | Type | Description |
---|---|---|
object | string | 固定値 |
id | object_id |
|
livemode | boolean | 本番モード ( |
location | string | 現在の |
amount | integer | smallest currency unit(最小通貨単位)で表したソースの金額。 |
barcode | string | バーコード番号 ( |
created_at | datetime | ISO 8601形式 ( |
currency | currency | 3文字で表示されるソース通貨[ISO 4217](http://ja.wikipedia.org/wiki/ISO_4217)コード。 |
string | ソースに紐づけられたメールアドレス。( |
|
flow | string | 顧客が決済を完了するために使用する決済フロー。 値は次のいずれかになります。: offline :顧客は、オフラインで決済するために決済情報を受け取ります。 例:百貨店での請求書決済。 |
installment_term | integer | (分割払い使用時のみ) オプションについてはinstallmentsを参照してください。 |
mobile_number | string | 顧客の電話番号( |
name | string | 顧客名 ( |
phone_number | string | 顧客の電話番号( |
references | references | 支払いに関する参照情報( |
scannable_code | string | Barcode object. |
store_id | string | 取引した店舗ID ( |
store_name | string | 取引した店舗名 ( |
terminal_id | string | 取引で使用したターミナル端末ID ( |
type | string | ソース決済タイプ。 値は次のいずれかになります(アカウントや国によって異なります)。
詳細については、installmentsとpayment methodsを参照してください。 |
zero_interest_installments | boolean | 加盟店が分割払いの支払いに関する利子を負担するかどうか( |
Example
-
JSON Response
{ "object": "source", "id": "src_test_no1t4tnemucod0e51mo", "livemode": false, "location": "/sources/src_test_no1t4tnemucod0e51mo", "created_at": "2019-12-31T12:59:59Z", "type": "barcode_alipay", "flow": "offline", "amount": 12345, "currency": "THB", "mobile_number": null, "phone_number": null, "references": null, "name": null, "email": null, "barcode": "1234567890", "store_id": "store_1", "store_name": "store 1", "terminal_id": "POS-01", "installment_term": null, "zero_interest_installments": null, "scannable_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 | currency | (必須) 3文字で表示されるソース通貨[ISO 4217](http://ja.wikipedia.org/wiki/ISO_4217)コード。 |
type | string | (必須) ソース決済タイプ。 値は次のいずれかになります(アカウントや国によって異なります)。
詳細については、installmentsとpayment methodsを参照してください。 |
barcode | string | (任意、 場合によって必須) バーコード番号 ( |
string | (任意、 場合によって必須) ソースに紐づけられたメールアドレス。( |
|
installment_term | integer | (任意、 場合によって必須) (分割払い使用時のみ) オプションについてはinstallmentsを参照してください。 |
name | string | (任意、 場合によって必須) 顧客名 ( |
phone_number | string | (任意、 場合によって必須) 顧客の電話番号( |
store_id | string | (任意、 場合によって必須) 取引した店舗ID ( |
store_name | string | (任意、 場合によって必須) 取引した店舗名 ( |
terminal_id | string | (任意、 場合によって必須) 取引で使用したターミナル端末ID ( |
zero_interest_installments | boolean | (任意) 加盟店が分割払いの支払いに関する利子を負担するかどうか( |
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_56bywcp7sk1qselsyqb' source = omise.Source.create( amount=100000, currency='thb', type='bill_payment_tesco_lotus' )
source, createSource := &omise.Source{}, &operations.CreateSource{ Amount: 100000, Currency: "thb", Type: "bill_payment_tesco_lotus", } if e := client.Do(source, createSource); e != nil { log.Fatalln(e) } log.Printf("created source: %#v\n", source)
ソースを取得する
- GET https://api.omise.co/sources/{id}すでに作成されているソースを取得します。
Example
-
ソースを取得する
- curl
curl https://api.omise.co/sources/src_test_5g5in1we65199wlsyji \ -u $OMISE_SECRET_KEY: