Charge a subscription invoice
curl --request POST \
--url https://b.anny.co/api/v1/invoices/{invoice_id}/charge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment_setup_id": "9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80"
}
'import requests
url = "https://b.anny.co/api/v1/invoices/{invoice_id}/charge"
payload = { "payment_setup_id": "9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80" }
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({payment_setup_id: '9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80'})
};
fetch('https://b.anny.co/api/v1/invoices/{invoice_id}/charge', 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://b.anny.co/api/v1/invoices/{invoice_id}/charge",
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([
'payment_setup_id' => '9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80'
]),
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://b.anny.co/api/v1/invoices/{invoice_id}/charge"
payload := strings.NewReader("{\n \"payment_setup_id\": \"9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80\"\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://b.anny.co/api/v1/invoices/{invoice_id}/charge")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payment_setup_id\": \"9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://b.anny.co/api/v1/invoices/{invoice_id}/charge")
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 \"payment_setup_id\": \"9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"type": "invoices",
"attributes": {
"number": "<string>",
"formatted_number": "<string>",
"currency": "<string>",
"is_cancellation": true,
"is_credit": true,
"has_payment": true,
"show_transfer_note": true,
"vat_number": "<string>",
"notes": "<string>",
"recipient": "<string>",
"invoicing_party": "<string>",
"total": 123,
"net_amount": 123,
"tax_amount": 123,
"status": "draft",
"is_processing": true,
"access_token": "<string>",
"issued_at": "<string>",
"due_date": "<string>",
"created_at": "<string>"
},
"links": {
"self": "<string>"
},
"relationships": {
"order": {
"data": {
"type": "<string>",
"id": "<string>"
},
"links": {
"self": "<string>"
}
},
"items": {
"data": [
{
"type": "<string>",
"id": "<string>"
}
],
"links": {
"self": "<string>"
}
},
"payments": {
"data": [
{
"type": "<string>",
"id": "<string>"
}
],
"links": {
"self": "<string>"
}
},
"organization": {
"data": {
"type": "<string>",
"id": "<string>"
},
"links": {
"self": "<string>"
}
}
}
},
"meta": {
"payment": {
"id": "<string>",
"status": "<string>",
"amount": 123
}
}
}Orders & Billing
Charge a subscription invoice
Charge the open amount of a subscription invoice again, off-session, with a stored payment method: the subscription’s own, or another confirmed payment setup of the same subscriber (payment_setup_id).
Refused for invoices that do not belong to a subscription, are not open (paid, draft, void, partially paid), while a payment is pending, for a payment setup of another customer or one that is unconfirmed, deleted, of the wrong payment account or currency, and after 3 attempts per invoice and day.
The response carries the attempt’s payment in meta.payment. Rate limit: 60 requests per hour per user, shared with sending payment reminders.
POST
/
api
/
v1
/
invoices
/
{invoice_id}
/
charge
Charge a subscription invoice
curl --request POST \
--url https://b.anny.co/api/v1/invoices/{invoice_id}/charge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment_setup_id": "9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80"
}
'import requests
url = "https://b.anny.co/api/v1/invoices/{invoice_id}/charge"
payload = { "payment_setup_id": "9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80" }
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({payment_setup_id: '9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80'})
};
fetch('https://b.anny.co/api/v1/invoices/{invoice_id}/charge', 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://b.anny.co/api/v1/invoices/{invoice_id}/charge",
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([
'payment_setup_id' => '9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80'
]),
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://b.anny.co/api/v1/invoices/{invoice_id}/charge"
payload := strings.NewReader("{\n \"payment_setup_id\": \"9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80\"\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://b.anny.co/api/v1/invoices/{invoice_id}/charge")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payment_setup_id\": \"9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://b.anny.co/api/v1/invoices/{invoice_id}/charge")
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 \"payment_setup_id\": \"9b2f6c1e-4a7d-4e0b-8c3f-2d5a1e6b7c80\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"type": "invoices",
"attributes": {
"number": "<string>",
"formatted_number": "<string>",
"currency": "<string>",
"is_cancellation": true,
"is_credit": true,
"has_payment": true,
"show_transfer_note": true,
"vat_number": "<string>",
"notes": "<string>",
"recipient": "<string>",
"invoicing_party": "<string>",
"total": 123,
"net_amount": 123,
"tax_amount": 123,
"status": "draft",
"is_processing": true,
"access_token": "<string>",
"issued_at": "<string>",
"due_date": "<string>",
"created_at": "<string>"
},
"links": {
"self": "<string>"
},
"relationships": {
"order": {
"data": {
"type": "<string>",
"id": "<string>"
},
"links": {
"self": "<string>"
}
},
"items": {
"data": [
{
"type": "<string>",
"id": "<string>"
}
],
"links": {
"self": "<string>"
}
},
"payments": {
"data": [
{
"type": "<string>",
"id": "<string>"
}
],
"links": {
"self": "<string>"
}
},
"organization": {
"data": {
"type": "<string>",
"id": "<string>"
},
"links": {
"self": "<string>"
}
}
}
},
"meta": {
"payment": {
"id": "<string>",
"status": "<string>",
"amount": 123
}
}
}Autorisierungen
Body
application/json