APIエンドポイント
- サーバー間通信
- トークン化
- サブスクリプション
- ウォレット
- ホスト決済ページ
エラーとレスポンス
ウェブフック
サブスクリプション作成API
サブスクリプション作成APIは、加盟店が顧客向けに定期的な請求を設定できるようにし、さまざまな請求間隔、試用期間、割引を備えた柔軟なプランを提供します。
curl --request POST \
--url https://api-dev.paymentoptions.com/api/v1/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": "24",
"name": "John Doe",
"number": "4000000000001091"
},
"payment_method": {
"type": "scheme",
"store_payment_method": false
},
"merchant_txn_ref": "qwe",
"customer_ip": "127.0.0.1",
"merchant_id": "< Merchant ID >",
"return_url": {
"webhook_url": "< Webhook url >",
"success_url": "http://www.successurl.com/",
"decline_url": "http://www.declineurl.com/"
},
"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"
},
"time_zone": "Asia/Kuala_Lumpur",
"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,
"trial_period_duration_type": "DAYS",
"trial_period_duration": 14,
"has_discount": true,
"discount_percentage": 10,
"discount_duration": 2
}
}'
{
"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",
"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": "24"
},
"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/MONTHS>",
"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パラメータ
Authorizations
認証用のAPIキー。フォーマット:「Basic YOUR_API_KEY_HERE」
x-api-key専用のAPIキー。
Body
取引金額。
15
"1000"
取引のISO通貨コード(例:JPY)。
3
"JPY"
支払いに使用するカードの詳細。
カードのセキュリティコード。
4
"112"
カードの有効期限(月)。
2
"12"
カードの有効期限(年)。
2
"24"
カード所有者の名前。
255
"John Doe"
カード番号。
16
"4000000000001091"
加盟店の一意識別子。
128
"< Merchant ID >"
カード所有者の請求先住所の詳細。
請求先の国コード(ISO 3166-1 alpha-2)。
2
"JP"
請求先メールアドレス。
45
"billing@testemail.com"
請求先電話番号。
20
"8112345678"
請求先住所。
199
"1-2-3 Shinjuku"
請求先市区町村。
65
"Shinjuku-ku"
請求先郵便番号。
45
"1600022"
請求先の州(任意)。
65
"Tokyo"
処理されるサブスクリプションの詳細。
サブスクリプションプラン名。
100
"Three weeks plan"
サブスクリプションプランの説明。
200
"Billed every two days"
サブスクリプションのサイクルタイプ(例:DAYS, MONTHS)。
"DAYS"
サブスクリプションの終了タイプ(例:CYCLE)。
"CYCLE"
請求サイクル間の間隔。
2
最大請求サイクル数。
10
サブスクリプションに試用期間が含まれるかどうかを示します。
false
サブスクリプションに割引が適用されているかどうかを示します。
true
サブスクリプションに適用される割引率。
10
請求サイクル単位での割引の期間。
2
試用期間の期間タイプ(例:DAYS, MONTHS)。
"DAYS"
試用期間の長さ。
14
一意の決済取引参照ID。
45
"qwe"
取引を開始した顧客のIPアドレス。
45
"127.0.0.1"
リターンURLを含むJSONオブジェクト。(3DS取引では必須)
カード所有者の配送先住所の詳細。
配送先の国コード(ISO 3166-1 alpha-2)。
2
"JP"
配送先メールアドレス。
45
"billing@testemail.com"
配送先電話番号。
20
"8112345678"
配送先住所。
199
"1-2-3 Shinjuku"
配送先市区町村。
65
"Shinjuku-ku"
配送先の州(任意)。
65
"Tokyo"
配送先郵便番号。
45
"1600022"
取引のタイムゾーン。
128
"Asia/Kuala_Lumpur"
Response
取引が成功したかどうかを示します。
true
取引のHTTPステータスコード。
201
取引が本番環境のものかテスト環境のものかを示します。
false
実行された取引の種類(例:CAPTURE)。
"CAPTURE"
加盟店に関する詳細情報。
加盟店の正式名称。
"Beck's Coffee Shop Pvt. Ltd."
加盟店ID。
"JP00000472"
加盟店の取引参照ID。
"qwe"
請求先および配送先住所の詳細。
加盟店の請求先住所。
国コード。
"JP"
請求先メールアドレス。
"billing@testemail.com"
請求先電話番号。
"8112345678"
請求先住所。
"1-2-3 Shinjuku"
請求先の市区町村。
"Shinjuku-ku"
請求先の都道府県。
"Tokyo"
請求先の郵便番号。
"1600022"
加盟店の配送先住所。
国コード。
"JP"
配送先メールアドレス。
"billing@testemail.com"
配送先電話番号。
"8112345678"
配送先住所。
"1-2-3 Shinjuku"
配送先の市区町村。
"Shinjuku-ku"
配送先の都道府県。
"Tokyo"
配送先の郵便番号。
"1600022"
決済取引の詳細。
取引金額。
900
アクワイアラーからの応答コード。
0
アクワイアラーからの認証コード。
"175438"
取引通貨。
"JPY"
使用された支払い方法。
"VISA_DEBIT-SSL"
使用されたカードスキーム。
"VISA"
取引の詳細。
取引ID。
"359f39bd-673a-47b3-b9ec-cbd6cd313b8e"
取引参照番号。
74860
取引のタイムスタンプ。
"2024-11-26T01:31:29.000Z"
加盟店の取引参照ID。
"qwe"
保存された決済方法ID(該当する場合)。
null
サブスクリプションの詳細。
サブスクリプションID。
"664dc930-88bd-4696-8807-5e0f1fedba0b"
サブスクリプションの種類(例:CYCLE)。
"CYCLE"
最大請求サイクル数。
10
サブスクリプションのステータス。
"ACTIVE"
完了した支払いサイクルの数。
1
次回の支払い日。
"2024-11-28T01:31:29.154Z"
次の支払いサイクル番号。
2
サブスクリプションプランの詳細。
サブスクリプションプランの名前。
"Three weeks plan"
サブスクリプションプランの説明。
"Billed every two days"
請求サイクルの種類(例:DAYS、MONTHS)。
"DAYS"
請求サイクル間の間隔。
2
各請求サイクルの金額。
1000
サブスクリプションの通貨コード。
"JPY"
試用期間の期間。
""
試用期間の種類。
"NONE"
サブスクリプションプランに適用される割引率。
10
割引の適用期間(請求サイクル数)。
2
curl --request POST \
--url https://api-dev.paymentoptions.com/api/v1/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": "24",
"name": "John Doe",
"number": "4000000000001091"
},
"payment_method": {
"type": "scheme",
"store_payment_method": false
},
"merchant_txn_ref": "qwe",
"customer_ip": "127.0.0.1",
"merchant_id": "< Merchant ID >",
"return_url": {
"webhook_url": "< Webhook url >",
"success_url": "http://www.successurl.com/",
"decline_url": "http://www.declineurl.com/"
},
"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"
},
"time_zone": "Asia/Kuala_Lumpur",
"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,
"trial_period_duration_type": "DAYS",
"trial_period_duration": 14,
"has_discount": true,
"discount_percentage": 10,
"discount_duration": 2
}
}'
{
"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",
"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": "24"
},
"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
}
}
}