curl --request POST \
--url https://api.fintoc.com/v1/subscription_intents \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"business_profile": {
"name": "Hooli"
},
"customer_email": "payer@example.com",
"reference_id": "ABC12345"
}
'import requests
url = "https://api.fintoc.com/v1/subscription_intents"
payload = {
"business_profile": { "name": "Hooli" },
"customer_email": "payer@example.com",
"reference_id": "ABC12345"
}
headers = {
"Authorization": "<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>', 'Content-Type': 'application/json'},
body: JSON.stringify({
business_profile: {name: 'Hooli'},
customer_email: 'payer@example.com',
reference_id: 'ABC12345'
})
};
fetch('https://api.fintoc.com/v1/subscription_intents', 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.fintoc.com/v1/subscription_intents",
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([
'business_profile' => [
'name' => 'Hooli'
],
'customer_email' => 'payer@example.com',
'reference_id' => 'ABC12345'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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.fintoc.com/v1/subscription_intents"
payload := strings.NewReader("{\n \"business_profile\": {\n \"name\": \"Hooli\"\n },\n \"customer_email\": \"payer@example.com\",\n \"reference_id\": \"ABC12345\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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.fintoc.com/v1/subscription_intents")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"business_profile\": {\n \"name\": \"Hooli\"\n },\n \"customer_email\": \"payer@example.com\",\n \"reference_id\": \"ABC12345\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fintoc.com/v1/subscription_intents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"business_profile\": {\n \"name\": \"Hooli\"\n },\n \"customer_email\": \"payer@example.com\",\n \"reference_id\": \"ABC12345\"\n}"
response = http.request(request)
puts response.read_body{
"id": "si_mceqLoFwfBVHi3q4",
"object": "subscription_intent",
"business_profile": {
"name": "Hooli"
},
"created_at": "2023-03-08T15:24:11Z",
"customer_email": "payer@example.com",
"mode": "live",
"public_error": null,
"reference_id": "ABC12345",
"status": "created",
"subscription": null,
"widget_token": "si_mceqLoFwfBVHi3q4_sec_a8Mw9bnHzgVRCMTSDgrJpvkN"
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_reference_id_format",
"param": "reference_id",
"message": "Invalid id format. Should only contain numbers and uppercase letters: abc123",
"doc_url": "https://docs.fintoc.com/reference/errors"
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Invalid API Key: invalid-*oken"
}
}{
"error": {
"type": "authorization_error",
"code": "product_access_required",
"param": null,
"message": "Your organization does not have access to the 'Subscriptions' product. To request access, email sales@fintoc.com.",
"doc_url": "https://docs.fintoc.com/reference/errors"
}
}Create a subscription intent
Creates a subscription intent in the live or test mode of the API key used. The response includes the widget_token used to open the widget so the payer can authorize the subscription.
curl --request POST \
--url https://api.fintoc.com/v1/subscription_intents \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"business_profile": {
"name": "Hooli"
},
"customer_email": "payer@example.com",
"reference_id": "ABC12345"
}
'import requests
url = "https://api.fintoc.com/v1/subscription_intents"
payload = {
"business_profile": { "name": "Hooli" },
"customer_email": "payer@example.com",
"reference_id": "ABC12345"
}
headers = {
"Authorization": "<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>', 'Content-Type': 'application/json'},
body: JSON.stringify({
business_profile: {name: 'Hooli'},
customer_email: 'payer@example.com',
reference_id: 'ABC12345'
})
};
fetch('https://api.fintoc.com/v1/subscription_intents', 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.fintoc.com/v1/subscription_intents",
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([
'business_profile' => [
'name' => 'Hooli'
],
'customer_email' => 'payer@example.com',
'reference_id' => 'ABC12345'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$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.fintoc.com/v1/subscription_intents"
payload := strings.NewReader("{\n \"business_profile\": {\n \"name\": \"Hooli\"\n },\n \"customer_email\": \"payer@example.com\",\n \"reference_id\": \"ABC12345\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<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.fintoc.com/v1/subscription_intents")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"business_profile\": {\n \"name\": \"Hooli\"\n },\n \"customer_email\": \"payer@example.com\",\n \"reference_id\": \"ABC12345\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fintoc.com/v1/subscription_intents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"business_profile\": {\n \"name\": \"Hooli\"\n },\n \"customer_email\": \"payer@example.com\",\n \"reference_id\": \"ABC12345\"\n}"
response = http.request(request)
puts response.read_body{
"id": "si_mceqLoFwfBVHi3q4",
"object": "subscription_intent",
"business_profile": {
"name": "Hooli"
},
"created_at": "2023-03-08T15:24:11Z",
"customer_email": "payer@example.com",
"mode": "live",
"public_error": null,
"reference_id": "ABC12345",
"status": "created",
"subscription": null,
"widget_token": "si_mceqLoFwfBVHi3q4_sec_a8Mw9bnHzgVRCMTSDgrJpvkN"
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_reference_id_format",
"param": "reference_id",
"message": "Invalid id format. Should only contain numbers and uppercase letters: abc123",
"doc_url": "https://docs.fintoc.com/reference/errors"
}
}{
"error": {
"type": "authentication_error",
"code": "invalid_api_key",
"message": "Invalid API Key: invalid-*oken"
}
}{
"error": {
"type": "authorization_error",
"code": "product_access_required",
"param": null,
"message": "Your organization does not have access to the 'Subscriptions' product. To request access, email sales@fintoc.com.",
"doc_url": "https://docs.fintoc.com/reference/errors"
}
}Cuerpo
Identifier the payer's bank uses to display the subscription on the bank's portal. Up to 15 characters, uppercase letters and numbers only, and not already in use by another subscription intent that has not failed. When omitted, reference_id is null on the subscription intent and defaults to the account holder's ID on the resulting Subscription.
"ABC12345"
Respuesta
The created subscription intent. widget_token is only returned in this response.
Represents the flow a payer goes through to authorize a subscription at their bank. A successful subscription intent produces a Subscription.
Error code describing why the subscription intent did not succeed. null unless status is failed or rejected.
null, login_invalid_credentials, login_credentials_locked, authorization_timeout, mfa_authorization_timeout, mfa_unavailable, bank_connection_error, bank_not_available, password_change_required, request_timeout, subscription_intent_expired, account_type_not_permitted, internal_error, user_left "login_invalid_credentials"
Status of the subscription intent. One of created (waiting for the payer to start the authorization), in_progress (the payer is authorizing the subscription at their bank), succeeded (the payer authorized the subscription), failed (the authorization failed or expired), or rejected (the payer's bank rejected the subscription).
created, in_progress, succeeded, failed, rejected "succeeded"
¿Esta página le ayudó?