Skip to Content
kosemdocs
ReferenceAPIPurchases

Get purchase

Gets one of an organization's purchases of credits.

GET
/v1/organizations/{organization}/purchases/{purchase}

Gets one of an organization's purchases of credits.

Authorization

bearer
headerAuthorizationBearer <token>

An access token, or an API key.

Path Parameters

organization*string

The organization's ID.

Match^org_[0-7][0-9a-hjkmnp-tv-z]{25}$
purchase*string

The purchase's ID.

Match^pur_[0-7][0-9a-hjkmnp-tv-z]{25}$

Response Body

OK

application/json
  1. response
amount*

The credits it buys, before any tax; once paid, what Stripe charged.

checkoutUri*string

Stripe's page to pay at, while it is open.

createTime*string

When it was started.

Formatdate-time
creditGrant*string

The credits it bought, organizations/{organization_id}/creditGrants/{credit_grant_id}, once paid.

expireTime?string

When the checkout stops taking a payment, while it is open.

Formatdate-time
failure*string

Why the card's bank declined it, once failed.

invoiceUri*string

The invoice that Stripe hosts for it, once paid and Stripe has finalized it.

kind*string

How it is paid for: CHECKOUT, in Stripe Checkout, by whoever started it; AUTO_RELOAD, by auto-reload, with the saved card.

Value in"CHECKOUT""AUTO_RELOAD"
name*string

Resource name, organizations/{organization_id}/purchases/{purchase_id}.

receiptUri*string

Stripe's receipt for an auto-reload, once paid.

state*string

Where it stands: OPEN, waiting to be paid at checkoutUri; PAID, and its credits granted; EXPIRED, the checkout ended without a payment; FAILED, the card's bank declined an auto-reload; DISPUTED, paid, then disputed, and what was left of its credits taken back.

Value in"OPEN""PAID""EXPIRED""FAILED""DISPUTED"
updateTime*string

When it last changed, such as when it was paid.

Formatdate-time
Example Request
curl -X GET 'https://api.kosem.ai/v1/organizations/string/purchases/string'
Example Response
{
  "amount": {
    "currencyCode": "string",
    "nanos": -999999999,
    "units": 0
  },
  "checkoutUri": "string",
  "createTime": "2019-08-24T14:15:22Z",
  "creditGrant": "string",
  "expireTime": "2019-08-24T14:15:22Z",
  "failure": "string",
  "invoiceUri": "string",
  "kind": "CHECKOUT",
  "name": "string",
  "receiptUri": "string",
  "state": "OPEN",
  "updateTime": "2019-08-24T14:15:22Z"
}