JavaScript
import Finch from '@tryfinch/finch-api';
const client = new Finch({
accessToken: 'My Access Token',
});
const payment = await client.sandbox.payment.create();
console.log(payment.payment_id);from finch import Finch
client = Finch(
access_token="My Access Token",
)
payment = client.sandbox.payment.create()
print(payment.payment_id)package main
import (
"context"
"fmt"
"github.com/Finch-API/finch-api-go"
"github.com/Finch-API/finch-api-go/option"
)
func main() {
client := finchgo.NewClient(
option.WithAccessToken("My Access Token"),
)
payment, err := client.Sandbox.Payment.New(context.TODO(), finchgo.SandboxPaymentNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", payment.PaymentID)
}
package com.tryfinch.api.example;
import com.tryfinch.api.client.FinchClient;
import com.tryfinch.api.client.okhttp.FinchOkHttpClient;
import com.tryfinch.api.models.PaymentCreateResponse;
import com.tryfinch.api.models.SandboxPaymentCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
FinchClient client = FinchOkHttpClient.builder()
.fromEnv()
.accessToken("My Access Token")
.build();
PaymentCreateResponse payment = client.sandbox().payment().create();
}
}package com.tryfinch.api.example
import com.tryfinch.api.client.FinchClient
import com.tryfinch.api.client.okhttp.FinchOkHttpClient
import com.tryfinch.api.models.PaymentCreateResponse
import com.tryfinch.api.models.SandboxPaymentCreateParams
fun main() {
val client: FinchClient = FinchOkHttpClient.builder()
.fromEnv()
.accessToken("My Access Token")
.build()
val payment: PaymentCreateResponse = client.sandbox().payment().create()
}require "finch_api"
finch = FinchAPI::Client.new(access_token: "My Access Token")
payment = finch.sandbox.payment.create
puts(payment)curl --request POST \
--url https://api.tryfinch.com/sandbox/payment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"pay_statements": [
{
"individual_id": "b2338cfb-472f-4f72-9faa-e028c083144a",
"employee_deductions": [
{
"name": "401k test",
"type": "401k",
"amount": 2000,
"currency": "usd"
}
]
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tryfinch.com/sandbox/payment",
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([
'pay_statements' => [
[
'individual_id' => 'b2338cfb-472f-4f72-9faa-e028c083144a',
'employee_deductions' => [
[
'name' => '401k test',
'type' => '401k',
'amount' => 2000,
'currency' => 'usd'
]
]
]
]
]),
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;
}{
"payment_id": "some-payment-id",
"pay_date": "2024-01-01"
}Sandbox
Add a new sandbox payment
POST
/
sandbox
/
payment
JavaScript
import Finch from '@tryfinch/finch-api';
const client = new Finch({
accessToken: 'My Access Token',
});
const payment = await client.sandbox.payment.create();
console.log(payment.payment_id);from finch import Finch
client = Finch(
access_token="My Access Token",
)
payment = client.sandbox.payment.create()
print(payment.payment_id)package main
import (
"context"
"fmt"
"github.com/Finch-API/finch-api-go"
"github.com/Finch-API/finch-api-go/option"
)
func main() {
client := finchgo.NewClient(
option.WithAccessToken("My Access Token"),
)
payment, err := client.Sandbox.Payment.New(context.TODO(), finchgo.SandboxPaymentNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", payment.PaymentID)
}
package com.tryfinch.api.example;
import com.tryfinch.api.client.FinchClient;
import com.tryfinch.api.client.okhttp.FinchOkHttpClient;
import com.tryfinch.api.models.PaymentCreateResponse;
import com.tryfinch.api.models.SandboxPaymentCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
FinchClient client = FinchOkHttpClient.builder()
.fromEnv()
.accessToken("My Access Token")
.build();
PaymentCreateResponse payment = client.sandbox().payment().create();
}
}package com.tryfinch.api.example
import com.tryfinch.api.client.FinchClient
import com.tryfinch.api.client.okhttp.FinchOkHttpClient
import com.tryfinch.api.models.PaymentCreateResponse
import com.tryfinch.api.models.SandboxPaymentCreateParams
fun main() {
val client: FinchClient = FinchOkHttpClient.builder()
.fromEnv()
.accessToken("My Access Token")
.build()
val payment: PaymentCreateResponse = client.sandbox().payment().create()
}require "finch_api"
finch = FinchAPI::Client.new(access_token: "My Access Token")
payment = finch.sandbox.payment.create
puts(payment)curl --request POST \
--url https://api.tryfinch.com/sandbox/payment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"pay_statements": [
{
"individual_id": "b2338cfb-472f-4f72-9faa-e028c083144a",
"employee_deductions": [
{
"name": "401k test",
"type": "401k",
"amount": 2000,
"currency": "usd"
}
]
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tryfinch.com/sandbox/payment",
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([
'pay_statements' => [
[
'individual_id' => 'b2338cfb-472f-4f72-9faa-e028c083144a',
'employee_deductions' => [
[
'name' => '401k test',
'type' => '401k',
'amount' => 2000,
'currency' => 'usd'
]
]
]
]
]),
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;
}{
"payment_id": "some-payment-id",
"pay_date": "2024-01-01"
}All fields are optional. If you don’t provide a start and end date, the default
start_date is one business day after the end_date of the most recently created payment, and the default end_date is start_date + 14 business days. The default pay_date is the end_date and the default debit_date is one business day after the pay_date.
You may override any fields in the pay statements you would like. By default, no taxes, earnings or deductions are created (unless an individual is enrolled in deductions via the /benefits endpoints).Authorizations
Please use your Access Token
Body
application/json
Fields to configure the payment. Takes all fields from the /payment endpoint. All fields are optional.
Was this page helpful?
⌘I