Invoices

Create a new invoice with items and payment details.

Important: For most use cases, use the Checkout/Payment Link API (/v2/payment_links) instead. It generates a payment link that you can embed in your own web page or redirect to.

Use Cases:

  • Create an invoice and manually mark it as paid for reference
  • Automated invoice generation
post/api/v2/invoices

Request

  • Base URL
    https://stream-app-service.streampay.sa
  • Auth
    • HTTP bearer
    • or API key in header x-api-key

Request body

notify_consumerboolean

Whether to send a notification to the consumer about the invoice

descriptionstring nullable

Invoice description or notes

couponsstring[] nullable

List of coupon UUIDs to apply for discounts

organization_consumer_idstring uuid4 required

UUID of the consumer who will pay this invoice

organization_consumer_beneficiariesstring[] nullable

UUID of the beneficiaries to the consumer who will pay this invoice

scheduled_onstring date-time required

Invoice due date

installment_rule_override_idstring uuid4 nullable

ID of the installment rule to use as an override for this invoice. If null, the default rule is used. Cannot be changed once the invoice is split into installments.

installments_start_datestring date-time nullable

When the invoice is split into installments, this date anchors the due dates of subsequent installments.

Example: for a monthly plan split into 3 installments, with scheduled_on set to Jan 1:

If installments_start_date is null, the subsequent installments are due on Feb 1 and Mar 1.

If installments_start_date is Feb 4, they are due on Feb 4 and Mar 4.

exclude_coupons_if_installmentsboolean

[DEPRECATED] Whether coupons are excluded when paying by installments. Use payment plan coupons instead.

currency'SAR' | 'USD' | 'EUR' | 'GBP' | 'AED' | 'BHD' | 'KWD' | 'OMR' | 'QAR'

ISO 4217 currency codes supported by Moyasar.

Includes all currencies supported by Moyasar payment gateway.

accounting_external_idstring nullable

The accounting system's own record id (e.g. Zoho invoice_id) for a pre-existing invoice this invoice should be reconciled against instead of creating a new document.

Response

Successful Response

created_atstring date-time

Creation timestamp of the object.

updated_atstring date-time nullable

Last modification timestamp of the object.

idstring uuid4

Unique identifier (UUID) of the invoice

payment_link_idstring uuid4 nullable

Unique identifier (UUID) of the payment link if invoice was created from one

metered_subscription_idstring uuid4 nullable

Unique identifier (UUID) of the metered subscription billed by this invoice

user_idstring uuid4

Unique identifier (UUID) of the user who created the invoice

organization_idstring uuid4

Unique identifier (UUID) of the organization

organization_consumer_idstring uuid4

Unique identifier (UUID) of the organization consumer

account_idstring uuid4

Unique identifier (UUID) of the account

branch_idstring uuid4

Unique identifier (UUID) of the branch

org_invoice_numberinteger

Organization-specific invoice number

descriptionstring nullable

Description of the invoice

total_amountstring

Total invoice amount after discounts (in invoice currency)

original_amountstring

Original invoice amount before discounts (in invoice currency)

item_level_discounted_amountstring

Total amount discounted at the item level

total_vat_amountstring nullable

Total VAT amount calculated from products

total_price_excluding_vatstring nullable

Total price excluding VAT

currency'SAR' | 'USD' | 'EUR' | 'GBP' | 'AED' | 'BHD' | 'KWD' | 'OMR' | 'QAR'

ISO 4217 currency codes supported by Moyasar.

Includes all currencies supported by Moyasar payment gateway.

home_currency_amountstring nullable

Total in home currency (SAR) for reporting. Equals total_amount for SAR invoices.

home_currency_amount_actualstring nullable

Actual settled amount in home currency (SAR) after payment processing.

exchange_rate_at_creationstring nullable

Exchange rate used at invoice creation time (for audit). 1 for SAR invoices.

consumer_messagestring nullable

Message to display to the consumer

status'DRAFT' | 'CREATED' | 'SENT' | 'ACCEPTED' | 'REJECTED' | 'COMPLETED' | 'CANCELED' | 'EXPIRED'

Invoice status enum representing the lifecycle/state of an invoice.

Status describes the current stage of an invoice in its lifecycle (DRAFT → CREATED → ACCEPTED → COMPLETED). This changes over time as the invoice progresses. Different from InvoiceType which describes the payment structure.

payment_method'OPENBANKING' | 'PAYMENTGATEWAY'
allowed_payment_flow'ALL' | 'AUTO' | 'MANUAL'
current_payment_flow'ALL' | 'AUTO' | 'MANUAL'
period_startstring date-time nullable

Start date and time of the billing period

period_endstring date-time nullable

End date and time of the billing period

recurring_interval'WEEK' | 'MONTH' | 'SEMESTER' | 'YEAR'
recurring_interval_countinteger nullable

Number of intervals per billing cycle for recurring invoices

type'ONE_OFF' | 'ONE_OFF_FUTURE' | 'RECURRING' | 'INSTALLMENTS' | 'PRORATION'

Invoice type enum representing the payment structure/pattern of an invoice.

Type describes how the invoice is structured for payments (ONE_OFF, RECURRING, INSTALLMENTS, etc.). This is determined at invoice creation and typically doesn't change. Different from InvoiceStatusEnum which describes the current lifecycle state of the invoice.

no_of_paymentsinteger nullable

Number of payment rows on the invoice (updated when payments are added or split)

installments_start_datestring date-time nullable

Anchor date for installment plan after payment

installment_rule_override_idstring uuid4 nullable

Override installment rule offered on this invoice instead of the amount-based default

accounting_external_idstring nullable

The accounting system's own record id this invoice is reconciled against, if any

invoice_numberinteger

Global unique invoice number

remaining_amountstring

Remaining amount to be paid

paid_amountstring

Total amount already paid

exclude_coupons_if_installmentsboolean

[DEPRECATED] Whether coupons are excluded when paying by installments. Use payment plan coupons instead.

subscription_idstring uuid4 nullable

Unique identifier (UUID) of the subscription if this invoice is part of a subscription

recurrence_pattern'Hour' | 'Day' | 'Week' | 'Fortnight' | 'Month' | 'Quarter' | 'Half-Year' | 'Year'
parent_idstring uuid4 nullable

Parent invoice ID for recurring invoices

urlstring

URL to access the invoice

total_creditedstring

Sum of credit adjustment amounts (absolute value of negative net changes)

total_debitedstring

Sum of debit adjustment amounts

total_refundedstring

Sum of payment refunds on this invoice

net_receivedstring

Sum of paid payment amounts minus total_refunded

total_amount_in_smallest_unitinteger

Total invoice amount in smallest currency unit (e.g. halala for SAR).

original_amount_in_smallest_unitinteger

Original invoice amount (before discounts) in smallest currency unit.

remaining_amount_in_smallest_unitinteger

Remaining amount in smallest currency unit.

paid_amount_in_smallest_unitinteger

Paid amount in smallest currency unit.

Changes

    • info

      request property deprecated

    • info

      response property exclude_coupons_if_installments deprecated

    • warning

      removed the request property

    • warning

      removed the optional property from the response with the status

    • warning

      removed the optional property /// from the response with the status

    • warning

      removed the optional property //// from the response with the status

    • warning

      removed the optional property // from the response with the status

    • info

      added the new optional request property

    • info

      added the optional property to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property //// to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      added the optional property /// to the response with the status

    • info

      the response optional property // became read-only for the status

    • info

      the response optional property /// became read-only for the status