curl --request POST \
--url https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"amount": "1000",
"currency": "JPY",
"card": {
"cvc": "112",
"expiry_month": "12",
"expiry_year": "29",
"name": "John Doe",
"number": "4000000000001091"
},
"payment_method": {
"type": "scheme",
"store_payment_method": false
},
"merchant_id": "< Merchant ID >",
"billing_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"postal_code": "1600022",
"state": "Tokyo"
},
"subscription": {
"plan_name": "Three weeks plan",
"plan_desc": "Billed every two days",
"cycle_type": "DAYS",
"subscription_end_type": "CYCLE",
"cycle_interval": 2,
"max_cycle_count": 10,
"has_trial_period": false,
"has_discount": true,
"discount_percentage": 10,
"discount_duration": 2,
"trial_period_duration_type": "DAYS",
"trial_period_duration": 14
},
"merchant_txn_ref": "qwe",
"customer_ip": "127.0.0.1",
"return_url": {
"webhook_url": "< Webhook url >",
"success_url": "http://www.successurl.com/",
"decline_url": "http://www.declineurl.com/"
},
"shipping_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"time_zone": "Asia/Kuala_Lumpur"
}
'import requests
url = "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment"
payload = {
"amount": "1000",
"currency": "JPY",
"card": {
"cvc": "112",
"expiry_month": "12",
"expiry_year": "29",
"name": "John Doe",
"number": "4000000000001091"
},
"payment_method": {
"type": "scheme",
"store_payment_method": False
},
"merchant_id": "< Merchant ID >",
"billing_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"postal_code": "1600022",
"state": "Tokyo"
},
"subscription": {
"plan_name": "Three weeks plan",
"plan_desc": "Billed every two days",
"cycle_type": "DAYS",
"subscription_end_type": "CYCLE",
"cycle_interval": 2,
"max_cycle_count": 10,
"has_trial_period": False,
"has_discount": True,
"discount_percentage": 10,
"discount_duration": 2,
"trial_period_duration_type": "DAYS",
"trial_period_duration": 14
},
"merchant_txn_ref": "qwe",
"customer_ip": "127.0.0.1",
"return_url": {
"webhook_url": "< Webhook url >",
"success_url": "http://www.successurl.com/",
"decline_url": "http://www.declineurl.com/"
},
"shipping_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"time_zone": "Asia/Kuala_Lumpur"
}
headers = {
"Authorization": "<api-key>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '1000',
currency: 'JPY',
card: {
cvc: '112',
expiry_month: '12',
expiry_year: '29',
name: 'John Doe',
number: '4000000000001091'
},
payment_method: {type: 'scheme', store_payment_method: false},
merchant_id: '< Merchant ID >',
billing_address: {
country: 'JP',
email: 'billing@testemail.com',
phone_number: '8112345678',
address1: '1-2-3 Shinjuku',
city: 'Shinjuku-ku',
postal_code: '1600022',
state: 'Tokyo'
},
subscription: {
plan_name: 'Three weeks plan',
plan_desc: 'Billed every two days',
cycle_type: 'DAYS',
subscription_end_type: 'CYCLE',
cycle_interval: 2,
max_cycle_count: 10,
has_trial_period: false,
has_discount: true,
discount_percentage: 10,
discount_duration: 2,
trial_period_duration_type: 'DAYS',
trial_period_duration: 14
},
merchant_txn_ref: 'qwe',
customer_ip: '127.0.0.1',
return_url: {
webhook_url: '< Webhook url >',
success_url: 'http://www.successurl.com/',
decline_url: 'http://www.declineurl.com/'
},
shipping_address: {
country: 'JP',
email: 'billing@testemail.com',
phone_number: '8112345678',
address1: '1-2-3 Shinjuku',
city: 'Shinjuku-ku',
state: 'Tokyo',
postal_code: '1600022'
},
time_zone: 'Asia/Kuala_Lumpur'
})
};
fetch('https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '1000',
'currency' => 'JPY',
'card' => [
'cvc' => '112',
'expiry_month' => '12',
'expiry_year' => '29',
'name' => 'John Doe',
'number' => '4000000000001091'
],
'payment_method' => [
'type' => 'scheme',
'store_payment_method' => false
],
'merchant_id' => '< Merchant ID >',
'billing_address' => [
'country' => 'JP',
'email' => 'billing@testemail.com',
'phone_number' => '8112345678',
'address1' => '1-2-3 Shinjuku',
'city' => 'Shinjuku-ku',
'postal_code' => '1600022',
'state' => 'Tokyo'
],
'subscription' => [
'plan_name' => 'Three weeks plan',
'plan_desc' => 'Billed every two days',
'cycle_type' => 'DAYS',
'subscription_end_type' => 'CYCLE',
'cycle_interval' => 2,
'max_cycle_count' => 10,
'has_trial_period' => false,
'has_discount' => true,
'discount_percentage' => 10,
'discount_duration' => 2,
'trial_period_duration_type' => 'DAYS',
'trial_period_duration' => 14
],
'merchant_txn_ref' => 'qwe',
'customer_ip' => '127.0.0.1',
'return_url' => [
'webhook_url' => '< Webhook url >',
'success_url' => 'http://www.successurl.com/',
'decline_url' => 'http://www.declineurl.com/'
],
'shipping_address' => [
'country' => 'JP',
'email' => 'billing@testemail.com',
'phone_number' => '8112345678',
'address1' => '1-2-3 Shinjuku',
'city' => 'Shinjuku-ku',
'state' => 'Tokyo',
'postal_code' => '1600022'
],
'time_zone' => 'Asia/Kuala_Lumpur'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment"
payload := strings.NewReader("{\n \"amount\": \"1000\",\n \"currency\": \"JPY\",\n \"card\": {\n \"cvc\": \"112\",\n \"expiry_month\": \"12\",\n \"expiry_year\": \"29\",\n \"name\": \"John Doe\",\n \"number\": \"4000000000001091\"\n },\n \"payment_method\": {\n \"type\": \"scheme\",\n \"store_payment_method\": false\n },\n \"merchant_id\": \"< Merchant ID >\",\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"postal_code\": \"1600022\",\n \"state\": \"Tokyo\"\n },\n \"subscription\": {\n \"plan_name\": \"Three weeks plan\",\n \"plan_desc\": \"Billed every two days\",\n \"cycle_type\": \"DAYS\",\n \"subscription_end_type\": \"CYCLE\",\n \"cycle_interval\": 2,\n \"max_cycle_count\": 10,\n \"has_trial_period\": false,\n \"has_discount\": true,\n \"discount_percentage\": 10,\n \"discount_duration\": 2,\n \"trial_period_duration_type\": \"DAYS\",\n \"trial_period_duration\": 14\n },\n \"merchant_txn_ref\": \"qwe\",\n \"customer_ip\": \"127.0.0.1\",\n \"return_url\": {\n \"webhook_url\": \"< Webhook url >\",\n \"success_url\": \"http://www.successurl.com/\",\n \"decline_url\": \"http://www.declineurl.com/\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"time_zone\": \"Asia/Kuala_Lumpur\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment")
.header("Authorization", "<api-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"1000\",\n \"currency\": \"JPY\",\n \"card\": {\n \"cvc\": \"112\",\n \"expiry_month\": \"12\",\n \"expiry_year\": \"29\",\n \"name\": \"John Doe\",\n \"number\": \"4000000000001091\"\n },\n \"payment_method\": {\n \"type\": \"scheme\",\n \"store_payment_method\": false\n },\n \"merchant_id\": \"< Merchant ID >\",\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"postal_code\": \"1600022\",\n \"state\": \"Tokyo\"\n },\n \"subscription\": {\n \"plan_name\": \"Three weeks plan\",\n \"plan_desc\": \"Billed every two days\",\n \"cycle_type\": \"DAYS\",\n \"subscription_end_type\": \"CYCLE\",\n \"cycle_interval\": 2,\n \"max_cycle_count\": 10,\n \"has_trial_period\": false,\n \"has_discount\": true,\n \"discount_percentage\": 10,\n \"discount_duration\": 2,\n \"trial_period_duration_type\": \"DAYS\",\n \"trial_period_duration\": 14\n },\n \"merchant_txn_ref\": \"qwe\",\n \"customer_ip\": \"127.0.0.1\",\n \"return_url\": {\n \"webhook_url\": \"< Webhook url >\",\n \"success_url\": \"http://www.successurl.com/\",\n \"decline_url\": \"http://www.declineurl.com/\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"time_zone\": \"Asia/Kuala_Lumpur\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"1000\",\n \"currency\": \"JPY\",\n \"card\": {\n \"cvc\": \"112\",\n \"expiry_month\": \"12\",\n \"expiry_year\": \"29\",\n \"name\": \"John Doe\",\n \"number\": \"4000000000001091\"\n },\n \"payment_method\": {\n \"type\": \"scheme\",\n \"store_payment_method\": false\n },\n \"merchant_id\": \"< Merchant ID >\",\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"postal_code\": \"1600022\",\n \"state\": \"Tokyo\"\n },\n \"subscription\": {\n \"plan_name\": \"Three weeks plan\",\n \"plan_desc\": \"Billed every two days\",\n \"cycle_type\": \"DAYS\",\n \"subscription_end_type\": \"CYCLE\",\n \"cycle_interval\": 2,\n \"max_cycle_count\": 10,\n \"has_trial_period\": false,\n \"has_discount\": true,\n \"discount_percentage\": 10,\n \"discount_duration\": 2,\n \"trial_period_duration_type\": \"DAYS\",\n \"trial_period_duration\": 14\n },\n \"merchant_txn_ref\": \"qwe\",\n \"customer_ip\": \"127.0.0.1\",\n \"return_url\": {\n \"webhook_url\": \"< Webhook url >\",\n \"success_url\": \"http://www.successurl.com/\",\n \"decline_url\": \"http://www.declineurl.com/\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"time_zone\": \"Asia/Kuala_Lumpur\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"status_code": 201,
"is_live": false,
"transaction_type": "CAPTURE",
"gateway_response": {
"version": "1",
"type": "INFO",
"message": "Payment Successful.",
"code": "INFO0000"
},
"merchant_details": {
"legal_name": "Beck's Coffee Shop Pvt. Ltd.",
"mid": "JP00000472",
"merchant_txn_ref": "qwe",
"billing_details": {
"billing_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"shipping_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
}
},
"device_details": {
"visited_ip": "127.0.0.1",
"merchant_ip": "127.0.0.1",
"customer_ip": "127.0.0.1"
}
},
"payment_details": {
"amount": 900,
"response_code": 0,
"auth_code": "175438",
"currency": "JPY",
"payment_method": "VISA_DEBIT-SSL",
"scheme": "VISA",
"card": {
"name": "John Doe",
"number": "4000000000001091",
"exp_month": "12",
"exp_year": "29"
},
"additional_data": {
"payment_data_source": {
"type": "card"
}
}
},
"transaction_details": {
"id": "359f39bd-673a-47b3-b9ec-cbd6cd313b8e",
"ref": 74860,
"timestamp": "2024-11-26T01:31:29.000Z",
"merchant_txn_ref": "qwe",
"stored_payment_method_id": null
},
"risk-details": {
"risk_score": null
},
"subscription_details": {
"id": "664dc930-88bd-4696-8807-5e0f1fedba0b",
"type": "CYCLE",
"max_cycle_count": 10,
"status": "ACTIVE",
"completed_payment_cycle": 1,
"next_payment_date": "2024-11-28T01:31:29.154Z",
"next_payment_cycle": 2,
"subscription_plan_details": {
"name": "Three weeks plan",
"desc": "Billed every two days",
"billing_cycle_type": "DAYS",
"billing_cycle_interval": 2,
"amount": 1000,
"ccy": "JPY",
"trial_period_duration": "",
"trial_period_duration_type": "NONE",
"plan_discount_percentage": 10,
"plan_discount_duration": 2
}
}
}サブスクリプション作成API
サブスクリプション作成APIは、加盟店が顧客向けに定期的な請求を設定できるようにし、さまざまな請求間隔、試用期間、割引を備えた柔軟なプランを提供します。
curl --request POST \
--url https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"amount": "1000",
"currency": "JPY",
"card": {
"cvc": "112",
"expiry_month": "12",
"expiry_year": "29",
"name": "John Doe",
"number": "4000000000001091"
},
"payment_method": {
"type": "scheme",
"store_payment_method": false
},
"merchant_id": "< Merchant ID >",
"billing_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"postal_code": "1600022",
"state": "Tokyo"
},
"subscription": {
"plan_name": "Three weeks plan",
"plan_desc": "Billed every two days",
"cycle_type": "DAYS",
"subscription_end_type": "CYCLE",
"cycle_interval": 2,
"max_cycle_count": 10,
"has_trial_period": false,
"has_discount": true,
"discount_percentage": 10,
"discount_duration": 2,
"trial_period_duration_type": "DAYS",
"trial_period_duration": 14
},
"merchant_txn_ref": "qwe",
"customer_ip": "127.0.0.1",
"return_url": {
"webhook_url": "< Webhook url >",
"success_url": "http://www.successurl.com/",
"decline_url": "http://www.declineurl.com/"
},
"shipping_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"time_zone": "Asia/Kuala_Lumpur"
}
'import requests
url = "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment"
payload = {
"amount": "1000",
"currency": "JPY",
"card": {
"cvc": "112",
"expiry_month": "12",
"expiry_year": "29",
"name": "John Doe",
"number": "4000000000001091"
},
"payment_method": {
"type": "scheme",
"store_payment_method": False
},
"merchant_id": "< Merchant ID >",
"billing_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"postal_code": "1600022",
"state": "Tokyo"
},
"subscription": {
"plan_name": "Three weeks plan",
"plan_desc": "Billed every two days",
"cycle_type": "DAYS",
"subscription_end_type": "CYCLE",
"cycle_interval": 2,
"max_cycle_count": 10,
"has_trial_period": False,
"has_discount": True,
"discount_percentage": 10,
"discount_duration": 2,
"trial_period_duration_type": "DAYS",
"trial_period_duration": 14
},
"merchant_txn_ref": "qwe",
"customer_ip": "127.0.0.1",
"return_url": {
"webhook_url": "< Webhook url >",
"success_url": "http://www.successurl.com/",
"decline_url": "http://www.declineurl.com/"
},
"shipping_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"time_zone": "Asia/Kuala_Lumpur"
}
headers = {
"Authorization": "<api-key>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '1000',
currency: 'JPY',
card: {
cvc: '112',
expiry_month: '12',
expiry_year: '29',
name: 'John Doe',
number: '4000000000001091'
},
payment_method: {type: 'scheme', store_payment_method: false},
merchant_id: '< Merchant ID >',
billing_address: {
country: 'JP',
email: 'billing@testemail.com',
phone_number: '8112345678',
address1: '1-2-3 Shinjuku',
city: 'Shinjuku-ku',
postal_code: '1600022',
state: 'Tokyo'
},
subscription: {
plan_name: 'Three weeks plan',
plan_desc: 'Billed every two days',
cycle_type: 'DAYS',
subscription_end_type: 'CYCLE',
cycle_interval: 2,
max_cycle_count: 10,
has_trial_period: false,
has_discount: true,
discount_percentage: 10,
discount_duration: 2,
trial_period_duration_type: 'DAYS',
trial_period_duration: 14
},
merchant_txn_ref: 'qwe',
customer_ip: '127.0.0.1',
return_url: {
webhook_url: '< Webhook url >',
success_url: 'http://www.successurl.com/',
decline_url: 'http://www.declineurl.com/'
},
shipping_address: {
country: 'JP',
email: 'billing@testemail.com',
phone_number: '8112345678',
address1: '1-2-3 Shinjuku',
city: 'Shinjuku-ku',
state: 'Tokyo',
postal_code: '1600022'
},
time_zone: 'Asia/Kuala_Lumpur'
})
};
fetch('https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '1000',
'currency' => 'JPY',
'card' => [
'cvc' => '112',
'expiry_month' => '12',
'expiry_year' => '29',
'name' => 'John Doe',
'number' => '4000000000001091'
],
'payment_method' => [
'type' => 'scheme',
'store_payment_method' => false
],
'merchant_id' => '< Merchant ID >',
'billing_address' => [
'country' => 'JP',
'email' => 'billing@testemail.com',
'phone_number' => '8112345678',
'address1' => '1-2-3 Shinjuku',
'city' => 'Shinjuku-ku',
'postal_code' => '1600022',
'state' => 'Tokyo'
],
'subscription' => [
'plan_name' => 'Three weeks plan',
'plan_desc' => 'Billed every two days',
'cycle_type' => 'DAYS',
'subscription_end_type' => 'CYCLE',
'cycle_interval' => 2,
'max_cycle_count' => 10,
'has_trial_period' => false,
'has_discount' => true,
'discount_percentage' => 10,
'discount_duration' => 2,
'trial_period_duration_type' => 'DAYS',
'trial_period_duration' => 14
],
'merchant_txn_ref' => 'qwe',
'customer_ip' => '127.0.0.1',
'return_url' => [
'webhook_url' => '< Webhook url >',
'success_url' => 'http://www.successurl.com/',
'decline_url' => 'http://www.declineurl.com/'
],
'shipping_address' => [
'country' => 'JP',
'email' => 'billing@testemail.com',
'phone_number' => '8112345678',
'address1' => '1-2-3 Shinjuku',
'city' => 'Shinjuku-ku',
'state' => 'Tokyo',
'postal_code' => '1600022'
],
'time_zone' => 'Asia/Kuala_Lumpur'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment"
payload := strings.NewReader("{\n \"amount\": \"1000\",\n \"currency\": \"JPY\",\n \"card\": {\n \"cvc\": \"112\",\n \"expiry_month\": \"12\",\n \"expiry_year\": \"29\",\n \"name\": \"John Doe\",\n \"number\": \"4000000000001091\"\n },\n \"payment_method\": {\n \"type\": \"scheme\",\n \"store_payment_method\": false\n },\n \"merchant_id\": \"< Merchant ID >\",\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"postal_code\": \"1600022\",\n \"state\": \"Tokyo\"\n },\n \"subscription\": {\n \"plan_name\": \"Three weeks plan\",\n \"plan_desc\": \"Billed every two days\",\n \"cycle_type\": \"DAYS\",\n \"subscription_end_type\": \"CYCLE\",\n \"cycle_interval\": 2,\n \"max_cycle_count\": 10,\n \"has_trial_period\": false,\n \"has_discount\": true,\n \"discount_percentage\": 10,\n \"discount_duration\": 2,\n \"trial_period_duration_type\": \"DAYS\",\n \"trial_period_duration\": 14\n },\n \"merchant_txn_ref\": \"qwe\",\n \"customer_ip\": \"127.0.0.1\",\n \"return_url\": {\n \"webhook_url\": \"< Webhook url >\",\n \"success_url\": \"http://www.successurl.com/\",\n \"decline_url\": \"http://www.declineurl.com/\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"time_zone\": \"Asia/Kuala_Lumpur\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment")
.header("Authorization", "<api-key>")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"1000\",\n \"currency\": \"JPY\",\n \"card\": {\n \"cvc\": \"112\",\n \"expiry_month\": \"12\",\n \"expiry_year\": \"29\",\n \"name\": \"John Doe\",\n \"number\": \"4000000000001091\"\n },\n \"payment_method\": {\n \"type\": \"scheme\",\n \"store_payment_method\": false\n },\n \"merchant_id\": \"< Merchant ID >\",\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"postal_code\": \"1600022\",\n \"state\": \"Tokyo\"\n },\n \"subscription\": {\n \"plan_name\": \"Three weeks plan\",\n \"plan_desc\": \"Billed every two days\",\n \"cycle_type\": \"DAYS\",\n \"subscription_end_type\": \"CYCLE\",\n \"cycle_interval\": 2,\n \"max_cycle_count\": 10,\n \"has_trial_period\": false,\n \"has_discount\": true,\n \"discount_percentage\": 10,\n \"discount_duration\": 2,\n \"trial_period_duration_type\": \"DAYS\",\n \"trial_period_duration\": 14\n },\n \"merchant_txn_ref\": \"qwe\",\n \"customer_ip\": \"127.0.0.1\",\n \"return_url\": {\n \"webhook_url\": \"< Webhook url >\",\n \"success_url\": \"http://www.successurl.com/\",\n \"decline_url\": \"http://www.declineurl.com/\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"time_zone\": \"Asia/Kuala_Lumpur\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-dev.paymentoptions.com/api/v1/server-to-server-interface/subscription/payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"1000\",\n \"currency\": \"JPY\",\n \"card\": {\n \"cvc\": \"112\",\n \"expiry_month\": \"12\",\n \"expiry_year\": \"29\",\n \"name\": \"John Doe\",\n \"number\": \"4000000000001091\"\n },\n \"payment_method\": {\n \"type\": \"scheme\",\n \"store_payment_method\": false\n },\n \"merchant_id\": \"< Merchant ID >\",\n \"billing_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"postal_code\": \"1600022\",\n \"state\": \"Tokyo\"\n },\n \"subscription\": {\n \"plan_name\": \"Three weeks plan\",\n \"plan_desc\": \"Billed every two days\",\n \"cycle_type\": \"DAYS\",\n \"subscription_end_type\": \"CYCLE\",\n \"cycle_interval\": 2,\n \"max_cycle_count\": 10,\n \"has_trial_period\": false,\n \"has_discount\": true,\n \"discount_percentage\": 10,\n \"discount_duration\": 2,\n \"trial_period_duration_type\": \"DAYS\",\n \"trial_period_duration\": 14\n },\n \"merchant_txn_ref\": \"qwe\",\n \"customer_ip\": \"127.0.0.1\",\n \"return_url\": {\n \"webhook_url\": \"< Webhook url >\",\n \"success_url\": \"http://www.successurl.com/\",\n \"decline_url\": \"http://www.declineurl.com/\"\n },\n \"shipping_address\": {\n \"country\": \"JP\",\n \"email\": \"billing@testemail.com\",\n \"phone_number\": \"8112345678\",\n \"address1\": \"1-2-3 Shinjuku\",\n \"city\": \"Shinjuku-ku\",\n \"state\": \"Tokyo\",\n \"postal_code\": \"1600022\"\n },\n \"time_zone\": \"Asia/Kuala_Lumpur\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"status_code": 201,
"is_live": false,
"transaction_type": "CAPTURE",
"gateway_response": {
"version": "1",
"type": "INFO",
"message": "Payment Successful.",
"code": "INFO0000"
},
"merchant_details": {
"legal_name": "Beck's Coffee Shop Pvt. Ltd.",
"mid": "JP00000472",
"merchant_txn_ref": "qwe",
"billing_details": {
"billing_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
},
"shipping_address": {
"country": "JP",
"email": "billing@testemail.com",
"phone_number": "8112345678",
"address1": "1-2-3 Shinjuku",
"city": "Shinjuku-ku",
"state": "Tokyo",
"postal_code": "1600022"
}
},
"device_details": {
"visited_ip": "127.0.0.1",
"merchant_ip": "127.0.0.1",
"customer_ip": "127.0.0.1"
}
},
"payment_details": {
"amount": 900,
"response_code": 0,
"auth_code": "175438",
"currency": "JPY",
"payment_method": "VISA_DEBIT-SSL",
"scheme": "VISA",
"card": {
"name": "John Doe",
"number": "4000000000001091",
"exp_month": "12",
"exp_year": "29"
},
"additional_data": {
"payment_data_source": {
"type": "card"
}
}
},
"transaction_details": {
"id": "359f39bd-673a-47b3-b9ec-cbd6cd313b8e",
"ref": 74860,
"timestamp": "2024-11-26T01:31:29.000Z",
"merchant_txn_ref": "qwe",
"stored_payment_method_id": null
},
"risk-details": {
"risk_score": null
},
"subscription_details": {
"id": "664dc930-88bd-4696-8807-5e0f1fedba0b",
"type": "CYCLE",
"max_cycle_count": 10,
"status": "ACTIVE",
"completed_payment_cycle": 1,
"next_payment_date": "2024-11-28T01:31:29.154Z",
"next_payment_cycle": 2,
"subscription_plan_details": {
"name": "Three weeks plan",
"desc": "Billed every two days",
"billing_cycle_type": "DAYS",
"billing_cycle_interval": 2,
"amount": 1000,
"ccy": "JPY",
"trial_period_duration": "",
"trial_period_duration_type": "NONE",
"plan_discount_percentage": 10,
"plan_discount_duration": 2
}
}
}サブスクリプション作成のリクエスト例
"subscription": {
"plan_name": "<string>",
"plan_desc": "<string>",
"cycle_type": "<DAYS/WEEKLY/MONTHLY>",
"subscription_end_type": "CYCLE",
"cycle_interval": <int>,
"max_cycle_count": <int>,
"has_trial_period": <boolean>,
"trial_period_duration_type": "DAYS",
"trial_period_duration": <int>,
"has_discount": <boolean>,
"discount_percentage": <int>,
"discount_duration": <int>
}
重要なポイント
フローダイアグラム
APIパラメータ
承認
認証用のAPIキー。フォーマット:「Basic YOUR_API_KEY_HERE」
x-api-key専用のAPIキー。
ボディ
サブスクリプション支払いを処理するためのペイロード。
取引金額。
15"1000"
取引のISO通貨コード(例:JPY)。
3"JPY"
支払いに使用するカードの詳細。
Show child attributes
Show child attributes
決済方法の詳細。
Show child attributes
Show child attributes
加盟店の一意識別子。
128"< Merchant ID >"
カード所有者の請求先住所の詳細。
Show child attributes
Show child attributes
処理されるサブスクリプションの詳細。
Show child attributes
Show child attributes
一意の決済取引参照ID。
45"qwe"
取引を開始した顧客のIPアドレス。
45"127.0.0.1"
リターンURLを含むJSONオブジェクト。(3DS取引では必須)
Show child attributes
Show child attributes
カード所有者の配送先住所の詳細。
Show child attributes
Show child attributes
取引のタイムゾーン。
128"Asia/Kuala_Lumpur"
レスポンス
サブスクリプション支払いが正常に処理されました。
取引が成功したかどうかを示します。
true
取引のHTTPステータスコード。
201
取引が本番環境のものかテスト環境のものかを示します。
false
実行された取引の種類(例:CAPTURE)。
"CAPTURE"
決済ゲートウェイからの応答。
Show child attributes
Show child attributes
加盟店に関する詳細情報。
Show child attributes
Show child attributes
決済取引の詳細。
Show child attributes
Show child attributes
取引の詳細。
Show child attributes
Show child attributes
リスク評価の詳細。
Show child attributes
Show child attributes
サブスクリプションの詳細。
Show child attributes
Show child attributes