Referência da API

Products

CRUD for your product catalog.

GET
/v1/products

Newest first, as { data, total, take, skip } with take up to 100 (default 100). Inactive products (active: false) are included.

Requires the products:read scope.

apiKey
headerAuthorizationBearer <API key>

Your Cosmos Pay secret API key, sent as Authorization: Bearer <apiKey>.

take?number

Page size: how many items to return (1 to 100).

Rangevalue <= 100
Default100
skip?number

How many items to skip before this page (offset).

Default0

OK

The body, query or path failed validation. message is an array of the individual failures.

Routes that reject a valid request for a reason of their own (an amount, a memo, a state) document the code for it on their own 400.

no_authenticated_consumer: The gateway forwarded no API key identity

insufficient_scope: the API key does not hold the scope this route requires. The shared public API key also gets this on every route that is not marked x-cosmos-public-key, with a message saying so; more scopes will not help, the key is the wrong one.

gateway_required: the request did not arrive through APISIX.

Unexpected server error. The detail is logged server-side and never returned: there is nothing in the body to branch on beyond the code.

Example Request
curl -X GET 'https://api.cosmospay.lat/cosmos-api/v1/products'
Example Response
{  "data": [    {      "id": "clx9z8a1b0000abcd1234efgh",      "name": "Pro plan (monthly)",      "description": "Full access, billed every month.",      "amount": "49.00",      "asset": "native",      "kind": "one_time",      "active": true,      "reference": "sku_pro_monthly",      "createdAt": "2019-08-24T14:15:22Z",      "updatedAt": "2019-08-24T14:15:22Z"    }  ],  "total": 137,  "take": 100,  "skip": 0}
POST
/v1/products

A catalog record: name, an optional decimal amount (up to 7 decimals; omit for a customer-set price), assetCode (omitted, XLM or native store native), kind (one_time by default, recurring or link, informational) and active (default true). Creating one builds no payment link or intent.

Requires the products:write scope.

apiKey
headerAuthorizationBearer <API key>

Your Cosmos Pay secret API key, sent as Authorization: Bearer <apiKey>.

application/json
  1. body

A catalog product to create. Creating one builds no payment link or intent.

name*string

Product name (1 to 120 characters).

description?string

Free-text description of the product (at most 500 characters).

amount?string

Decimal price (≤ 7 decimals). Omit for a customer-set amount.

assetCode?string

Asset code the price is in. Omit for native lumens (XLM).

kind?string

Informational classification: one_time (default), recurring or link.

Default"one_time"
Value in"recurring""one_time""link"
active?boolean

Whether the product is active. false retires it and keeps its record.

Defaulttrue
reference?string

Your own SKU or reference for the product (at most 120 characters).

Created

The body, query or path failed validation. message is an array of the individual failures.

Routes that reject a valid request for a reason of their own (an amount, a memo, a state) document the code for it on their own 400.

no_authenticated_consumer: The gateway forwarded no API key identity

insufficient_scope: the API key does not hold the scope this route requires. The shared public API key also gets this on every route that is not marked x-cosmos-public-key, with a message saying so; more scopes will not help, the key is the wrong one.

gateway_required: the request did not arrive through APISIX.

Unexpected server error. The detail is logged server-side and never returned: there is nothing in the body to branch on beyond the code.

Example Request
curl -X POST 'https://api.cosmospay.lat/cosmos-api/v1/products' \  -H 'Content-Type: application/json' \  -d '{  "name": "Pro plan (monthly)"}'
Example Response
{  "id": "clx9z8a1b0000abcd1234efgh",  "name": "Pro plan (monthly)",  "description": "Full access, billed every month.",  "amount": "49.00",  "asset": "native",  "kind": "one_time",  "active": true,  "reference": "sku_pro_monthly",  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}
GET
/v1/products/{id}

One of the consumer’s products, active or not.

Requires the products:read scope.

apiKey
headerAuthorizationBearer <API key>

Your Cosmos Pay secret API key, sent as Authorization: Bearer <apiKey>.

id*string

OK

The body, query or path failed validation. message is an array of the individual failures.

Routes that reject a valid request for a reason of their own (an amount, a memo, a state) document the code for it on their own 400.

no_authenticated_consumer: The gateway forwarded no API key identity

insufficient_scope: the API key does not hold the scope this route requires. The shared public API key also gets this on every route that is not marked x-cosmos-public-key, with a message saying so; more scopes will not help, the key is the wrong one.

gateway_required: the request did not arrive through APISIX.

No such resource, or it exists and belongs to another consumer. The two are deliberately the same answer: "exists but not yours" is an ownership oracle.

Unexpected server error. The detail is logged server-side and never returned: there is nothing in the body to branch on beyond the code.

Example Request
curl -X GET 'https://api.cosmospay.lat/cosmos-api/v1/products/string'
Example Response
{  "id": "clx9z8a1b0000abcd1234efgh",  "name": "Pro plan (monthly)",  "description": "Full access, billed every month.",  "amount": "49.00",  "asset": "native",  "kind": "one_time",  "active": true,  "reference": "sku_pro_monthly",  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}
PATCH
/v1/products/{id}

Changes only the fields sent; assetCode is normalized as on create. Set active: false to retire a product and keep its record.

Requires the products:write scope.

apiKey
headerAuthorizationBearer <API key>

Your Cosmos Pay secret API key, sent as Authorization: Bearer <apiKey>.

id*string
application/json
  1. body

Changes to a product: any subset of the create fields; only the fields sent change.

name?string

Product name (1 to 120 characters).

description?string

Free-text description of the product (at most 500 characters).

amount?string

Decimal price (≤ 7 decimals). Omit for a customer-set amount.

assetCode?string

Asset code the price is in. Omit for native lumens (XLM).

kind?string

Informational classification: one_time (default), recurring or link.

Default"one_time"
Value in"recurring""one_time""link"
active?boolean

Whether the product is active. false retires it and keeps its record.

Defaulttrue
reference?string

Your own SKU or reference for the product (at most 120 characters).

OK

The body, query or path failed validation. message is an array of the individual failures.

Routes that reject a valid request for a reason of their own (an amount, a memo, a state) document the code for it on their own 400.

no_authenticated_consumer: The gateway forwarded no API key identity

insufficient_scope: the API key does not hold the scope this route requires. The shared public API key also gets this on every route that is not marked x-cosmos-public-key, with a message saying so; more scopes will not help, the key is the wrong one.

gateway_required: the request did not arrive through APISIX.

No such resource, or it exists and belongs to another consumer. The two are deliberately the same answer: "exists but not yours" is an ownership oracle.

Unexpected server error. The detail is logged server-side and never returned: there is nothing in the body to branch on beyond the code.

Example Request
curl -X PATCH 'https://api.cosmospay.lat/cosmos-api/v1/products/string' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "id": "clx9z8a1b0000abcd1234efgh",  "name": "Pro plan (monthly)",  "description": "Full access, billed every month.",  "amount": "49.00",  "asset": "native",  "kind": "one_time",  "active": true,  "reference": "sku_pro_monthly",  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}
DELETE
/v1/products/{id}

Deletes the product for good. To keep its record, set active: false with PATCH instead.

Requires the products:write scope.

apiKey
headerAuthorizationBearer <API key>

Your Cosmos Pay secret API key, sent as Authorization: Bearer <apiKey>.

id*string

OK

The body, query or path failed validation. message is an array of the individual failures.

Routes that reject a valid request for a reason of their own (an amount, a memo, a state) document the code for it on their own 400.

no_authenticated_consumer: The gateway forwarded no API key identity

insufficient_scope: the API key does not hold the scope this route requires. The shared public API key also gets this on every route that is not marked x-cosmos-public-key, with a message saying so; more scopes will not help, the key is the wrong one.

gateway_required: the request did not arrive through APISIX.

No such resource, or it exists and belongs to another consumer. The two are deliberately the same answer: "exists but not yours" is an ownership oracle.

Unexpected server error. The detail is logged server-side and never returned: there is nothing in the body to branch on beyond the code.

Example Request
curl -X DELETE 'https://api.cosmospay.lat/cosmos-api/v1/products/string'
Example Response
{  "id": "clx9z8a1b0000abcd1234efgh",  "deleted": true}