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
customer
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!
Example
Query
query Customer {
customer {
id
stripeCustomerId
defaultPaymentMethodId
email
defaultPaymentMethod {
brand
country
expirationMonth
expirationYear
lastFourDigits
}
createdAt
updatedAt
}
}
Response
{
"data": {
"customer": {
"id": 987.65,
"stripeCustomerId": "abc123",
"defaultPaymentMethodId": "xyz789",
"email": "abc123",
"defaultPaymentMethod": PaymentCardDataDto,
"createdAt": "2007-12-03T10:15:30Z",
"updatedAt": "2007-12-03T10:15:30Z"
}
}
}
exchangeRates
exchangeRates
Description
🔓 Public
Returns exchange rates.
Response
Returns an ExchangeRateDto!
Example
Query
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
{
"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"
}
}
}
listCards
listCards
Description
🔒 JWT Token
Returns a list of PaymentMethods(cards) attached to the customer.
Response
Returns a GetCardsDto!
Example
Query
query ListCards {
listCards {
items {
brand
country
expirationMonth
expirationYear
lastFourDigits
paymentMethodId
}
total
}
}
Response
{
"data": {
"listCards": {
"items": [PaymentCardDataListDto],
"total": 123.45
}
}
}
purchaseEvent
purchaseEvent
Description
🔒 JWT Token
Retrieve purchase event by id attached to the user
Response
Returns a PurchaseEventDto!
Arguments
purchaseEventId
- Float!
Unique identifier for the purchase event object
Example
Query
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
{"purchaseEventId": 987.65}
Response
{
"data": {
"purchaseEvent": {
"id": 123.45,
"invoiceItemId": "abc123",
"invoiceId": "abc123",
"amount": "xyz789",
"currency": "xyz789",
"purchaseEventStatus": "DRAFT",
"collectionContract": "xyz789",
"tokenId": "abc123",
"seller": "xyz789",
"quantity": 123,
"networkName": "ropsten",
"onchainTxEventStatus": "TRANSACTION_ON_CHAIN_PENDING",
"priceInUSDCents": 987,
"serviceFeeInUSDCents": 123,
"serviceFeePercentage": 987,
"messageId": "abc123",
"transactionHash": "abc123",
"createdAt": "2007-12-03T10:15:30Z",
"updatedAt": "2007-12-03T10:15:30Z"
}
}
}
purchaseEventList
purchaseEventList
Description
🔒 JWT Token
Returns a list of purchase events attached to the user.
Response
Returns a PurchaseEventListDto!
Example
Query
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
{
"data": {
"purchaseEventList": {
"total": 987.65,
"items": [PurchaseEventDto]
}
}
}
sayHello
sayHello
Response
Returns a String!
Example
Query
query SayHello {
sayHello
}
Response
{"data": {"sayHello": "abc123"}}
Mutations
createCard
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!
Arguments
paymentMethodId
- String!
Use stripe.createPaymentMethod to convert payment information collected by elements into a PaymentMethod. paymentMethodId is an id key from PaymentMethod object.
Example
Query
mutation CreateCard($paymentMethodId: String!) {
createCard(paymentMethodId: $paymentMethodId) {
paymentMethodId
stripeCustomerId
customerId
cardData {
brand
country
expirationMonth
expirationYear
lastFourDigits
}
}
}
Variables
{"paymentMethodId": "xyz789"}
Response
{
"data": {
"createCard": {
"paymentMethodId": "xyz789",
"stripeCustomerId": "abc123",
"customerId": 987.65,
"cardData": PaymentCardDataDto
}
}
}
createPurchaseEvent
createPurchaseEvent
Description
🔒 JWT Token
Create purchase event. The invoice item and invoice are created automatically
Response
Returns a PurchaseEventDto!
Arguments
amount
- String!
Price of the token in wei.
quantity
- Float!
Quantity of tokens of token type id purchased
tokenId
- String!
Token id from the NFT contract
collectionContract
- String!
Address of the NFT contract
seller
- String!
Address of the seller of the NFT
network
- NetworkNameDto!
Name of the blockchain network on which the transaction occurs
messageId
- String!
Id generated by the client
ownerUri
- String!
The unique identifier of the enterprise that sells the token.
Example
Query
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
{
"amount": "abc123",
"quantity": 123.45,
"tokenId": "abc123",
"collectionContract": "abc123",
"seller": "abc123",
"network": NetworkNameDto,
"messageId": "abc123",
"ownerUri": "xyz789"
}
Response
{
"data": {
"createPurchaseEvent": {
"id": 123.45,
"invoiceItemId": "xyz789",
"invoiceId": "abc123",
"amount": "abc123",
"currency": "xyz789",
"purchaseEventStatus": "DRAFT",
"collectionContract": "abc123",
"tokenId": "abc123",
"seller": "abc123",
"quantity": 123,
"networkName": "ropsten",
"onchainTxEventStatus": "TRANSACTION_ON_CHAIN_PENDING",
"priceInUSDCents": 123,
"serviceFeeInUSDCents": 987,
"serviceFeePercentage": 123,
"messageId": "xyz789",
"transactionHash": "abc123",
"createdAt": "2007-12-03T10:15:30Z",
"updatedAt": "2007-12-03T10:15:30Z"
}
}
}
detachCard
detachCard
Description
🔒 JWT Token
Detach a PaymentMethod object from a Customer
Response
Returns a String!
Arguments
cardId
- String!
Unique identifier for the card object.
Example
Query
mutation DetachCard($cardId: String!) {
detachCard(cardId: $cardId)
}
Variables
{"cardId": "xyz789"}
Response
{"data": {"detachCard": "abc123"}}
getOrCreateFeeRate
getOrCreateFeeRate
Description
🔓 Public
get actual payments fee rates
Response
Returns a FeeRateDto!
Arguments
network
- NetworkNameDto!
Name of the blockchain network on which the transaction occurs
ownerUri
- String!
Unique identifier for enterprise
Example
Query
mutation GetOrCreateFeeRate(
$network: NetworkNameDto!,
$ownerUri: String!
) {
getOrCreateFeeRate(
network: $network,
ownerUri: $ownerUri
) {
id
ownerUri
stripePurchaseFee
createdAt
updatedAt
}
}
Variables
{
"network": NetworkNameDto,
"ownerUri": "xyz789"
}
Response
{
"data": {
"getOrCreateFeeRate": {
"id": 123.45,
"ownerUri": "xyz789",
"stripePurchaseFee": 987.65,
"createdAt": "2007-12-03T10:15:30Z",
"updatedAt": "2007-12-03T10:15:30Z"
}
}
}
Types
Boolean
Description
The Boolean
scalar type represents true
or false
.
Example
true
CreateCardDataDto
Description
Data required to create the card.
Fields
paymentMethodId
- String!
Use stripe.createPaymentMethod to convert payment information collected by elements into a PaymentMethod. paymentMethodId is an id key from PaymentMethod object.
stripeCustomerId
- String!
User identifier created by Stripe.
customerId
- Float!
Unique identifier for the Customer.
cardData
- PaymentCardDataDto
Example
{
"paymentMethodId": "abc123",
"stripeCustomerId": "abc123",
"customerId": 987.65,
"cardData": PaymentCardDataDto
}
CustomerDto
Description
CustomerDto describes a user's Stripe payment data
Fields
id
- Float!
Auto-incrementing identifier.
stripeCustomerId
- String!
User identifier created by Stripe.
defaultPaymentMethodId
- 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
email of the customer.
defaultPaymentMethod
- PaymentCardDataDto
createdAt
- DateTime!
Time at which the object was created.
updatedAt
- DateTime!
Time at which the object was last updated.
Example
{
"id": 987.65,
"stripeCustomerId": "abc123",
"defaultPaymentMethodId": "xyz789",
"email": "xyz789",
"defaultPaymentMethod": PaymentCardDataDto,
"createdAt": "2007-12-03T10:15:30Z",
"updatedAt": "2007-12-03T10:15:30Z"
}
DateTime
Description
A date-time string at UTC, such as 2019-12-03T09:54:33Z, compliant with the date-time format.
Example
"2007-12-03T10:15:30Z"
ExchangeQuotesDTO
Description
Quote currencies
Fields
Example
{"USD": 987.65, "EUR": 123.45, "ETH": 123.45}
ExchangeRateDto
Description
Exchange rate object
Fields
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
- DateTime!
Date of last price update
Example
{
"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"
}
FeeRateDto
Description
Payments fee rates
Fields
id
- Float!
Auto-incrementing identifier.
ownerUri
- String!
Unique identifier for enterprise
stripePurchaseFee
- Float!
Fee rate charged during stripe payment. max value 100. Percentage value
createdAt
- DateTime!
Time at which the object was created.
updatedAt
- DateTime!
Time at which the object was last updated.
Example
{
"id": 123.45,
"ownerUri": "abc123",
"stripePurchaseFee": 987.65,
"createdAt": "2007-12-03T10:15:30Z",
"updatedAt": "2007-12-03T10:15:30Z"
}
Float
Description
The Float
scalar type represents signed double-precision fractional values as specified by IEEE 754.
Example
987.65
GetCardsDto
Description
Returns a list of cards and their number.
Fields
items
- [PaymentCardDataListDto!]!
Contains an array of cards
total
- Float!
The number of objects.
Example
{"items": [PaymentCardDataListDto], "total": 123.45}
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
123
NetworkName
Values
ropsten
kovan
ownet
mainnet
binance
bnbtest
sepolia
local
test
polygon
goerli
mumbai
ethereum
shibuya
amoy
base
baseSepolia
Example
"ropsten"
NetworkNameDto
Fields
networkName
- NetworkName!
Example
{"networkName": "ropsten"}
OnchainTxEventStatus
Values
TRANSACTION_ON_CHAIN_PENDING
TRANSACTION_ON_CHAIN_IN_PROGRESS
TRANSACTION_ON_CHAIN_FAILED
TRANSACTION_ON_CHAIN_SUCCEED
Example
"TRANSACTION_ON_CHAIN_PENDING"
PaymentCardDataDto
Description
Basic information about a credit or debit card.
Fields
brand
- String!
Card brand. Can be American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown.
country
- String!
Two-letter ISO code representing the country of the card.
expirationMonth
- Float!
Two-digit number representing the card’s expiration month.
expirationYear
- Float!
Four-digit number representing the card’s expiration year.
lastFourDigits
- String!
The last four digits of the card.
Example
{
"brand": "abc123",
"country": "xyz789",
"expirationMonth": 123.45,
"expirationYear": 987.65,
"lastFourDigits": "abc123"
}
PaymentCardDataListDto
Description
Basic information about a credit or debit card.
Fields
brand
- String!
Card brand. Can be American Express, Diners Club, Discover, JCB, MasterCard, UnionPay, Visa, or Unknown.
country
- String!
Two-letter ISO code representing the country of the card.
expirationMonth
- Float!
Two-digit number representing the card’s expiration month.
expirationYear
- Float!
Four-digit number representing the card’s expiration year.
lastFourDigits
- String!
The last four digits of the card.
paymentMethodId
- String!
Use stripe.createPaymentMethod to convert payment information collected by elements into a PaymentMethod. paymentMethodId is an id key from PaymentMethod object.
Example
{
"brand": "xyz789",
"country": "xyz789",
"expirationMonth": 123.45,
"expirationYear": 987.65,
"lastFourDigits": "abc123",
"paymentMethodId": "xyz789"
}
PurchaseEventDto
Description
Purchase event object. Represent a one-time purchase of any item.
Fields
id
- Float!
Auto-incrementing identifier.
invoiceItemId
- String!
Id of the item to be added to an invoice
invoiceId
- String!
Id of the invoice
amount
- String!
The integer amount in cents.
currency
- String!
Three-letter ISO currency code, in lowercase.
purchaseEventStatus
- 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
Address of the NFT contract
tokenId
- String
Token id from the NFT contract
seller
- String
Address of the seller of the NFT
quantity
- Int!
Quantity of tokens of token type id purchased
networkName
- NetworkName!
Name of the blockchain network on which the transaction occurs
onchainTxEventStatus
- 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!
NFT token value in cents.
serviceFeeInUSDCents
- Int!
Fee charged during stripe payment in cents
serviceFeePercentage
- Int!
Fee rate charged during stripe payment. max value 100. Percentage value
messageId
- String
Id generated by the client
transactionHash
- String
A unique string that is given to every transaction that is verified and added to the blockchain.
createdAt
- DateTime!
Time at which the object was created.
updatedAt
- DateTime!
Time at which the object was last updated.
Example
{
"id": 987.65,
"invoiceItemId": "xyz789",
"invoiceId": "abc123",
"amount": "abc123",
"currency": "xyz789",
"purchaseEventStatus": "DRAFT",
"collectionContract": "abc123",
"tokenId": "xyz789",
"seller": "xyz789",
"quantity": 123,
"networkName": "ropsten",
"onchainTxEventStatus": "TRANSACTION_ON_CHAIN_PENDING",
"priceInUSDCents": 123,
"serviceFeeInUSDCents": 123,
"serviceFeePercentage": 987,
"messageId": "abc123",
"transactionHash": "abc123",
"createdAt": "2007-12-03T10:15:30Z",
"updatedAt": "2007-12-03T10:15:30Z"
}
PurchaseEventListDto
Description
List of purchase events attached to the user.
Fields
total
- Float!
The number of objects.
items
- [PurchaseEventDto!]!
Contains an array of purchase events
Example
{"total": 123.45, "items": [PurchaseEventDto]}
PurchaseEventStatus
Values
DRAFT
PAYMENT_SUCCESSFUL
PAYMENT_FAILED
Example
"DRAFT"
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
"abc123"
Last updated
Was this helpful?