ข้ามไปยังเนื้อหาหลัก
เวอร์ชัน: APIバージョン 2019-06-09

Tokens

Retrieve Tokens ID

Welcome to the Omise Docs! These pages should contain everything you need to know to get paid using the Omise API. This is developer-oriented documentation.If you are not a developer, you can check our comprehensive support articles for non-technical explanations of various concepts or go straight to the plugin overview.

Retrieve Tokens ID
curl -X GET\
-H "Accept: application/json"\
"https://api.omise.co/tokens/{id}"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.TokensApi;

import java.io.File;
import java.util.*;

public class TokensApiExample {

public static void main(String[] args) {

TokensApi apiInstance = new TokensApi();
String id = id_example; // String |
try {
token result = apiInstance.tokensIdGet(id);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TokensApi#tokensIdGet");
e.printStackTrace();
}
}
}
import io.swagger.client.api.TokensApi;

public class TokensApiExample {

public static void main(String[] args) {
TokensApi apiInstance = new TokensApi();
String id = id_example; // String |
try {
token result = apiInstance.tokensIdGet(id);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TokensApi#tokensIdGet");
e.printStackTrace();
}
}
}
String *id = id_example; // 

TokensApi *apiInstance = [[TokensApi alloc] init];

[apiInstance tokensIdGetWith:id
completionHandler: ^(token output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var OmiseApi = require('omise_api');

var api = new OmiseApi.TokensApi()
var id = id_example; // {{String}}

var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.tokensIdGet(id, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
public class tokensIdGetExample
{
public void main()
{

var apiInstance = new TokensApi();
var id = id_example; // String |

try
{
token result = apiInstance.tokensIdGet(id);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling TokensApi.tokensIdGet: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\ApiTokensApi();
$id = id_example; // String |

try {
$result = $api_instance->tokensIdGet($id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling TokensApi->tokensIdGet: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::TokensApi;

my $api_instance = WWW::SwaggerClient::TokensApi->new();
my $id = id_example; # String |

eval {
my $result = $api_instance->tokensIdGet(id => $id);
print Dumper($result);
};
if ($@) {
warn "Exception when calling TokensApi->tokensIdGet: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.TokensApi()
id = id_example # String |

try:
api_response = api_instance.tokens_id_get(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling TokensApi->tokensIdGet: %s\n" % e)

Parameters

NameDescription
id*String Required

Create Tokens

Welcome to the Omise Docs! These pages should contain everything you need to know to get paid using the Omise API. This is developer-oriented documentation.If you are not a developer, you can check our comprehensive support articles for non-technical explanations of various concepts or go straight to the plugin overview.

Create Tokens
curl -X POST\
-H "Accept: application/json"\
-H "Content-Type: application/x-www-form-urlencoded"\
"https://api.omise.co/tokens"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.TokensApi;

import java.io.File;
import java.util.*;

public class TokensApiExample {

public static void main(String[] args) {

TokensApi apiInstance = new TokensApi();
tokens_card card = ; // tokens_card |
try {
token result = apiInstance.tokensPost(card);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TokensApi#tokensPost");
e.printStackTrace();
}
}
}
import io.swagger.client.api.TokensApi;

public class TokensApiExample {

public static void main(String[] args) {
TokensApi apiInstance = new TokensApi();
tokens_card card = ; // tokens_card |
try {
token result = apiInstance.tokensPost(card);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TokensApi#tokensPost");
e.printStackTrace();
}
}
}
tokens_card *card = ; //  (optional)

TokensApi *apiInstance = [[TokensApi alloc] init];

[apiInstance tokensPostWith:card
completionHandler: ^(token output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var OmiseApi = require('omise_api');

var api = new OmiseApi.TokensApi()
var opts = {
'card': // {{tokens_card}}
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.tokensPost(opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
public class tokensPostExample
{
public void main()
{

var apiInstance = new TokensApi();
var card = new tokens_card(); // tokens_card | (optional)

try
{
token result = apiInstance.tokensPost(card);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling TokensApi.tokensPost: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\ApiTokensApi();
$card = ; // tokens_card |

try {
$result = $api_instance->tokensPost($card);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling TokensApi->tokensPost: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::TokensApi;

my $api_instance = WWW::SwaggerClient::TokensApi->new();
my $card = ; # tokens_card |

eval {
my $result = $api_instance->tokensPost(card => $card);
print Dumper($result);
};
if ($@) {
warn "Exception when calling TokensApi->tokensPost: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.TokensApi()
card = # tokens_card | (optional)

try:
api_response = api_instance.tokens_post(card=card)
pprint(api_response)
except ApiException as e:
print("Exception when calling TokensApi->tokensPost: %s\n" % e)

Parameters

NameDescription
cardtokens_card

Responses

Status: 200

 {
"object": {
"pattern": "token",
"type": "string",
"default": "token"
},
"id": {
"pattern": "tokn_[0-9a-z]+",
"type": "string"
},
"livemode": {
"type": "boolean",
"enum": [
true,
false
]
},
"location": {
"type": "string"
},
"used": {
"type": "boolean",
"enum": [
true,
false
]
},
"charge_status": {
"type": "string",
"enum": [
"failed",
"expired",
"pending",
"reversed",
"successful",
"unknown"
]
},
"card": {
"type": "object",
"properties": {
"object": {
"pattern": "card",
"type": "string",
"default": "card"
},
"id": {
"type": "string"
},
"livemode": {
"type": "boolean",
"enum": [
true,
false
]
},
"location": {
"type": "string"
},
"deleted": {
"type": "boolean",
"enum": [
true,
false
]
},
"street1": {
"type": "string",
"nullable": true
},
"street2": {
"type": "string",
"nullable": true
},
"city": {
"type": "string",
"nullable": true
},
"state": {
"type": "string",
"nullable": true
},
"phone_number": {
"type": "string",
"nullable": true
},
"postal_code": {
"type": "string",
"nullable": true
},
"country": {
"pattern": "^[a-z]{0,2}$",
"type": "string"
},
"financing": {
"type": "string"
},
"bank": {
"type": "string"
},
"brand": {
"type": "string"
},
"fingerprint": {
"type": "string"
},
"first_digits": {
"pattern": "^[0-9]{6}$",
"type": "string",
"nullable": true
},
"last_digits": {
"pattern": "^[0-9]{4}$",
"type": "string"
},
"name": {
"type": "string"
},
"expiration_month": {
"type": "integer"
},
"expiration_year": {
"type": "integer"
},
"security_code_check": {
"type": "boolean",
"enum": [
true,
false
]
},
"tokenization_method": {
"type": "string"
},
"created_at": {
"type": "string",
"format": "date-time"
}
}
},
"created_at": {
"type": "string",
"format": "date-time"
}
}