Suger Billing API
Access to Billing resources, such as addon, invoice, payment, etc.
Access to Billing resources, such as addon, invoice, payment, etc.
openapi: 3.0.1
info:
contact:
email: support@suger.io
name: Suger Support
url: https://www.suger.io/support
description: CRUD operations on a set of resources, including organizations, products, offers, entitlements, usage record groups for meterting, etc.
title: Suger API Billing API
version: '1.0'
servers:
- url: https://api.suger.cloud
tags:
- description: Access to Billing resources, such as addon, invoice, payment, etc.
name: Billing
paths:
/org/{orgId}/addon:
get:
description: List all addon templates
operationId: ListAddons
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: List pagination size, default 1000, max value is 1000
explode: true
in: query
name: limit
required: false
schema:
type: integer
style: form
- description: List pagination offset, default 0
explode: true
in: query
name: offset
required: false
schema:
type: integer
style: form
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/BillingAddon'
type: array
description: OK
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: internal error
security:
- APIKeyAuth: []
summary: List Addons
tags:
- Billing
post:
description: Create an addon template
operationId: CreateAddon
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateAndUpdateAddonParams'
description: CreateAndUpdateAddonParams
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BillingAddon'
description: OK
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: internal error
security:
- APIKeyAuth: []
summary: Create Addon
tags:
- Billing
x-codegen-request-body-name: data
/org/{orgId}/addon/{addonId}:
delete:
description: Soft delete an addon template
operationId: DeleteAddon
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: Addon ID
explode: false
in: path
name: addonId
required: true
schema:
type: string
style: simple
responses:
'200':
content:
application/json:
schema:
type: string
description: Empty string if deletion is successful
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: internal error
security:
- APIKeyAuth: []
summary: Delete Addon
tags:
- Billing
get:
description: Get an addon template
operationId: GetAddon
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: Addon ID
explode: false
in: path
name: addonId
required: true
schema:
type: string
style: simple
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BillingAddon'
description: OK
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: internal error
security:
- APIKeyAuth: []
summary: Get Addon
tags:
- Billing
patch:
description: Update an addon template
operationId: UpdateAddon
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: Addon ID
explode: false
in: path
name: addonId
required: true
schema:
type: string
style: simple
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateAndUpdateAddonParams'
description: CreateAndUpdateAddonParams
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BillingAddon'
description: OK
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: internal error
security:
- APIKeyAuth: []
summary: Update Addon
tags:
- Billing
x-codegen-request-body-name: data
/org/{orgId}/buyer/{buyerId}/paymentTransaction/{paymentTransactionId}/refund:
get:
description: list refunds of the payment transactions.
operationId: ListRefundOfPaymentTransaction
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: Buyer ID
explode: false
in: path
name: buyerId
required: true
schema:
type: string
style: simple
- description: Payment transaction ID
explode: false
in: path
name: paymentTransactionId
required: true
schema:
type: string
style: simple
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/BillingPaymentTransaction'
type: array
description: OK
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: Internal server error
security:
- APIKeyAuth: []
summary: List Refunds.
tags:
- Billing
post:
description: create refund on the payment transaction, support partial refunds multiple times.
operationId: CreateRefund
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: Buyer ID
explode: false
in: path
name: buyerId
required: true
schema:
type: string
style: simple
- description: Payment transaction ID
explode: false
in: path
name: paymentTransactionId
required: true
schema:
type: string
style: simple
- description: Refund amount
explode: true
in: query
name: amount
required: true
schema:
type: number
style: form
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BillingPaymentTransaction'
description: OK
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: Internal server error
security:
- APIKeyAuth: []
summary: Create Refund.
tags:
- Billing
/org/{orgId}/invoice:
get:
description: List invoices with pagination and filter by status (optional)
operationId: ListInvoices
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: Optional, filter by the entitlement ID
explode: true
in: query
name: entitlementId
required: false
schema:
type: string
style: form
- description: Optional, filter by the given buyer ID
explode: true
in: query
name: buyerId
required: false
schema:
type: string
style: form
- description: Optional, filter by invoice status as filter, if not provided, all status invoices are returned
explode: true
in: query
name: status
required: false
schema:
enum:
- DRAFT
- FINALIZED
- CANCELED
- DELETED
- ''
type: string
style: form
- description: List pagination size, default 1000, max value is 1000
explode: true
in: query
name: limit
required: false
schema:
type: integer
style: form
- description: List pagination offset, default 0
explode: true
in: query
name: offset
required: false
schema:
type: integer
style: form
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/BillingInvoice'
type: array
description: OK
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: Internal error
security:
- APIKeyAuth: []
summary: List Invoices
tags:
- Billing
/org/{orgId}/invoice/{invoiceId}:
get:
description: Get the invoice by ID
operationId: GetInvoice
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: Invoice ID
explode: false
in: path
name: invoiceId
required: true
schema:
type: string
style: simple
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BillingInvoice'
description: OK
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: Internal server error
security:
- APIKeyAuth: []
summary: Get Invoice
tags:
- Billing
/org/{orgId}/invoice/{invoiceId}/info:
patch:
description: Update a draft invoice. Only DueDate, OverallDiscount, and Memo can be updated.
operationId: UpdateInvoiceInfo
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: Invoice ID
explode: false
in: path
name: invoiceId
required: true
schema:
type: string
style: simple
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateInvoiceInfoRequest'
description: Update Invoice Info Request Params
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BillingInvoiceInfo'
description: Updated Invoice info
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: Internal server error
security:
- APIKeyAuth: []
summary: Update Invoice Info
tags:
- Billing
x-codegen-request-body-name: data
/org/{orgId}/invoice/{invoiceId}/issue:
patch:
description: Issue the invoice immediately. It can be used for manual issue or reissue invoice.
operationId: IssueInvoice
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: Invoice ID
explode: false
in: path
name: invoiceId
required: true
schema:
type: string
style: simple
requestBody:
content:
application/json:
schema:
items:
type: string
type: array
description: List of Contact IDs
required: false
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BillingInvoice'
description: the issued Invoice
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: Internal server error
security:
- APIKeyAuth: []
summary: Issue Invoice
tags:
- Billing
x-codegen-request-body-name: contactIds
/org/{orgId}/invoice/{invoiceId}/pay:
patch:
description: Initiate the payment for the invoice immediately. It can be used for manual payment or retry payment.
operationId: PayInvoice
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: Invoice ID
explode: false
in: path
name: invoiceId
required: true
schema:
type: string
style: simple
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BillingInvoice'
description: OK
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: Internal server error
security:
- APIKeyAuth: []
summary: Pay Invoice
tags:
- Billing
/org/{orgId}/invoice/{invoiceId}/preview:
get:
description: Returns the preview HTML content of the invoice issued email.
operationId: PreviewInvoiceEmail
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: Invoice ID
explode: false
in: path
name: invoiceId
required: true
schema:
type: string
style: simple
responses:
'200':
content:
text/html:
schema:
type: string
description: HTML content of the invoice issued email
'400':
content:
text/html:
schema:
type: string
description: Bad request error
'500':
content:
text/html:
schema:
type: string
description: Internal server error
security:
- APIKeyAuth: []
summary: Preview Invoice Email
tags:
- Billing
/org/{orgId}/invoice/{invoiceId}/void:
patch:
description: Void the invoice. It can be used for manual void or cancel the invoice.
operationId: VoidInvoice
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: Invoice ID
explode: false
in: path
name: invoiceId
required: true
schema:
type: string
style: simple
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/BillingInvoice'
description: OK
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: Internal server error
security:
- APIKeyAuth: []
summary: Void Invoice
tags:
- Billing
/org/{orgId}/paymentTransaction:
get:
description: List payment transactions with pagination and filters
operationId: ListPaymentTransactions
parameters:
- description: Organization ID
explode: false
in: path
name: orgId
required: true
schema:
type: string
style: simple
- description: Optional, filter by the given buyer ID
explode: true
in: query
name: buyerId
required: false
schema:
type: string
style: form
- description: Optional, filter by the given entitlement ID
explode: true
in: query
name: entitlementId
required: false
schema:
type: string
style: form
- description: Optional, filter by the given invoice ID
explode: true
in: query
name: invoiceId
required: false
schema:
type: string
style: form
- description: Optional, filter by status
explode: true
in: query
name: status
required: false
schema:
enum:
- PENDING
- PROCESSING
- SUCCESS
- FAILED
type: string
style: form
- description: Optional, filter by transaction type
explode: true
in: query
name: type
required: false
schema:
enum:
- CHARGE
- REFUND
type: string
style: form
- description: List pagination size, default 1000, max value is 1000
explode: true
in: query
name: limit
required: false
schema:
type: integer
style: form
- description: List pagination offset, default 0
explode: true
in: query
name: offset
required: false
schema:
type: integer
style: form
responses:
'200':
content:
application/json:
schema:
items:
$ref: '#/components/schemas/BillingPaymentTransaction'
type: array
description: OK
'400':
content:
application/json:
schema:
type: string
description: Bad request error
'500':
content:
application/json:
schema:
type: string
description: Internal server error
security:
- APIKeyAuth: []
summary: List Payment Transactions
tags:
- Billing
components:
schemas:
StripeBalanceTransactionFeeDetail:
properties:
amount:
description: Amount of the fee, in cents.
type: integer
application:
description: ID of the Connect application that earned the fee.
type: string
description:
description: An arbitrary string attached to the object. Often useful for displaying to users.
type: string
type:
description: 'Type of the fee, one of: `application_fee`, `payment_method_passthrough_fee`, `stripe_fee` or `tax`.'
type: string
type: object
StripeError:
properties:
code:
type: string
message:
type: string
param:
type: string
status:
type: integer
type:
type: string
type: object
BillingAddon:
example:
organizationID: organizationID
creationTime: 2000-01-23 04:56:07+00:00
name: name
description: description
id: id
info:
amount: 0.8008281904610115
lastUpdateTime: 2000-01-23 04:56:07+00:00
status: ACTIVE
properties:
creationTime:
format: date-time
type: string
description:
description: Description of the addon
maxLength: 300
type: string
id:
maxLength: 36
type: string
info:
$ref: '#/components/schemas/BillingAddonInfo'
lastUpdateTime:
format: date-time
type: string
name:
description: Name of the addon, e.g. "Support Plan"
maxLength: 50
minLength: 4
type: string
organizationID:
type: string
status:
$ref: '#/components/schemas/BillingAddonStatus'
type: object
InvoiceAdjustOverallMinimumSpend:
properties:
minimumSpend:
type: number
reason:
type: string
type: object
Partner:
enum:
- ''
- ADYEN
- ALIBABA
- AWS
- AWS_CHINA
- AZURE
- CHARGEBEE
- DATABRICKS
- DOCUSIGN
- GCP
- GOOGLE
- HUBSPOT
- INTUIT
- LAGO
- MARKETO
- METRONOME
- MICROSOFT
- ORACLE
- ORB
- REDHAT
- SALESFORCE
- SLACK
- SNOWFLAKE
- STRIPE
- ZOHO
type: string
x-enum-varnames:
- Partner_UNKNOWN
- Partner_ADYEN
- Partner_ALIBABA
- Partner_AWS
- Partner_AWS_CHINA
- Partner_AZURE
- Partner_CHARGEBEE
- Partner_DATABRICKS
- Partner_DOCUSIGN
- Partner_GCP
- Partner_GOOGLE
- Partner_HUBSPOT
- Partner_INTUIT
- Partner_LAGO
- Partner_MARKETO
- Partner_METRONOME
- Partner_MICROSOFT
- Partner_ORACLE
- Partner_ORB
- Partner_REDHAT
- Partner_SALESFORCE
- Partner_SLACK
- Partner_SNOWFLAKE
- Partner_STRIPE
- Partner_ZOHO
BillingPaymentTransactionInfo:
example:
stripePaymentIntent: '{}'
stripeBalanceTransaction: '{}'
stripeError: '{}'
stripeDisputes:
- paymentIntentId: paymentIntentId
reason: reason
amount: 6
is_charge_refundable: true
livemode: true
chargeId: chargeId
created: 1
id: id
status: status
- paymentIntentId: paymentIntentId
reason: reason
amount: 6
is_charge_refundable: true
livemode: true
chargeId: chargeId
created: 1
id: id
status: status
invoiceDate: 2000-01-23 04:56:07+00:00
stripeRefund: '{}'
refundExists: true
properties:
invoiceDate:
description: The invoice issue date.
format: date-time
type: string
refundExists:
description: Refund flag marks whether the transaction has any refund records.
type: boolean
stripeBalanceTransaction:
allOf:
- $ref: '#/components/schemas/StripeBalanceTransaction'
description: Balance transaction that describes the impact of this charge on your account balance.
type: object
stripeDisputes:
description: Stripe dispute result, got by Dispute API, there may be multiple disputes.
items:
$ref: '#/components/schemas/StripeDispute'
type: array
stripeError:
allOf:
- $ref: '#/components/schemas/StripeError'
description: Error of stripe API call
type: object
stripePaymentIntent:
allOf:
- $ref: '#/components/schemas/StripePaymentIntent'
description: Stripe payment intent result, got by PaymentIntent API
type: object
stripeRefund:
allOf:
- $ref: '#/components/schemas/StripeRefund'
description: Stripe refund result, got by Refund API
type: object
type: object
StripeDispute:
example:
paymentIntentId: paymentIntentId
reason: reason
amount: 6
is_charge_refundable: true
livemode: true
chargeId: chargeId
created: 1
id: id
status: status
properties:
amount:
description: Disputed amount. Usually the amount of the charge, but it can differ (usually because of currency fluctuation or because only part of the order is disputed).
type: integer
chargeId:
description: ID of the charge that's disputed.
type: string
created:
description: Time at which the object was created. Measured in seconds since the Unix epoch.
type: integer
id:
description: Unique identifier for the object.
type: string
is_charge_refundable:
description: If true, it's still possible to refund the disputed payment. After the payment has been fully refunded, no further funds are withdrawn from your Stripe account as a result of this dispute.
type: boolean
livemode:
description: Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
type: boolean
paymentIntentId:
description: ID of the PaymentIntent that's disputed.
type: string
reason:
description: Reason given by cardholder for dispute. Possible values are `bank_cannot_process`, `check_returned`, `credit_not_processed`, `customer_initiated`, `debit_not_authorized`, `duplicate`, `fraudulent`, `general`, `incorrect_account_details`, `insufficient_funds`, `product_not_received`, `product_unacceptable`, `subscription_canceled`, or `unrecognized`. Learn more about [dispute reasons](https://stripe.com/docs/disputes/categories).
type: string
status:
description: Current status of dispute. Possible values are `warning_needs_response`, `warning_under_review`, `warning_closed`, `needs_response`, `under_review`, `won`, or `lost`.
type: string
type: object
PriceModelCategory:
enum:
- basic
- tiered
- bulk
- volume
- percentage
- tiered-percentage
- matrix
type: string
x-enum-varnames:
- PriceModelCategory_Basic
- PriceModelCategory_Tiered
- PriceModelCategory_Bulk
- PriceModelCategory_Volume
- PriceModelCategory_Percentage
- PriceModelCategory_TieredPercentage
- PriceModelCategory_Matrix
BillingDiscount:
example:
discountType: PERCENTAGE
value: 1.4658129805029452
properties:
discountType:
$ref: '#/components/schemas/BillingDiscountType'
value:
type: number
type: object
StripePaymentIntentStatus:
enum:
- requires_payment_method
- requires_confirmation
- requires_action
- processing
- requires_capture
- canceled
- succeeded
type: string
x-enum-varnames:
- StripePaymentIntentStatus_RequiresPaymentMethod
- StripePaymentIntentStatus_RequiresConfirmation
- StripePaymentIntentStatus_RequiresAction
- StripePaymentIntentStatus_Processing
- StripePaymentIntentStatus_RequiresCapture
- StripePaymentIntentStatus_Canceled
- StripePaymentIntentStatus_Succeeded
InvoiceAdjustMinimumSpendByDimension:
example:
minimumSpend: 5.962133916683182
reason: reason
dimensionKey: dimensionKey
properties:
dimensionKey:
type: string
minimumSpend:
type: number
reason:
type: string
type: object
StripeRefundDestinationDetails:
properties:
card:
$ref: '#/components/schemas/StripeRefundDestinationDetailsCard'
type:
description: The type of transaction-specific details of the payment method used in the refund (e.g., `card`). An additional hash is included on `destination_details` with a name matching this value. It contains information specific to the refund transaction.
type: string
us_bank_transfer:
$ref: '#/components/schemas/StripeRefundDestinationDetailsUSBankTransfer'
type: object
MeteringUsageRecordGroupByKey:
example:
groupBysExpression: groupBysExpression
id: id
properties:
groupBysExpression:
description: GroupBysExpression is string expression of array of group bys.
type: string
id:
description: ID is billableMetric ID (Key)
type: string
type: object
BillingWalletType:
enum:
- ach_debit
- bacs_debit
- card
- credit
- sepa_debit
type: string
x-enum-comments:
BillingWalletType_ACH_DEBIT: for USD.
BillingWalletType_BACS_DEBIT: for UK.
BillingWalletType_CREDIT: Credit managed by Suger.
BillingWalletType_SEPA_DEBIT: for EUR.
x-enum-varnames:
- BillingWalletType_ACH_DEBIT
- BillingWalletType_BACS_DEBIT
- BillingWalletType_CARD
- BillingWalletType_CREDIT
- BillingWalletType_SEPA_DEBIT
StripePaymentIntent:
properties:
id:
description: Unique identifier for the object.
type: string
last_payment_error:
allOf:
- $ref: '#/components/schemas/StripeError'
description: The payment error encountered in the previous PaymentIntent confirmation. It will be cleared if the PaymentIntent is later updated for any reason.
type: object
livemode:
description: Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
type: boolean
status:
allOf:
- $ref: '#/components
# --- truncated at 32 KB (63 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/suger/refs/heads/main/openapi/suger-billing-api-openapi.yml