Skip to main content
POST
History Invoice Import (supports override)

Endpoint Overview

POST https://api.unibee.dev/merchant/invoice/history_invoice_import Each repetition import overrides existing invoices with matching InvoiceId (BizType=Import).

Authorization

All UniBee Merchant API requests require authentication via API key.

Parameters

Parameters for this endpoint are listed below. The schema is also shown in the Try it panel.

Request body


Request examples

cURL

Sandbox


Response

Success responses return a JSON envelope with code, data, message, redirect, and requestId. code 0 indicates success.

Error handling

When code in the response body is non-zero, check message for details. Use requestId when contacting support.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Each repetition import overrides existing invoices with matching InvoiceId (BizType=Import).

currency
string<string>
required

Required, currency code (e.g. USD)

invoiceId
string<string>
required

Required, external invoice id

totalAmount
integer<int64>
required

Required, total amount in cents, positive for payment, negative for refund

countryCode
string<string>

Optional, ISO 3166-1 alpha-2 country code

createTime
string<string>

Optional, invoice create time '2006-01-02 15:04:05' (UTC)

discountAmount
integer<int64>

Optional, discount amount in cents

email
string<string>

User email, one of Email or ExternalUserId is required

externalUserId
string<string>

External user id, one of Email or ExternalUserId is required

gatewayId
integer<int64>

Optional, gateway id. If 0 or omitted, invoice will be stored with gateway_id=0.

invoiceName
string<string>

Optional, human readable invoice name (for display/search). If empty, system will use a generic name.

invoiceStatus
string<string>

Optional, paid|failed|cancelled, default paid if blank

lines
object[]

Optional (API only), simplified invoice line items. If omitted or empty, system will automatically generate a single aggregated line from invoice-level amounts.

Optional, if true, link to user's latest active subscription in current merchant (ignores SubscriptionId).

metadata
object

Optional, metadata map to be stored into invoice.meta_data.

originalInvoiceId
string<string>

Required when totalAmount < 0, original payment invoice's InvoiceId (of the payment invoice).

periodEnd
string<string>

Optional, period end '2006-01-02 15:04:05' (UTC)

periodStart
string<string>

Optional, period start '2006-01-02 15:04:05' (UTC)

productName
string<string>

Optional, product name shown on invoice. If empty, may fall back to InvoiceName.

subscriptionId
string<string>

Optional, subscription id. If provided, must belong to current user.

taxAmount
integer<int64>

Optional, tax amount in cents

Response

200 - application/json
code
integer<int>
data
object
merchantId
integer<int64>
message
string<string>
redirect
string<string>
requestId
string<string>