分期付款
创建分期付款计划
创建分期付款计划,定义金额范围、卡 BIN、币种和可用性规则
POST
/
installments-plans
创建分期计划
curl --request POST \
--url https://api-sandbox.y.uno/v1/installments-plans \
--header 'Content-Type: application/json' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>' \
--data '
{
"name": "plan_007",
"account_id": [
"{{account-code}}"
],
"merchant_reference": "Test",
"installments_plan": [
{
"installment": 1,
"rate": 1
},
{
"installment": 3,
"rate": 1,
"financial_costs": [
{
"type": "CFT",
"rate": 45.25
},
{
"type": "TEA",
"rate": 38.5
}
]
},
{
"installment": 6,
"rate": 1
},
{
"installment": 9,
"rate": 1
},
{
"installment": 12,
"rate": 1
}
],
"country_code": "CO",
"amount": {
"currency": "COP",
"min_value": 0,
"max_value": 100000000
},
"availability": {
"start_at": "2023-09-12T00:00:00Z",
"finish_at": "2030-09-20T00:00:00Z"
},
"payment_method_type": "NU_PAY_ENROLLMENT"
}
'import requests
url = "https://api-sandbox.y.uno/v1/installments-plans"
payload = {
"name": "plan_007",
"account_id": ["{{account-code}}"],
"merchant_reference": "Test",
"installments_plan": [
{
"installment": 1,
"rate": 1
},
{
"installment": 3,
"rate": 1,
"financial_costs": [
{
"type": "CFT",
"rate": 45.25
},
{
"type": "TEA",
"rate": 38.5
}
]
},
{
"installment": 6,
"rate": 1
},
{
"installment": 9,
"rate": 1
},
{
"installment": 12,
"rate": 1
}
],
"country_code": "CO",
"amount": {
"currency": "COP",
"min_value": 0,
"max_value": 100000000
},
"availability": {
"start_at": "2023-09-12T00:00:00Z",
"finish_at": "2030-09-20T00:00:00Z"
},
"payment_method_type": "NU_PAY_ENROLLMENT"
}
headers = {
"public-api-key": "<api-key>",
"private-secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'public-api-key': '<api-key>',
'private-secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'plan_007',
account_id: ['{{account-code}}'],
merchant_reference: 'Test',
installments_plan: [
{installment: 1, rate: 1},
{
installment: 3,
rate: 1,
financial_costs: [{type: 'CFT', rate: 45.25}, {type: 'TEA', rate: 38.5}]
},
{installment: 6, rate: 1},
{installment: 9, rate: 1},
{installment: 12, rate: 1}
],
country_code: 'CO',
amount: {currency: 'COP', min_value: 0, max_value: 100000000},
availability: {start_at: '2023-09-12T00:00:00Z', finish_at: '2030-09-20T00:00:00Z'},
payment_method_type: 'NU_PAY_ENROLLMENT'
})
};
fetch('https://api-sandbox.y.uno/v1/installments-plans', 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-sandbox.y.uno/v1/installments-plans",
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([
'name' => 'plan_007',
'account_id' => [
'{{account-code}}'
],
'merchant_reference' => 'Test',
'installments_plan' => [
[
'installment' => 1,
'rate' => 1
],
[
'installment' => 3,
'rate' => 1,
'financial_costs' => [
[
'type' => 'CFT',
'rate' => 45.25
],
[
'type' => 'TEA',
'rate' => 38.5
]
]
],
[
'installment' => 6,
'rate' => 1
],
[
'installment' => 9,
'rate' => 1
],
[
'installment' => 12,
'rate' => 1
]
],
'country_code' => 'CO',
'amount' => [
'currency' => 'COP',
'min_value' => 0,
'max_value' => 100000000
],
'availability' => [
'start_at' => '2023-09-12T00:00:00Z',
'finish_at' => '2030-09-20T00:00:00Z'
],
'payment_method_type' => 'NU_PAY_ENROLLMENT'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"private-secret-key: <api-key>",
"public-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-sandbox.y.uno/v1/installments-plans"
payload := strings.NewReader("{\n \"name\": \"plan_007\",\n \"account_id\": [\n \"{{account-code}}\"\n ],\n \"merchant_reference\": \"Test\",\n \"installments_plan\": [\n {\n \"installment\": 1,\n \"rate\": 1\n },\n {\n \"installment\": 3,\n \"rate\": 1,\n \"financial_costs\": [\n {\n \"type\": \"CFT\",\n \"rate\": 45.25\n },\n {\n \"type\": \"TEA\",\n \"rate\": 38.5\n }\n ]\n },\n {\n \"installment\": 6,\n \"rate\": 1\n },\n {\n \"installment\": 9,\n \"rate\": 1\n },\n {\n \"installment\": 12,\n \"rate\": 1\n }\n ],\n \"country_code\": \"CO\",\n \"amount\": {\n \"currency\": \"COP\",\n \"min_value\": 0,\n \"max_value\": 100000000\n },\n \"availability\": {\n \"start_at\": \"2023-09-12T00:00:00Z\",\n \"finish_at\": \"2030-09-20T00:00:00Z\"\n },\n \"payment_method_type\": \"NU_PAY_ENROLLMENT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("public-api-key", "<api-key>")
req.Header.Add("private-secret-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-sandbox.y.uno/v1/installments-plans")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"plan_007\",\n \"account_id\": [\n \"{{account-code}}\"\n ],\n \"merchant_reference\": \"Test\",\n \"installments_plan\": [\n {\n \"installment\": 1,\n \"rate\": 1\n },\n {\n \"installment\": 3,\n \"rate\": 1,\n \"financial_costs\": [\n {\n \"type\": \"CFT\",\n \"rate\": 45.25\n },\n {\n \"type\": \"TEA\",\n \"rate\": 38.5\n }\n ]\n },\n {\n \"installment\": 6,\n \"rate\": 1\n },\n {\n \"installment\": 9,\n \"rate\": 1\n },\n {\n \"installment\": 12,\n \"rate\": 1\n }\n ],\n \"country_code\": \"CO\",\n \"amount\": {\n \"currency\": \"COP\",\n \"min_value\": 0,\n \"max_value\": 100000000\n },\n \"availability\": {\n \"start_at\": \"2023-09-12T00:00:00Z\",\n \"finish_at\": \"2030-09-20T00:00:00Z\"\n },\n \"payment_method_type\": \"NU_PAY_ENROLLMENT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/installments-plans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["public-api-key"] = '<api-key>'
request["private-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"plan_007\",\n \"account_id\": [\n \"{{account-code}}\"\n ],\n \"merchant_reference\": \"Test\",\n \"installments_plan\": [\n {\n \"installment\": 1,\n \"rate\": 1\n },\n {\n \"installment\": 3,\n \"rate\": 1,\n \"financial_costs\": [\n {\n \"type\": \"CFT\",\n \"rate\": 45.25\n },\n {\n \"type\": \"TEA\",\n \"rate\": 38.5\n }\n ]\n },\n {\n \"installment\": 6,\n \"rate\": 1\n },\n {\n \"installment\": 9,\n \"rate\": 1\n },\n {\n \"installment\": 12,\n \"rate\": 1\n }\n ],\n \"country_code\": \"CO\",\n \"amount\": {\n \"currency\": \"COP\",\n \"min_value\": 0,\n \"max_value\": 100000000\n },\n \"availability\": {\n \"start_at\": \"2023-09-12T00:00:00Z\",\n \"finish_at\": \"2030-09-20T00:00:00Z\"\n },\n \"payment_method_type\": \"NU_PAY_ENROLLMENT\"\n}"
response = http.request(request)
puts response.read_body{
"id": "4d573425-33f9-4c46-b009-2c7e749b0ec7",
"name": "plan_007",
"account_id": [
"f7c5fe77-721b-49c2-84d3-957748df3c2c"
],
"merchant_reference": "Test",
"installments_plan": [
{
"installment": 1,
"rate": 1,
"provider_id": ""
},
{
"installment": 3,
"rate": 1,
"provider_id": "",
"financial_costs": [
{
"type": "CFT",
"rate": 45.25,
"formatted_value": "45,25%"
},
{
"type": "TEA",
"rate": 38.5,
"formatted_value": "38,50%"
}
]
},
{
"installment": 6,
"rate": 1,
"provider_id": ""
},
{
"installment": 9,
"rate": 1,
"provider_id": ""
},
{
"installment": 12,
"rate": 1,
"provider_id": ""
}
],
"source": "",
"provider_id": "",
"scheme": "",
"brand": [
"VISA"
],
"issuer": "",
"issuer_id": "",
"iin": null,
"country_code": "US",
"first_installment_deferral": 0,
"amount": {
"currency": "USD",
"min_value": 0,
"max_value": 100000000
},
"availability": {
"start_at": "2023-09-12T00:00:00Z",
"finish_at": "2030-09-20T00:00:00Z"
},
"payment_method_type": "NU_PAY_ENROLLMENT",
"created_at": "2023-10-11T17:52:31.886178246Z",
"updated_at": "2023-10-11T17:52:31.886178246Z"
}{
"code": "INVALID_REQUEST",
"messages": [
"Invalid request"
]
}Yuno 允许您创建分期付款计划,提供给您的客户。这些计划可以根据应付金额、币种和所用卡片等因素使用,如下所述:
对于商户创建的分期付款,您还可以在创建结账会话时使用
- 按金额范围筛选(必填): 系统检查该分期付款计划是否适用于您交易的特定金额。仅考虑能够处理该金额的计划。
- 卡 BIN: 系统验证您卡片的 BIN 是否与某些分期付款计划允许的 BIN 匹配。如果匹配,则考虑该计划。
- 特定币种: 仅考虑适用于您所用币种的计划。
- 计划可用性: 系统检查该分期付款计划是否处于活跃状态。仅考虑未过期且可用的计划。
定义计划 ID仅当应用在购买过程中不会改变的固定分期付款计划时,才需要
plan_id。如果未提供 installment.plan_id,SDK 将自动搜索与该账户关联的所有可用分期付款计划,并选择其认为最合适的计划。您应包含 plan_id,以确保应用特定的计划。商户分期付款此 endpoint 仅在商户分期付款集成中需要。对于服务提供商定义的分期付款,我们使用您的支付服务提供商定义的分期付款计划。
plan_id,为每个结账会话指定计划。如果您不发送该参数,我们将使用与结账会话所设条件相匹配的分期付款计划。授权
请求体
application/json
响应
目前响应返回的是首字母大写的 amount.Currency,而不是 amount.currency。请以不区分大小写的方式读取该键。
此页面对您有帮助吗?
⌘I
创建分期计划
curl --request POST \
--url https://api-sandbox.y.uno/v1/installments-plans \
--header 'Content-Type: application/json' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>' \
--data '
{
"name": "plan_007",
"account_id": [
"{{account-code}}"
],
"merchant_reference": "Test",
"installments_plan": [
{
"installment": 1,
"rate": 1
},
{
"installment": 3,
"rate": 1,
"financial_costs": [
{
"type": "CFT",
"rate": 45.25
},
{
"type": "TEA",
"rate": 38.5
}
]
},
{
"installment": 6,
"rate": 1
},
{
"installment": 9,
"rate": 1
},
{
"installment": 12,
"rate": 1
}
],
"country_code": "CO",
"amount": {
"currency": "COP",
"min_value": 0,
"max_value": 100000000
},
"availability": {
"start_at": "2023-09-12T00:00:00Z",
"finish_at": "2030-09-20T00:00:00Z"
},
"payment_method_type": "NU_PAY_ENROLLMENT"
}
'import requests
url = "https://api-sandbox.y.uno/v1/installments-plans"
payload = {
"name": "plan_007",
"account_id": ["{{account-code}}"],
"merchant_reference": "Test",
"installments_plan": [
{
"installment": 1,
"rate": 1
},
{
"installment": 3,
"rate": 1,
"financial_costs": [
{
"type": "CFT",
"rate": 45.25
},
{
"type": "TEA",
"rate": 38.5
}
]
},
{
"installment": 6,
"rate": 1
},
{
"installment": 9,
"rate": 1
},
{
"installment": 12,
"rate": 1
}
],
"country_code": "CO",
"amount": {
"currency": "COP",
"min_value": 0,
"max_value": 100000000
},
"availability": {
"start_at": "2023-09-12T00:00:00Z",
"finish_at": "2030-09-20T00:00:00Z"
},
"payment_method_type": "NU_PAY_ENROLLMENT"
}
headers = {
"public-api-key": "<api-key>",
"private-secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'public-api-key': '<api-key>',
'private-secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'plan_007',
account_id: ['{{account-code}}'],
merchant_reference: 'Test',
installments_plan: [
{installment: 1, rate: 1},
{
installment: 3,
rate: 1,
financial_costs: [{type: 'CFT', rate: 45.25}, {type: 'TEA', rate: 38.5}]
},
{installment: 6, rate: 1},
{installment: 9, rate: 1},
{installment: 12, rate: 1}
],
country_code: 'CO',
amount: {currency: 'COP', min_value: 0, max_value: 100000000},
availability: {start_at: '2023-09-12T00:00:00Z', finish_at: '2030-09-20T00:00:00Z'},
payment_method_type: 'NU_PAY_ENROLLMENT'
})
};
fetch('https://api-sandbox.y.uno/v1/installments-plans', 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-sandbox.y.uno/v1/installments-plans",
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([
'name' => 'plan_007',
'account_id' => [
'{{account-code}}'
],
'merchant_reference' => 'Test',
'installments_plan' => [
[
'installment' => 1,
'rate' => 1
],
[
'installment' => 3,
'rate' => 1,
'financial_costs' => [
[
'type' => 'CFT',
'rate' => 45.25
],
[
'type' => 'TEA',
'rate' => 38.5
]
]
],
[
'installment' => 6,
'rate' => 1
],
[
'installment' => 9,
'rate' => 1
],
[
'installment' => 12,
'rate' => 1
]
],
'country_code' => 'CO',
'amount' => [
'currency' => 'COP',
'min_value' => 0,
'max_value' => 100000000
],
'availability' => [
'start_at' => '2023-09-12T00:00:00Z',
'finish_at' => '2030-09-20T00:00:00Z'
],
'payment_method_type' => 'NU_PAY_ENROLLMENT'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"private-secret-key: <api-key>",
"public-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-sandbox.y.uno/v1/installments-plans"
payload := strings.NewReader("{\n \"name\": \"plan_007\",\n \"account_id\": [\n \"{{account-code}}\"\n ],\n \"merchant_reference\": \"Test\",\n \"installments_plan\": [\n {\n \"installment\": 1,\n \"rate\": 1\n },\n {\n \"installment\": 3,\n \"rate\": 1,\n \"financial_costs\": [\n {\n \"type\": \"CFT\",\n \"rate\": 45.25\n },\n {\n \"type\": \"TEA\",\n \"rate\": 38.5\n }\n ]\n },\n {\n \"installment\": 6,\n \"rate\": 1\n },\n {\n \"installment\": 9,\n \"rate\": 1\n },\n {\n \"installment\": 12,\n \"rate\": 1\n }\n ],\n \"country_code\": \"CO\",\n \"amount\": {\n \"currency\": \"COP\",\n \"min_value\": 0,\n \"max_value\": 100000000\n },\n \"availability\": {\n \"start_at\": \"2023-09-12T00:00:00Z\",\n \"finish_at\": \"2030-09-20T00:00:00Z\"\n },\n \"payment_method_type\": \"NU_PAY_ENROLLMENT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("public-api-key", "<api-key>")
req.Header.Add("private-secret-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-sandbox.y.uno/v1/installments-plans")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"plan_007\",\n \"account_id\": [\n \"{{account-code}}\"\n ],\n \"merchant_reference\": \"Test\",\n \"installments_plan\": [\n {\n \"installment\": 1,\n \"rate\": 1\n },\n {\n \"installment\": 3,\n \"rate\": 1,\n \"financial_costs\": [\n {\n \"type\": \"CFT\",\n \"rate\": 45.25\n },\n {\n \"type\": \"TEA\",\n \"rate\": 38.5\n }\n ]\n },\n {\n \"installment\": 6,\n \"rate\": 1\n },\n {\n \"installment\": 9,\n \"rate\": 1\n },\n {\n \"installment\": 12,\n \"rate\": 1\n }\n ],\n \"country_code\": \"CO\",\n \"amount\": {\n \"currency\": \"COP\",\n \"min_value\": 0,\n \"max_value\": 100000000\n },\n \"availability\": {\n \"start_at\": \"2023-09-12T00:00:00Z\",\n \"finish_at\": \"2030-09-20T00:00:00Z\"\n },\n \"payment_method_type\": \"NU_PAY_ENROLLMENT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/installments-plans")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["public-api-key"] = '<api-key>'
request["private-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"plan_007\",\n \"account_id\": [\n \"{{account-code}}\"\n ],\n \"merchant_reference\": \"Test\",\n \"installments_plan\": [\n {\n \"installment\": 1,\n \"rate\": 1\n },\n {\n \"installment\": 3,\n \"rate\": 1,\n \"financial_costs\": [\n {\n \"type\": \"CFT\",\n \"rate\": 45.25\n },\n {\n \"type\": \"TEA\",\n \"rate\": 38.5\n }\n ]\n },\n {\n \"installment\": 6,\n \"rate\": 1\n },\n {\n \"installment\": 9,\n \"rate\": 1\n },\n {\n \"installment\": 12,\n \"rate\": 1\n }\n ],\n \"country_code\": \"CO\",\n \"amount\": {\n \"currency\": \"COP\",\n \"min_value\": 0,\n \"max_value\": 100000000\n },\n \"availability\": {\n \"start_at\": \"2023-09-12T00:00:00Z\",\n \"finish_at\": \"2030-09-20T00:00:00Z\"\n },\n \"payment_method_type\": \"NU_PAY_ENROLLMENT\"\n}"
response = http.request(request)
puts response.read_body{
"id": "4d573425-33f9-4c46-b009-2c7e749b0ec7",
"name": "plan_007",
"account_id": [
"f7c5fe77-721b-49c2-84d3-957748df3c2c"
],
"merchant_reference": "Test",
"installments_plan": [
{
"installment": 1,
"rate": 1,
"provider_id": ""
},
{
"installment": 3,
"rate": 1,
"provider_id": "",
"financial_costs": [
{
"type": "CFT",
"rate": 45.25,
"formatted_value": "45,25%"
},
{
"type": "TEA",
"rate": 38.5,
"formatted_value": "38,50%"
}
]
},
{
"installment": 6,
"rate": 1,
"provider_id": ""
},
{
"installment": 9,
"rate": 1,
"provider_id": ""
},
{
"installment": 12,
"rate": 1,
"provider_id": ""
}
],
"source": "",
"provider_id": "",
"scheme": "",
"brand": [
"VISA"
],
"issuer": "",
"issuer_id": "",
"iin": null,
"country_code": "US",
"first_installment_deferral": 0,
"amount": {
"currency": "USD",
"min_value": 0,
"max_value": 100000000
},
"availability": {
"start_at": "2023-09-12T00:00:00Z",
"finish_at": "2030-09-20T00:00:00Z"
},
"payment_method_type": "NU_PAY_ENROLLMENT",
"created_at": "2023-10-11T17:52:31.886178246Z",
"updated_at": "2023-10-11T17:52:31.886178246Z"
}{
"code": "INVALID_REQUEST",
"messages": [
"Invalid request"
]
}