> For the complete documentation index, see [llms.txt](https://docs.revelator.com/pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.revelator.com/pro/resources/web3/devel/payment-service-api.md).

# payment-service-api

## GraphQL API Reference

GraphQl endpoints for payment-service!

**API Endpoints**

```
# devel:
https://payment-service.devel.original.works/graphql
# staging:
https://payment-service.stage.original.works/graphql
# prod:
https://payment-service.original.works/graphql
```

## Queries <a href="#group-operations-queries" id="group-operations-queries"></a>

### `customer`

**Description**

🔒 JWT Token

Returns the customer's record. If the user does not have a previously created customer, this endpoint creates it.

**Response**

Returns a [`CustomerDto!`](#definition-CustomerDto)

**Example**

**Query**

```gql
query Customer {
  customer {
    id
    stripeCustomerId
    defaultPaymentMethodId
    email
    defaultPaymentMethod {
      brand
      country
      expirationMonth
      expirationYear
      lastFourDigits
    }
    createdAt
    updatedAt
  }
}
```

**Response**

```json
{
  "data": {
    "customer": {
      "id": 987.65,
      "stripeCustomerId": "xyz789",
      "defaultPaymentMethodId": "abc123",
      "email": "xyz789",
      "defaultPaymentMethod": PaymentCardDataDto,
      "createdAt": "2007-12-03T10:15:30Z",
      "updatedAt": "2007-12-03T10:15:30Z"
    }
  }
}
```

[Queries](#group-Operations-Queries)

### `exchangeRates`

**Description**

🔓 Public

Returns exchange rates.

**Response**

Returns an [`ExchangeRateDto!`](#definition-ExchangeRateDto)

**Example**

**Query**

```gql
query ExchangeRates {
  exchangeRates {
    ETH {
      USD
      EUR
      ETH
    }
    MATIC {
      USD
      EUR
      ETH
    }
    USDC {
      USD
      EUR
      ETH
    }
    USDT {
      USD
      EUR
      ETH
    }
    BNB {
      USD
      EUR
      ETH
    }
    WETH {
      USD
      EUR
      ETH
    }
    DAI {
      USD
      EUR
      ETH
    }
    AVAX {
      USD
      EUR
      ETH
    }
    BUSD {
      USD
      EUR
      ETH
    }
    WBTC {
      USD
      EUR
      ETH
    }
    ATOM {
      USD
      EUR
      ETH
    }
    ASTR {
      USD
      EUR
      ETH
    }
    updatedAt
  }
}
```

**Response**

```json
{
  "data": {
    "exchangeRates": {
      "ETH": ExchangeQuotesDTO,
      "MATIC": ExchangeQuotesDTO,
      "USDC": ExchangeQuotesDTO,
      "USDT": ExchangeQuotesDTO,
      "BNB": ExchangeQuotesDTO,
      "WETH": ExchangeQuotesDTO,
      "DAI": ExchangeQuotesDTO,
      "AVAX": ExchangeQuotesDTO,
      "BUSD": ExchangeQuotesDTO,
      "WBTC": ExchangeQuotesDTO,
      "ATOM": ExchangeQuotesDTO,
      "ASTR": ExchangeQuotesDTO,
      "updatedAt": "2007-12-03T10:15:30Z"
    }
  }
}
```

[Queries](#group-Operations-Queries)

### `listCards`

**Description**

🔒 JWT Token

Returns a list of PaymentMethods(cards) attached to the customer.

**Response**

Returns a [`GetCardsDto!`](#definition-GetCardsDto)

**Example**

**Query**

```gql
query ListCards {
  listCards {
    items {
      brand
      country
      expirationMonth
      expirationYear
      lastFourDigits
      paymentMethodId
    }
    total
  }
}
```

**Response**

```json
{
  "data": {
    "listCards": {
      "items": [PaymentCardDataListDto],
      "total": 987.65
    }
  }
}
```

[Queries](#group-Operations-Queries)

### `purchaseEvent`

**Description**

🔒 JWT Token

Retrieve purchase event by id attached to the user

**Response**

Returns a [`PurchaseEventDto!`](#definition-PurchaseEventDto)

**Arguments**

| Name                                              | Description                                     |
| ------------------------------------------------- | ----------------------------------------------- |
| `purchaseEventId` - [`Float!`](#definition-Float) | Unique identifier for the purchase event object |

**Example**

**Query**

```gql
query PurchaseEvent($purchaseEventId: Float!) {
  purchaseEvent(purchaseEventId: $purchaseEventId) {
    id
    invoiceItemId
    invoiceId
    amount
    currency
    purchaseEventStatus
    collectionContract
    tokenId
    seller
    quantity
    networkName
    onchainTxEventStatus
    priceInUSDCents
    serviceFeeInUSDCents
    serviceFeePercentage
    messageId
    transactionHash
    createdAt
    updatedAt
  }
}
```

**Variables**

```json
{"purchaseEventId": 123.45}
```

**Response**

```json
{
  "data": {
    "purchaseEvent": {
      "id": 123.45,
      "invoiceItemId": "xyz789",
      "invoiceId": "abc123",
      "amount": "xyz789",
      "currency": "abc123",
      "purchaseEventStatus": "DRAFT",
      "collectionContract": "abc123",
      "tokenId": "abc123",
      "seller": "xyz789",
      "quantity": 123,
      "networkName": "ropsten",
      "onchainTxEventStatus": "TRANSACTION_ON_CHAIN_PENDING",
      "priceInUSDCents": 987,
      "serviceFeeInUSDCents": 123,
      "serviceFeePercentage": 123,
      "messageId": "abc123",
      "transactionHash": "xyz789",
      "createdAt": "2007-12-03T10:15:30Z",
      "updatedAt": "2007-12-03T10:15:30Z"
    }
  }
}
```

[Queries](#group-Operations-Queries)

### `purchaseEventList`

**Description**

🔒 JWT Token

Returns a list of purchase events attached to the user.

**Response**

Returns a [`PurchaseEventListDto!`](#definition-PurchaseEventListDto)

**Example**

**Query**

```gql
query PurchaseEventList {
  purchaseEventList {
    total
    items {
      id
      invoiceItemId
      invoiceId
      amount
      currency
      purchaseEventStatus
      collectionContract
      tokenId
      seller
      quantity
      networkName
      onchainTxEventStatus
      priceInUSDCents
      serviceFeeInUSDCents
      serviceFeePercentage
      messageId
      transactionHash
      createdAt
      updatedAt
    }
  }
}
```

**Response**

```json
{
  "data": {
    "purchaseEventList": {
      "total": 987.65,
      "items": [PurchaseEventDto]
    }
  }
}
```

[Queries](#group-Operations-Queries)

### `sayHello`

**Response**

Returns a [`String!`](#definition-String)

**Example**

**Query**

```gql
query SayHello {
  sayHello
}
```

**Response**

```json
{"data": {"sayHello": "xyz789"}}
```

## Mutations <a href="#group-operations-mutations" id="group-operations-mutations"></a>

### `createCard`

**Description**

🔒 JWT Token

Saves information about the card in the database and assigns it to the user. If the user did not have a default payment method, it sets it.

**Response**

Returns a [`CreateCardDataDto!`](#definition-CreateCardDataDto)

**Arguments**

| Name                                                | Description                                                                                                                                                       |
| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `paymentMethodId` - [`String!`](#definition-String) | Use stripe.createPaymentMethod to convert payment information collected by elements into a PaymentMethod. paymentMethodId is an id key from PaymentMethod object. |

**Example**

**Query**

```gql
mutation CreateCard($paymentMethodId: String!) {
  createCard(paymentMethodId: $paymentMethodId) {
    paymentMethodId
    stripeCustomerId
    customerId
    cardData {
      brand
      country
      expirationMonth
      expirationYear
      lastFourDigits
    }
  }
}
```

**Variables**

```json
{"paymentMethodId": "abc123"}
```

**Response**

```json
{
  "data": {
    "createCard": {
      "paymentMethodId": "abc123",
      "stripeCustomerId": "xyz789",
      "customerId": 123.45,
      "cardData": PaymentCardDataDto
    }
  }
}
```

[Mutations](#group-Operations-Mutations)

### `createPurchaseEvent`

**Description**

🔒 JWT Token

Create purchase event. The invoice item and invoice are created automatically

**Response**

Returns a [`PurchaseEventDto!`](#definition-PurchaseEventDto)

**Arguments**

| Name                                                        | Description                                                    |
| ----------------------------------------------------------- | -------------------------------------------------------------- |
| `amount` - [`String!`](#definition-String)                  | Price of the token in wei.                                     |
| `quantity` - [`Float!`](#definition-Float)                  | Quantity of tokens of token type id purchased                  |
| `tokenId` - [`String!`](#definition-String)                 | Token id from the NFT contract                                 |
| `collectionContract` - [`String!`](#definition-String)      | Address of the NFT contract                                    |
| `seller` - [`String!`](#definition-String)                  | Address of the seller of the NFT                               |
| `network` - [`NetworkNameDto!`](#definition-NetworkNameDto) | Name of the blockchain network on which the transaction occurs |
| `messageId` - [`String!`](#definition-String)               | Id generated by the client                                     |
| `ownerUri` - [`String!`](#definition-String)                | The unique identifier of the enterprise that sells the token.  |

**Example**

**Query**

```gql
mutation CreatePurchaseEvent(
  $amount: String!,
  $quantity: Float!,
  $tokenId: String!,
  $collectionContract: String!,
  $seller: String!,
  $network: NetworkNameDto!,
  $messageId: String!,
  $ownerUri: String!
) {
  createPurchaseEvent(
    amount: $amount,
    quantity: $quantity,
    tokenId: $tokenId,
    collectionContract: $collectionContract,
    seller: $seller,
    network: $network,
    messageId: $messageId,
    ownerUri: $ownerUri
  ) {
    id
    invoiceItemId
    invoiceId
    amount
    currency
    purchaseEventStatus
    collectionContract
    tokenId
    seller
    quantity
    networkName
    onchainTxEventStatus
    priceInUSDCents
    serviceFeeInUSDCents
    serviceFeePercentage
    messageId
    transactionHash
    createdAt
    updatedAt
  }
}
```

**Variables**

```json
{
  "amount": "xyz789",
  "quantity": 987.65,
  "tokenId": "xyz789",
  "collectionContract": "xyz789",
  "seller": "abc123",
  "network": NetworkNameDto,
  "messageId": "abc123",
  "ownerUri": "abc123"
}
```

**Response**

```json
{
  "data": {
    "createPurchaseEvent": {
      "id": 123.45,
      "invoiceItemId": "abc123",
      "invoiceId": "abc123",
      "amount": "abc123",
      "currency": "xyz789",
      "purchaseEventStatus": "DRAFT",
      "collectionContract": "abc123",
      "tokenId": "abc123",
      "seller": "xyz789",
      "quantity": 987,
      "networkName": "ropsten",
      "onchainTxEventStatus": "TRANSACTION_ON_CHAIN_PENDING",
      "priceInUSDCents": 123,
      "serviceFeeInUSDCents": 987,
      "serviceFeePercentage": 987,
      "messageId": "abc123",
      "transactionHash": "abc123",
      "createdAt": "2007-12-03T10:15:30Z",
      "updatedAt": "2007-12-03T10:15:30Z"
    }
  }
}
```

[Mutations](#group-Operations-Mutations)

### `detachCard`

**Description**

🔒 JWT Token

Detach a PaymentMethod object from a Customer

**Response**

Returns a [`String!`](#definition-String)

**Arguments**

| Name                                       | Description                            |
| ------------------------------------------ | -------------------------------------- |
| `cardId` - [`String!`](#definition-String) | Unique identifier for the card object. |

**Example**

**Query**

```gql
mutation DetachCard($cardId: String!) {
  detachCard(cardId: $cardId)
}
```

**Variables**

```json
{"cardId": "xyz789"}
```

**Response**

```json
{"data": {"detachCard": "abc123"}}
```

[Mutations](#group-Operations-Mutations)

### `getOrCreateFeeRate`

**Description**

🔓 Public

get actual payments fee rates

**Response**

Returns a [`FeeRateDto!`](#definition-FeeRateDto)

**Arguments**

| Name                                                        | Description                                                    |
| ----------------------------------------------------------- | -------------------------------------------------------------- |
| `network` - [`NetworkNameDto!`](#definition-NetworkNameDto) | Name of the blockchain network on which the transaction occurs |
| `ownerUri` - [`String!`](#definition-String)                | Unique identifier for enterprise                               |

**Example**

**Query**

```gql
mutation GetOrCreateFeeRate(
  $network: NetworkNameDto!,
  $ownerUri: String!
) {
  getOrCreateFeeRate(
    network: $network,
    ownerUri: $ownerUri
  ) {
    id
    ownerUri
    stripePurchaseFee
    createdAt
    updatedAt
  }
}
```

**Variables**

```json
{
  "network": NetworkNameDto,
  "ownerUri": "xyz789"
}
```

**Response**

```json
{
  "data": {
    "getOrCreateFeeRate": {
      "id": 123.45,
      "ownerUri": "xyz789",
      "stripePurchaseFee": 987.65,
      "createdAt": "2007-12-03T10:15:30Z",
      "updatedAt": "2007-12-03T10:15:30Z"
    }
  }
}
```

## Types <a href="#group-types" id="group-types"></a>

### Boolean

**Description**

The `Boolean` scalar type represents `true` or `false`.

**Example**

```json
true
```

[Types](#group-Types)

### CreateCardDataDto

**Description**

Data required to create the card.

**Fields**

| Field Name                                                          | Description                                                                                                                                                       |
| ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `paymentMethodId` - [`String!`](#definition-String)                 | Use stripe.createPaymentMethod to convert payment information collected by elements into a PaymentMethod. paymentMethodId is an id key from PaymentMethod object. |
| `stripeCustomerId` - [`String!`](#definition-String)                | User identifier created by Stripe.                                                                                                                                |
| `customerId` - [`Float!`](#definition-Float)                        | Unique identifier for the Customer.                                                                                                                               |
| `cardData` - [`PaymentCardDataDto`](#definition-PaymentCardDataDto) |                                                                                                                                                                   |

**Example**

```json
{
  "paymentMethodId": "xyz789",
  "stripeCustomerId": "xyz789",
  "customerId": 987.65,
  "cardData": PaymentCardDataDto
}
```

[Types](#group-Types)

### CustomerDto

**Description**

CustomerDto describes a user's Stripe payment data

**Fields**

| Field Name                                                                      | Description                                                                                                                                       |
| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id` - [`Float!`](#definition-Float)                                            | Auto-incrementing identifier.                                                                                                                     |
| `stripeCustomerId` - [`String!`](#definition-String)                            | User identifier created by Stripe.                                                                                                                |
| `defaultPaymentMethodId` - [`String`](#definition-String)                       | Card identifier created by Stripe. If it is not null it is the basic payment method. There is no need to add a new card during a new transaction. |
| `email` - [`String`](#definition-String)                                        | email of the customer.                                                                                                                            |
| `defaultPaymentMethod` - [`PaymentCardDataDto`](#definition-PaymentCardDataDto) |                                                                                                                                                   |
| `createdAt` - [`DateTime!`](#definition-DateTime)                               | Time at which the object was created.                                                                                                             |
| `updatedAt` - [`DateTime!`](#definition-DateTime)                               | Time at which the object was last updated.                                                                                                        |

**Example**

```json
{
  "id": 987.65,
  "stripeCustomerId": "xyz789",
  "defaultPaymentMethodId": "xyz789",
  "email": "abc123",
  "defaultPaymentMethod": PaymentCardDataDto,
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z"
}
```

[Types](#group-Types)

### DateTime

**Description**

A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format.

**Example**

```gql
"2007-12-03T10:15:30Z"
```

[Types](#group-Types)

### ExchangeQuotesDTO

**Description**

Quote currencies

**Fields**

| Field Name                            | Description                 |
| ------------------------------------- | --------------------------- |
| `USD` - [`Float!`](#definition-Float) | High precision price in USD |
| `EUR` - [`Float!`](#definition-Float) | High precision price in EUR |
| `ETH` - [`Float!`](#definition-Float) | High precision price in ETH |

**Example**

```json
{"USD": 123.45, "EUR": 123.45, "ETH": 987.65}
```

[Types](#group-Types)

### ExchangeRateDto

**Description**

Exchange rate object

**Fields**

| Field Name                                                      | Description               |
| --------------------------------------------------------------- | ------------------------- |
| `ETH` - [`ExchangeQuotesDTO!`](#definition-ExchangeQuotesDTO)   |                           |
| `MATIC` - [`ExchangeQuotesDTO!`](#definition-ExchangeQuotesDTO) |                           |
| `USDC` - [`ExchangeQuotesDTO!`](#definition-ExchangeQuotesDTO)  |                           |
| `USDT` - [`ExchangeQuotesDTO!`](#definition-ExchangeQuotesDTO)  |                           |
| `BNB` - [`ExchangeQuotesDTO!`](#definition-ExchangeQuotesDTO)   |                           |
| `WETH` - [`ExchangeQuotesDTO!`](#definition-ExchangeQuotesDTO)  |                           |
| `DAI` - [`ExchangeQuotesDTO!`](#definition-ExchangeQuotesDTO)   |                           |
| `AVAX` - [`ExchangeQuotesDTO!`](#definition-ExchangeQuotesDTO)  |                           |
| `BUSD` - [`ExchangeQuotesDTO!`](#definition-ExchangeQuotesDTO)  |                           |
| `WBTC` - [`ExchangeQuotesDTO!`](#definition-ExchangeQuotesDTO)  |                           |
| `ATOM` - [`ExchangeQuotesDTO!`](#definition-ExchangeQuotesDTO)  |                           |
| `ASTR` - [`ExchangeQuotesDTO!`](#definition-ExchangeQuotesDTO)  |                           |
| `updatedAt` - [`DateTime!`](#definition-DateTime)               | Date of last price update |

**Example**

```json
{
  "ETH": ExchangeQuotesDTO,
  "MATIC": ExchangeQuotesDTO,
  "USDC": ExchangeQuotesDTO,
  "USDT": ExchangeQuotesDTO,
  "BNB": ExchangeQuotesDTO,
  "WETH": ExchangeQuotesDTO,
  "DAI": ExchangeQuotesDTO,
  "AVAX": ExchangeQuotesDTO,
  "BUSD": ExchangeQuotesDTO,
  "WBTC": ExchangeQuotesDTO,
  "ATOM": ExchangeQuotesDTO,
  "ASTR": ExchangeQuotesDTO,
  "updatedAt": "2007-12-03T10:15:30Z"
}
```

[Types](#group-Types)

### FeeRateDto

**Description**

Payments fee rates

**Fields**

| Field Name                                          | Description                                                             |
| --------------------------------------------------- | ----------------------------------------------------------------------- |
| `id` - [`Float!`](#definition-Float)                | Auto-incrementing identifier.                                           |
| `ownerUri` - [`String!`](#definition-String)        | Unique identifier for enterprise                                        |
| `stripePurchaseFee` - [`Float!`](#definition-Float) | Fee rate charged during stripe payment. max value 100. Percentage value |
| `createdAt` - [`DateTime!`](#definition-DateTime)   | Time at which the object was created.                                   |
| `updatedAt` - [`DateTime!`](#definition-DateTime)   | Time at which the object was last updated.                              |

**Example**

```json
{
  "id": 123.45,
  "ownerUri": "xyz789",
  "stripePurchaseFee": 123.45,
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z"
}
```

[Types](#group-Types)

### Float

**Description**

The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).

**Example**

```json
123.45
```

[Types](#group-Types)

### GetCardsDto

**Description**

Returns a list of cards and their number.

**Fields**

| Field Name                                                                   | Description                |
| ---------------------------------------------------------------------------- | -------------------------- |
| `items` - [`[PaymentCardDataListDto!]!`](#definition-PaymentCardDataListDto) | Contains an array of cards |
| `total` - [`Float!`](#definition-Float)                                      | The number of objects.     |

**Example**

```json
{"items": [PaymentCardDataListDto], "total": 987.65}
```

[Types](#group-Types)

### Int

**Description**

The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

**Example**

```json
987
```

[Types](#group-Types)

### NetworkName

**Values**

| Enum Value    | Description |
| ------------- | ----------- |
| `ropsten`     |             |
| `kovan`       |             |
| `ownet`       |             |
| `mainnet`     |             |
| `binance`     |             |
| `bnbtest`     |             |
| `sepolia`     |             |
| `local`       |             |
| `test`        |             |
| `polygon`     |             |
| `goerli`      |             |
| `mumbai`      |             |
| `ethereum`    |             |
| `shibuya`     |             |
| `amoy`        |             |
| `base`        |             |
| `baseSepolia` |             |

**Example**

```gql
"ropsten"
```

[Types](#group-Types)

### NetworkNameDto

**Fields**

| Input Field                                               | Description |
| --------------------------------------------------------- | ----------- |
| `networkName` - [`NetworkName!`](#definition-NetworkName) |             |

**Example**

```json
{"networkName": "ropsten"}
```

[Types](#group-Types)

### OnchainTxEventStatus

**Values**

| Enum Value                         | Description |
| ---------------------------------- | ----------- |
| `TRANSACTION_ON_CHAIN_PENDING`     |             |
| `TRANSACTION_ON_CHAIN_IN_PROGRESS` |             |
| `TRANSACTION_ON_CHAIN_FAILED`      |             |
| `TRANSACTION_ON_CHAIN_SUCCEED`     |             |

**Example**

```gql
"TRANSACTION_ON_CHAIN_PENDING"
```

[Types](#group-Types)

### PaymentCardDataDto

**Description**

Basic information about a credit or debit card.

**Fields**

| Field Name                                         | Description                                                                                              |
| -------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| `brand` - [`String!`](#definition-String)          | Card brand. Can be American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown. |
| `country` - [`String!`](#definition-String)        | Two-letter ISO code representing the country of the card.                                                |
| `expirationMonth` - [`Float!`](#definition-Float)  | Two-digit number representing the card’s expiration month.                                               |
| `expirationYear` - [`Float!`](#definition-Float)   | Four-digit number representing the card’s expiration year.                                               |
| `lastFourDigits` - [`String!`](#definition-String) | The last four digits of the card.                                                                        |

**Example**

```json
{
  "brand": "abc123",
  "country": "abc123",
  "expirationMonth": 987.65,
  "expirationYear": 123.45,
  "lastFourDigits": "xyz789"
}
```

[Types](#group-Types)

### PaymentCardDataListDto

**Description**

Basic information about a credit or debit card.

**Fields**

| Field Name                                          | Description                                                                                                                                                       |
| --------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `brand` - [`String!`](#definition-String)           | Card brand. Can be American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown.                                                          |
| `country` - [`String!`](#definition-String)         | Two-letter ISO code representing the country of the card.                                                                                                         |
| `expirationMonth` - [`Float!`](#definition-Float)   | Two-digit number representing the card’s expiration month.                                                                                                        |
| `expirationYear` - [`Float!`](#definition-Float)    | Four-digit number representing the card’s expiration year.                                                                                                        |
| `lastFourDigits` - [`String!`](#definition-String)  | The last four digits of the card.                                                                                                                                 |
| `paymentMethodId` - [`String!`](#definition-String) | Use stripe.createPaymentMethod to convert payment information collected by elements into a PaymentMethod. paymentMethodId is an id key from PaymentMethod object. |

**Example**

```json
{
  "brand": "abc123",
  "country": "xyz789",
  "expirationMonth": 123.45,
  "expirationYear": 123.45,
  "lastFourDigits": "abc123",
  "paymentMethodId": "abc123"
}
```

[Types](#group-Types)

### PurchaseEventDto

**Description**

Purchase event object. Represent a one-time purchase of any item.

**Fields**

| Field Name                                                                           | Description                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id` - [`Float!`](#definition-Float)                                                 | Auto-incrementing identifier.                                                                                                                                                                                   |
| `invoiceItemId` - [`String!`](#definition-String)                                    | Id of the item to be added to an invoice                                                                                                                                                                        |
| `invoiceId` - [`String!`](#definition-String)                                        | Id of the invoice                                                                                                                                                                                               |
| `amount` - [`String!`](#definition-String)                                           | The integer amount in cents.                                                                                                                                                                                    |
| `currency` - [`String!`](#definition-String)                                         | Three-letter ISO currency code, in lowercase.                                                                                                                                                                   |
| `purchaseEventStatus` - [`PurchaseEventStatus!`](#definition-PurchaseEventStatus)    | Transaction status. May be: DRAFT, TRANSACTION\_ON\_CHAIN\_PENDING, TRANSACTION\_ON\_CHAIN\_IN\_PROGRESS, TRANSACTION\_ON\_CHAIN\_FAILED, TRANSACTION\_ON\_CHAIN\_SUCCEED, PAYMENT\_SUCCESSFUL, PAYMENT\_FAILED |
| `collectionContract` - [`String`](#definition-String)                                | Address of the NFT contract                                                                                                                                                                                     |
| `tokenId` - [`String`](#definition-String)                                           | Token id from the NFT contract                                                                                                                                                                                  |
| `seller` - [`String`](#definition-String)                                            | Address of the seller of the NFT                                                                                                                                                                                |
| `quantity` - [`Int!`](#definition-Int)                                               | Quantity of tokens of token type id purchased                                                                                                                                                                   |
| `networkName` - [`NetworkName!`](#definition-NetworkName)                            | Name of the blockchain network on which the transaction occurs                                                                                                                                                  |
| `onchainTxEventStatus` - [`OnchainTxEventStatus!`](#definition-OnchainTxEventStatus) | Transaction on chain status. Statuses: TRANSACTION\_ON\_CHAIN\_PENDING, TRANSACTION\_ON\_CHAIN\_IN\_PROGRESS, TRANSACTION\_ON\_CHAIN\_FAILED, TRANSACTION\_ON\_CHAIN\_SUCCEED                                   |
| `priceInUSDCents` - [`Int!`](#definition-Int)                                        | NFT token value in cents.                                                                                                                                                                                       |
| `serviceFeeInUSDCents` - [`Int!`](#definition-Int)                                   | Fee charged during stripe payment in cents                                                                                                                                                                      |
| `serviceFeePercentage` - [`Int!`](#definition-Int)                                   | Fee rate charged during stripe payment. max value 100. Percentage value                                                                                                                                         |
| `messageId` - [`String`](#definition-String)                                         | Id generated by the client                                                                                                                                                                                      |
| `transactionHash` - [`String`](#definition-String)                                   | A unique string that is given to every transaction that is verified and added to the blockchain.                                                                                                                |
| `createdAt` - [`DateTime!`](#definition-DateTime)                                    | Time at which the object was created.                                                                                                                                                                           |
| `updatedAt` - [`DateTime!`](#definition-DateTime)                                    | Time at which the object was last updated.                                                                                                                                                                      |

**Example**

```json
{
  "id": 987.65,
  "invoiceItemId": "xyz789",
  "invoiceId": "abc123",
  "amount": "abc123",
  "currency": "abc123",
  "purchaseEventStatus": "DRAFT",
  "collectionContract": "abc123",
  "tokenId": "xyz789",
  "seller": "abc123",
  "quantity": 123,
  "networkName": "ropsten",
  "onchainTxEventStatus": "TRANSACTION_ON_CHAIN_PENDING",
  "priceInUSDCents": 987,
  "serviceFeeInUSDCents": 987,
  "serviceFeePercentage": 987,
  "messageId": "xyz789",
  "transactionHash": "abc123",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z"
}
```

[Types](#group-Types)

### PurchaseEventListDto

**Description**

List of purchase events attached to the user.

**Fields**

| Field Name                                                       | Description                          |
| ---------------------------------------------------------------- | ------------------------------------ |
| `total` - [`Float!`](#definition-Float)                          | The number of objects.               |
| `items` - [`[PurchaseEventDto!]!`](#definition-PurchaseEventDto) | Contains an array of purchase events |

**Example**

```json
{"total": 987.65, "items": [PurchaseEventDto]}
```

[Types](#group-Types)

### PurchaseEventStatus

**Values**

| Enum Value           | Description |
| -------------------- | ----------- |
| `DRAFT`              |             |
| `PAYMENT_SUCCESSFUL` |             |
| `PAYMENT_FAILED`     |             |

**Example**

```gql
"DRAFT"
```

[Types](#group-Types)

### String

**Description**

The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

**Example**

```gql
"xyz789"
```

[Documentation by Anvil SpectaQL](https://github.com/anvilco/spectaql)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.revelator.com/pro/resources/web3/devel/payment-service-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
