Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

anchor platform: add documentation for events #232

Merged
merged 9 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions api/anchor-platform/callbacks/event/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Events
order: 0
---

import {EndpointsTable} from "@site/src/components/EndpointsTable";

The Anchor Platform can be configured to notify the business of events, such as a transaction being initiated by a client or a payment being sent to one of the business' distribution accounts.

Currently, the Anchor Platform takes a fairly unforgiving approach to event delivery, retrying a maximum of three times within three seconds before discarding the event. This will likely change in future releases, but for now, businesses should ensure that they implement a mechanism to recover from missed events.

For example, if you're using the Anchor Platform's `--stellar-observer` to monitor incoming payments, a cron job can check how long it has been since a transaction was updated as ready to receive funds, and if a reasonable amount of time has passed without receiving funds, it can fetch the latest status of the transaction using the Anchor Platform's `GET /transactions/:id` endpoint to make sure the event was not missed, or continuing processing the transaction if it was.

<EndpointsTable title="Endpoints">

| | |
| --- | --------------------- |
| POST | [/event](../post-event.api.mdx) |


</EndpointsTable>
2 changes: 1 addition & 1 deletion api/anchor-platform/callbacks/get-rates.api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Success.

An object describing the fees added on top of the rate provided via the `price` attribute.

</div><SchemaItem collapsible={false} name={"total"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The total fee to be applied."}}></SchemaItem><SchemaItem collapsible={false} name={"asset"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The asset the fee will be charged in. Must be represented in [Asset Identification Format](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0038.md#asset-identification-format)."}}></SchemaItem><SchemaItem collapsible={true} className={"schemaItem"}><details style={{}}><summary style={{}}><strong>details</strong><span style={{"opacity":"0.6"}}> object[]</span></summary><div style={{"marginLeft":"1rem"}}><li><div style={{"fontSize":"var(--ifm-code-font-size)","opacity":"0.6","marginLeft":"-.5rem","paddingBottom":".5rem"}}>Array [</div></li><SchemaItem collapsible={false} name={"name"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The name of the fee, for example `ACH fee`, `Brazilian conciliation fee`, `Service fee`, etc."}}></SchemaItem><SchemaItem collapsible={false} name={"description"} required={false} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"A text describing the fee."}}></SchemaItem><SchemaItem collapsible={false} name={"amount"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The amount of asset applied. If `fee.details` is provided, `sum(fee.details.amount)` should be equals `fee.total`."}}></SchemaItem><li><div style={{"fontSize":"var(--ifm-code-font-size)","opacity":"0.6","marginLeft":"-.5rem"}}>]</div></li></div></details></SchemaItem></div></details></SchemaItem></div></details></SchemaItem></ul></details></TabItem><TabItem label={"Example (from schema)"} value={"Example (from schema)"}><ResponseSamples responseExample={"{\n \"rate\": {\n \"id\": \"string\",\n \"expires_at\": \"2023-08-02T00:22:23.658Z\",\n \"price\": \"string\",\n \"sell_amount\": \"string\",\n \"buy_amount\": \"string\",\n \"fee\": {\n \"total\": \"string\",\n \"asset\": \"string\",\n \"details\": [\n {\n \"name\": \"string\",\n \"description\": \"string\",\n \"amount\": \"string\"\n }\n ]\n }\n }\n}"} language={"json"}></ResponseSamples></TabItem></SchemaTabs></TabItem></MimeTabs></div></TabItem><TabItem label={"422"} value={"422"}><div>
</div><SchemaItem collapsible={false} name={"total"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The total fee to be applied."}}></SchemaItem><SchemaItem collapsible={false} name={"asset"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The asset the fee will be charged in. Must be represented in [Asset Identification Format](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0038.md#asset-identification-format)."}}></SchemaItem><SchemaItem collapsible={true} className={"schemaItem"}><details style={{}}><summary style={{}}><strong>details</strong><span style={{"opacity":"0.6"}}> object[]</span></summary><div style={{"marginLeft":"1rem"}}><li><div style={{"fontSize":"var(--ifm-code-font-size)","opacity":"0.6","marginLeft":"-.5rem","paddingBottom":".5rem"}}>Array [</div></li><SchemaItem collapsible={false} name={"name"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The name of the fee, for example `ACH fee`, `Brazilian conciliation fee`, `Service fee`, etc."}}></SchemaItem><SchemaItem collapsible={false} name={"description"} required={false} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"A text describing the fee."}}></SchemaItem><SchemaItem collapsible={false} name={"amount"} required={true} schemaName={"string"} qualifierMessage={undefined} schema={{"type":"string","description":"The amount of asset applied. If `fee.details` is provided, `sum(fee.details.amount)` should be equals `fee.total`."}}></SchemaItem><li><div style={{"fontSize":"var(--ifm-code-font-size)","opacity":"0.6","marginLeft":"-.5rem"}}>]</div></li></div></details></SchemaItem></div></details></SchemaItem></div></details></SchemaItem></ul></details></TabItem><TabItem label={"Example (from schema)"} value={"Example (from schema)"}><ResponseSamples responseExample={"{\n \"rate\": {\n \"id\": \"string\",\n \"expires_at\": \"2023-09-12T21:12:29.487Z\",\n \"price\": \"string\",\n \"sell_amount\": \"string\",\n \"buy_amount\": \"string\",\n \"fee\": {\n \"total\": \"string\",\n \"asset\": \"string\",\n \"details\": [\n {\n \"name\": \"string\",\n \"description\": \"string\",\n \"amount\": \"string\"\n }\n ]\n }\n }\n}"} language={"json"}></ResponseSamples></TabItem></SchemaTabs></TabItem></MimeTabs></div></TabItem><TabItem label={"422"} value={"422"}><div>

Unprocessable Entity. This status should be returned when the anchor understood the request but cannot
return a success response.
Expand Down
Loading