Add earnings to many payees
curl --request POST \
--url https://api.easner.com/v1/credits/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"count": 2,
"total": 30353,
"credits": [
{
"payee": "pye_example",
"amount": 10000,
"reference": "oct-a"
},
{
"payee": "pye_example2",
"amount": 20353,
"reference": "oct-b"
}
]
}
'import requests
url = "https://api.easner.com/v1/credits/batch"
payload = {
"count": 2,
"total": 30353,
"credits": [
{
"payee": "pye_example",
"amount": 10000,
"reference": "oct-a"
},
{
"payee": "pye_example2",
"amount": 20353,
"reference": "oct-b"
}
]
}
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({
count: 2,
total: 30353,
credits: [
{payee: 'pye_example', amount: 10000, reference: 'oct-a'},
{payee: 'pye_example2', amount: 20353, reference: 'oct-b'}
]
})
};
fetch('https://api.easner.com/v1/credits/batch', 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.easner.com/v1/credits/batch",
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([
'count' => 2,
'total' => 30353,
'credits' => [
[
'payee' => 'pye_example',
'amount' => 10000,
'reference' => 'oct-a'
],
[
'payee' => 'pye_example2',
'amount' => 20353,
'reference' => 'oct-b'
]
]
]),
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://api.easner.com/v1/credits/batch"
payload := strings.NewReader("{\n \"count\": 2,\n \"total\": 30353,\n \"credits\": [\n {\n \"payee\": \"pye_example\",\n \"amount\": 10000,\n \"reference\": \"oct-a\"\n },\n {\n \"payee\": \"pye_example2\",\n \"amount\": 20353,\n \"reference\": \"oct-b\"\n }\n ]\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))
}require 'uri'
require 'net/http'
url = URI("https://api.easner.com/v1/credits/batch")
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 \"count\": 2,\n \"total\": 30353,\n \"credits\": [\n {\n \"payee\": \"pye_example\",\n \"amount\": 10000,\n \"reference\": \"oct-a\"\n },\n {\n \"payee\": \"pye_example2\",\n \"amount\": 20353,\n \"reference\": \"oct-b\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "credit_batch",
"count": 123,
"total": 123,
"credits": [
{
"id": "<string>",
"object": "credit",
"payee": "<string>",
"reference": "<string>",
"amount": 123,
"on_hold": true,
"replayed": true
}
],
"livemode": true,
"currency": "USD",
"replayed": 123
}{
"id": "<string>",
"object": "credit_batch",
"count": 123,
"total": 123,
"credits": [
{
"id": "<string>",
"object": "credit",
"payee": "<string>",
"reference": "<string>",
"amount": 123,
"on_hold": true,
"replayed": true
}
],
"livemode": true,
"currency": "USD",
"replayed": 123
}{
"error": {
"type": "authentication",
"code": "<string>",
"message": "<string>",
"fields": [
{
"name": "<string>",
"message": "<string>"
}
]
}
}Connect
Add earnings to many payees
Credits up to 1,000 payees in one call, all or nothing. count and total are required control totals: if either does not match, a reference repeats, a payee is not yours or any credit is invalid, nothing is credited. Needs an Idempotency-Key: the same key and credits again credit nothing twice (200); the same key with different credits is 409.
POST
/
v1
/
credits
/
batch
Add earnings to many payees
curl --request POST \
--url https://api.easner.com/v1/credits/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"count": 2,
"total": 30353,
"credits": [
{
"payee": "pye_example",
"amount": 10000,
"reference": "oct-a"
},
{
"payee": "pye_example2",
"amount": 20353,
"reference": "oct-b"
}
]
}
'import requests
url = "https://api.easner.com/v1/credits/batch"
payload = {
"count": 2,
"total": 30353,
"credits": [
{
"payee": "pye_example",
"amount": 10000,
"reference": "oct-a"
},
{
"payee": "pye_example2",
"amount": 20353,
"reference": "oct-b"
}
]
}
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({
count: 2,
total: 30353,
credits: [
{payee: 'pye_example', amount: 10000, reference: 'oct-a'},
{payee: 'pye_example2', amount: 20353, reference: 'oct-b'}
]
})
};
fetch('https://api.easner.com/v1/credits/batch', 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.easner.com/v1/credits/batch",
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([
'count' => 2,
'total' => 30353,
'credits' => [
[
'payee' => 'pye_example',
'amount' => 10000,
'reference' => 'oct-a'
],
[
'payee' => 'pye_example2',
'amount' => 20353,
'reference' => 'oct-b'
]
]
]),
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://api.easner.com/v1/credits/batch"
payload := strings.NewReader("{\n \"count\": 2,\n \"total\": 30353,\n \"credits\": [\n {\n \"payee\": \"pye_example\",\n \"amount\": 10000,\n \"reference\": \"oct-a\"\n },\n {\n \"payee\": \"pye_example2\",\n \"amount\": 20353,\n \"reference\": \"oct-b\"\n }\n ]\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))
}require 'uri'
require 'net/http'
url = URI("https://api.easner.com/v1/credits/batch")
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 \"count\": 2,\n \"total\": 30353,\n \"credits\": [\n {\n \"payee\": \"pye_example\",\n \"amount\": 10000,\n \"reference\": \"oct-a\"\n },\n {\n \"payee\": \"pye_example2\",\n \"amount\": 20353,\n \"reference\": \"oct-b\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "credit_batch",
"count": 123,
"total": 123,
"credits": [
{
"id": "<string>",
"object": "credit",
"payee": "<string>",
"reference": "<string>",
"amount": 123,
"on_hold": true,
"replayed": true
}
],
"livemode": true,
"currency": "USD",
"replayed": 123
}{
"id": "<string>",
"object": "credit_batch",
"count": 123,
"total": 123,
"credits": [
{
"id": "<string>",
"object": "credit",
"payee": "<string>",
"reference": "<string>",
"amount": 123,
"on_hold": true,
"replayed": true
}
],
"livemode": true,
"currency": "USD",
"replayed": 123
}{
"error": {
"type": "authentication",
"code": "<string>",
"message": "<string>",
"fields": [
{
"name": "<string>",
"message": "<string>"
}
]
}
}Authorizations
Headers
Body
application/json
Response
The same batch again, nothing was credited twice.
