Simulations (Sandbox only)
Unit's Sandbox environment provides additional operations on top of the regular APIs. Those operations allow you to easily test and simulate activities that would normally take a long time or require interaction with the external world.
A common example for testing would be Simulating a Received ACH Payment to create funds in an account, followed by Simulating a Card Purchase to spend those funds.
Simulation operations are subject to the same authentication scheme as the Live APIs, and therefore require a valid Authentication token.
Transmit ACH repayment
This API allows you to simulate a file transmission to the network for an existing ACH repayment with Pending
status.
This operation will also transmit the underlying ACH payment.
After transmission, the status would change to Clearing
for the ACH repayment and the underlying ACH Debit payment.
Payment Clearing and Repayment Status Changed webhook events will be fired.
Verb | POST |
Url | https://api.s.unit.sh/sandbox/ach-repayments/transmit |
Data Type | transmitAchRepayment |
Timeout (Seconds) | 5 |
Relationships
Name | Type | Description |
---|---|---|
repayment | JSON:API Relationship | The ACH Repayment to transmit. |
curl -X POST 'https://api.s.unit.sh/sandbox/ach-repayments/transmit'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "transmitAchRepayment",
"relationships": {
"repayment": {
"data": {
"type": "achRepayment",
"id": "10"
}
}
}
}
}'
{
"data": {
"type": "achRepayment",
"id": "8",
"attributes": {
"createdAt": "2024-05-02T13:56:15.975Z",
"amount": 1,
"direction": "Debit",
"description": "test",
"isCapitalPartner": false,
"status": "Clearing",
"reason": null
},
"relationships": {
"account": {
"data": {
"type": "account",
"id": "10003"
}
},
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10034"
}
},
"counterparty": {
"data": {
"type": "counterparty",
"id": "1"
}
},
"payment": {
"data": {
"type": "payment",
"id": "1048"
}
}
}
}
}
Clear ACH repayment
This API allows you to immediately clear an existing ACH repayment with Clearing
status without waiting for the end of the clearing period.
The Payment Sent, Repayment Status Changed and Transaction Created webhook events will be fired.
Verb | POST |
Url | https://api.s.unit.sh/sandbox/ach-repayments/clear |
Data Type | clearAchrepayment |
Timeout (Seconds) | 5 |
Relationships
Name | Type | Description |
---|---|---|
repayment | JSON:API Relationship | The ACH Repayment to be cleared. |
curl -X POST 'https://api.s.unit.sh/sandbox/ach-repayments/clear'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "clearAchRepayment",
"relationships": {
"repayment": {
"data": {
"type": "achRepayment",
"id": "10"
}
}
}
}
}'
{
"data": {
"type": "achRepayment",
"id": "8",
"attributes": {
"createdAt": "2024-05-02T13:56:15.975Z",
"amount": 1,
"direction": "Debit",
"description": "test",
"isCapitalPartner": false,
"status": "Sent",
"reason": null
},
"relationships": {
"account": {
"data": {
"type": "account",
"id": "10003"
}
},
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10034"
}
},
"counterparty": {
"data": {
"type": "counterparty",
"id": "1"
}
},
"payment": {
"data": {
"type": "payment",
"id": "1048"
}
}
}
}
}
Return ACH repayment
This API allows you to return an existing ACH repayment for testing purposes, the status of repayment can either be Clearing
or Sent
.
The Repayment Status Changed, Payment Returned for the underlying payment and Transaction Created webhook events will be fired.
Verb | POST |
Url | https://api.s.unit.sh/sandbox/ach-repayments/return |
Data Type | returnAchRepayment |
Timeout (Seconds) | 5 |
Relationships
Name | Type | Description |
---|---|---|
repayment | JSON:API Relationship | The ACH Repayment to be returned. |
curl -X POST 'https://api.s.unit.sh/sandbox/ach-repayments/return'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "returnAchRepayment",
"relationships": {
"repayment": {
"data": {
"type": "achRepayment",
"id": "10"
}
}
}
}
}'
{
"data": {
"type": "achRepayment",
"id": "5",
"attributes": {
"createdAt": "2024-04-30T15:18:56.677Z",
"amount": 1,
"direction": "Debit",
"description": "test",
"isCapitalPartner": true,
"status": "Returned",
"reason": "R01"
},
"relationships": {
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10010"
}
},
"counterparty": {
"data": {
"type": "counterparty",
"id": "1"
}
},
"payment": {
"data": {
"type": "payment",
"id": "1045"
}
}
}
}
}
Simulate Originating Recurring Repayment
Simulates an origination of a repayment from a Recurring Repayment program. This allows you to simulate the creation of a scheduled Repayment without needing to wait for the full cycle to end. After originating a repayment, a Repayment Created, Payment Created for the underlying payment and Transaction Created webhook events will be fired.
NOTE: if the provided Credit Account has a balance of 0, a Recurring Repayment Skipped event will be fired instead.
Verb | POST |
Url | https://api.s.unit.sh/sandbox/recurring-repayments/5/originate |
Timeout (Seconds) | 5 |
curl -X POST 'https://api.s.unit.sh/sandbox/recurring-repayments/5/originate'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{}'
{
"data": {
"type": "recurringCapitalPartnerBookRepayment",
"id": "1",
"attributes": {
"createdAt": "2024-02-29T11:27:13.751Z",
"updatedAt": "2024-05-02T13:26:21.269Z",
"schedule": {
"startTime": "2024-02-21",
"interval": "Monthly",
"nextScheduledAction": "2024-07-21",
"dayOfMonth": 21
},
"description": "Capital Partner Book Repayments",
"transactionSummaryOverride": "override",
"tags": {},
"numberOfRepayments": 4,
"status": "Active"
},
"relationships": {
"org": {
"data": {
"type": "org",
"id": "1"
}
},
"creditAccount": {
"data": {
"type": "creditAccount",
"id": "10005"
}
},
"counterpartyAccount": {
"data": {
"type": "account",
"id": "10012"
}
},
"customer": {
"data": {
"type": "customer",
"id": "10000"
}
}
}
}
}