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.
Create Dispute
This API allows you to create a new dispute for an existing purchase transaction. The Dispute Created webhook event will be fired.
Verb | POST |
Url | https://api.s.unit.sh/sandbox/disputes |
Timeout (Seconds) | 5 |
Attributes
Name | Type | Description |
---|---|---|
amount | integer | Optional. The amount (in cents). If this field is not populated, the dispute amount will equal the amount of the disputed transaction. |
Relationships
Name | Type | Description |
---|---|---|
account | JSON:API Relationship | The Deposit Account related to the transaction. |
transaction | JSON:API Relationship | The disputed purchase transaction. |
curl -X POST 'https://api.s.unit.sh/sandbox/disputes'
-H 'Content-Type: application/vnd.api+json'
-H 'Authorization: Bearer ${TOKEN}'
--data-raw '{
"data": {
"type": "dispute",
"attributes": {
"amount": 123
},
"relationships": {
"account": {
"data": {
"type": "account",
"id": "10002"
}
},
"transaction": {
"data": {
"type": "transaction",
"id": "5"
}
}
}
}
}'
{
"data": {
"type": "dispute",
"id": "1",
"attributes": {
"source": "DebitCard",
"link": "https://sandbox-dispute.com",
"statusHistory": [
{
"type": "InvestigationStarted",
"updatedAt": "2022-05-19T12:21:34.156Z"
}
],
"status": "InvestigationStarted",
"description": "sandbox dispute",
"createdAt": "2022-05-19T12:21:34.156Z",
"amount": 305
},
"relationships": {
"customer": {
"data": {
"type": "customer",
"id": "10004"
}
},
"account": {
"data": {
"type": "account",
"id": "10002"
}
},
"transaction": {
"data": {
"type": "transaction",
"id": "5"
}
}
}
}
}
Provisional Credit Dispute
This API allows you to grant the customer Provisional Credit for an existing dispute. The Dispute Status Changed webhook event will be fired.
Verb | POST |
Url | https://api.s.unit.sh/sandbox/disputes/{disputeId}/credit-provisionally |
Timeout (Seconds) | 5 |
curl -X POST 'https://api.s.unit.sh/sandbox/disputes/12/credit-provisionally' \
-H "Authorization: Bearer ${TOKEN}"
{
"data": {
"type": "dispute",
"id": "12",
"attributes": {
"source": "DebitCard",
"link": "https://sandbox-dispute.com",
"statusHistory": [
{
"type": "InvestigationStarted",
"updatedAt": "2022-06-06T12:25:15.577Z"
},
{
"type": "ProvisionallyCredited",
"updatedAt": "2022-06-06T12:25:24.047Z"
}
],
"status": "ProvisionallyCredited",
"description": "sandbox dispute",
"createdAt": "2022-06-06T12:25:15.577Z",
"amount": 1,
"updatedAt": "2022-06-06T12:25:24.047Z"
},
"relationships": {
"customer": {
"data": {
"type": "customer",
"id": "10000"
}
},
"account": {
"data": {
"type": "account",
"id": "10002"
}
},
"transaction": {
"data": {
"type": "transaction",
"id": "5"
}
}
}
}
}
Resolve Won Dispute
This API allows you to mark an existing dispute as resolved won. The Dispute Status Changed webhook event will be fired.
Verb | POST |
Url | https://api.s.unit.sh/sandbox/disputes/{disputeId}/resolve-won |
Timeout (Seconds) | 5 |
curl -X POST 'https://api.s.unit.sh/sandbox/disputes/12/resolve-won' \
-H "Authorization: Bearer ${TOKEN}"
{
"data": {
"type": "dispute",
"id": "12",
"attributes": {
"source": "DebitCard",
"link": "https://sandbox-dispute.com",
"statusHistory": [
{
"type": "InvestigationStarted",
"updatedAt": "2022-06-06T12:14:21.795Z"
},
{
"type": "ResolvedWon",
"updatedAt": "2022-06-06T12:14:32.735Z"
}
],
"status": "ResolvedWon",
"description": "sandbox dispute",
"createdAt": "2022-06-06T12:14:21.795Z",
"amount": 1,
"updatedAt": "2022-06-06T12:14:32.735Z"
},
"relationships": {
"customer": {
"data": {
"type": "customer",
"id": "10000"
}
},
"account": {
"data": {
"type": "account",
"id": "10002"
}
},
"transaction": {
"data": {
"type": "transaction",
"id": "8"
}
}
}
}
}
Resolve Lost Dispute
This API allows you to mark an existing dispute as resolved lost. The Dispute Status Changed webhook event will be fired.
Verb | POST |
Url | https://api.s.unit.sh/sandbox/disputes/{disputeId}/resolve-lost |
Timeout (Seconds) | 5 |
curl -X POST 'https://api.s.unit.sh/sandbox/disputes/12/resolve-lost' \
-H "Authorization: Bearer ${TOKEN}"
{
"data": {
"type": "dispute",
"id": "12",
"attributes": {
"source": "DebitCard",
"link": "https://sandbox-dispute.com",
"statusHistory": [
{
"type": "InvestigationStarted",
"updatedAt": "2022-06-06T12:31:49.214Z"
},
{
"type": "ResolvedLost",
"updatedAt": "2022-06-06T12:31:56.297Z"
}
],
"status": "ResolvedLost",
"description": "sandbox dispute",
"createdAt": "2022-06-06T12:31:49.214Z",
"amount": 1,
"updatedAt": "2022-06-06T12:31:56.297Z"
},
"relationships": {
"customer": {
"data": {
"type": "customer",
"id": "10000"
}
},
"account": {
"data": {
"type": "account",
"id": "10002"
}
},
"transaction": {
"data": {
"type": "transaction",
"id": "11"
}
}
}
}
}
Deny Dispute
This API allows you to mark an existing dispute as denied. The Dispute Status Changed webhook event will be fired.
Verb | POST |
Url | https://api.s.unit.sh/sandbox/disputes/{disputeId}/deny |
Timeout (Seconds) | 5 |
curl -X POST 'https://api.s.unit.sh/sandbox/disputes/12/deny' \
-H "Authorization: Bearer ${TOKEN}"
{
"data": {
"type": "dispute",
"id": "12",
"attributes": {
"source": "DebitCard",
"link": "https://sandbox-dispute.com",
"statusHistory": [
{
"type": "InvestigationStarted",
"updatedAt": "2022-06-06T12:25:15.577Z"
},
{
"type": "ProvisionallyCredited",
"updatedAt": "2022-06-06T12:25:24.047Z"
},
{
"type": "Denied",
"updatedAt": "2022-06-06T12:27:09.281Z"
}
],
"status": "Denied",
"description": "sandbox dispute",
"createdAt": "2022-06-06T12:25:15.577Z",
"amount": 1,
"updatedAt": "2022-06-06T12:27:09.281Z"
},
"relationships": {
"customer": {
"data": {
"type": "customer",
"id": "10000"
}
},
"account": {
"data": {
"type": "account",
"id": "10002"
}
},
"transaction": {
"data": {
"type": "transaction",
"id": "5"
}
}
}
}
}