curl --request POST \
--url https://sandbox-api.superpagamentos.com/subscriptions/add_split \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subaccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"splitAmount": 123,
"splitPercentage": 123,
"chargebackLiable": true
}
'import requests
url = "https://sandbox-api.superpagamentos.com/subscriptions/add_split"
payload = {
"subscriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subaccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"splitAmount": 123,
"splitPercentage": 123,
"chargebackLiable": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscriptionId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
subaccountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
splitAmount: 123,
splitPercentage: 123,
chargebackLiable: true
})
};
fetch('https://sandbox-api.superpagamentos.com/subscriptions/add_split', 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://sandbox-api.superpagamentos.com/subscriptions/add_split",
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([
'subscriptionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'subaccountId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'splitAmount' => 123,
'splitPercentage' => 123,
'chargebackLiable' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://sandbox-api.superpagamentos.com/subscriptions/add_split"
payload := strings.NewReader("{\n \"subscriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"subaccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"splitAmount\": 123,\n \"splitPercentage\": 123,\n \"chargebackLiable\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://sandbox-api.superpagamentos.com/subscriptions/add_split")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subscriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"subaccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"splitAmount\": 123,\n \"splitPercentage\": 123,\n \"chargebackLiable\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.superpagamentos.com/subscriptions/add_split")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subscriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"subaccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"splitAmount\": 123,\n \"splitPercentage\": 123,\n \"chargebackLiable\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subaccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"splitType": "AMOUNT",
"splitPercentage": 123,
"splitAmount": 123,
"liquidAmount": 123,
"chargebackLiable": true
},
"message": "Split adicionado com sucesso"
}Adicionar split na assinatura
Adiciona um novo split para uma assinatura existente. O split pode ser configurado por valor fixo (amount) ou porcentagem (percentage) do valor da assinatura. É possível definir se a subconta será responsável pelos chargebacks da assinatura através do campo chargebackLiable.
Importante:
- Para splits do tipo ‘amount’, o campo splitAmount é obrigatório
- Para splits do tipo ‘percentage’, o campo splitPercentage é obrigatório
- O valor total dos splits não pode ultrapassar o valor disponível após a taxa da assinatura
- A subconta deve estar aprovada para realizar a operação
curl --request POST \
--url https://sandbox-api.superpagamentos.com/subscriptions/add_split \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"subscriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subaccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"splitAmount": 123,
"splitPercentage": 123,
"chargebackLiable": true
}
'import requests
url = "https://sandbox-api.superpagamentos.com/subscriptions/add_split"
payload = {
"subscriptionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subaccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"splitAmount": 123,
"splitPercentage": 123,
"chargebackLiable": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
subscriptionId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
subaccountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
splitAmount: 123,
splitPercentage: 123,
chargebackLiable: true
})
};
fetch('https://sandbox-api.superpagamentos.com/subscriptions/add_split', 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://sandbox-api.superpagamentos.com/subscriptions/add_split",
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([
'subscriptionId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'subaccountId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'splitAmount' => 123,
'splitPercentage' => 123,
'chargebackLiable' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://sandbox-api.superpagamentos.com/subscriptions/add_split"
payload := strings.NewReader("{\n \"subscriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"subaccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"splitAmount\": 123,\n \"splitPercentage\": 123,\n \"chargebackLiable\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://sandbox-api.superpagamentos.com/subscriptions/add_split")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"subscriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"subaccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"splitAmount\": 123,\n \"splitPercentage\": 123,\n \"chargebackLiable\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-api.superpagamentos.com/subscriptions/add_split")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"subscriptionId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"subaccountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"splitAmount\": 123,\n \"splitPercentage\": 123,\n \"chargebackLiable\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"subaccountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"splitType": "AMOUNT",
"splitPercentage": 123,
"splitAmount": 123,
"liquidAmount": 123,
"chargebackLiable": true
},
"message": "Split adicionado com sucesso"
}Authorizations
Token JWT gerado na rota de autenticação (/auth). Deve ser enviado no formato: Bearer
Body
Dados necessários para adicionar um split à assinatura
Identificador único da assinatura que receberá o split
Identificador único da subconta que receberá o split
Tipo do split. 'amount' para valor fixo ou 'percentage' para porcentagem do valor da assinatura
amount, percentage Valor fixo do split em centavos. Obrigatório quando splitType é 'amount'
Porcentagem do valor da assinatura que será destinada ao split. Obrigatório quando splitType é 'percentage'. Aceita valores decimais com até 2 casas (ex: 80 ou 80.50)
Define se a subconta será responsável pelos chargebacks da assinatura. Se não informado, o valor padrão é false