Create invoice
/api/v3/projects/YOUR_PROJECT_ID/invoicesDescription
Creates a new invoice for a customer. Supports both mobile phone (DCB) and bank card
payment flows; the customer type is selected via customer.type.
On the PCI DSS contour host the request may additionally carry customer.bank_card:
the card is charged straight away and authorization.url returns the 3-D Secure page
when the bank asks for one. On the main host the payer enters the card on the payment
page opened by authorization.url.
Only one active Invoice per (project, customer) is allowed. If an active Invoice already
exists, the platform returns 409 Conflict with error.code = INVOICE_ALREADY_EXISTS
and error.details.invoice_id referring to the existing record.
v4 signature payload:
{order.merchant_order_id}{customerPayload}{order.price.amount}{order.price.currency}{contract.merchant_contract_id}{client_ip}
XML 2.9 description
Creates a new invoice for a customer. XML request type: <CreateInvoiceRequest>.
Important: Only one Invoice per user (ProjectID + MSISDN) can be active at a time. If an active Invoice already exists, the Platform will return ResultCode=206 (Business_InvoiceAlreadyExists) with the existing InvoiceID.
HTTP Headers:
Callisto-Protocol-Version: 2SignatureVersion: 3
Supported customer types:
<MobilePhoneCustomer>— for mobile phone (DCB) payments<UndefinedBankCardCustomer>— for bank card payments<BankCardCustomer>— for known bank card customers
Request and response
Examples come from OpenAPI and are read-only here. Run requests in the Sandbox section.
/api/v3/projects/YOUR_PROJECT_ID/invoicesPRODUCTIONcurl -X POST "https://pay-api.digitalspb.com/api/v3/projects/YOUR_PROJECT_ID/invoices" \ -H "Content-Type: application/json" \ -H "X-Login: YOUR_LOGIN" \ -H "X-Timestamp: YOUR_TIMESTAMP" \ -H "X-Signature-Version: 3" \ -H "X-Signature: YOUR_SIGNATURE" \ -d '{ "client_ip": "10.20.30.40", "customer": { "type": "mobile_phone", "msisdn": "79600000000", "email": "test@test.com" }, "order": { "merchant_order_id": "order_123", "price": { "amount": "25.00", "currency": "RUB", "vat_included": true }, "description": "Premium subscription" }, "contract": { "create_if_not_exists": false, "merchant_contract_id": "1234567890" }, "application": { "name": "Game of Sultans" }, "product": { "name": "New Pack_1" }}'{ "success": true, "data": { "invoice_id": "1624505c-0031-00cf-7d54-4cf1ce08cb30", "status": "created", "payment_status": "NOT_PAID", "authorization": { "type": "BY_CONTRACT", "is_authorized": true }, "price": { "amount": "25.00", "currency": "RUB", "vat_included": true }, "merchant_order_id": "order_123", "created_at": "2025-03-29T20:00:10Z", "expires_at": "2025-03-29T22:00:10Z", "billing_channel": "CPA", "customer": { "type": "mobile_phone", "msisdn": "79600000000", "country": "RU", "network": { "id": 3, "name": "Beeline" }, "operator": { "id": 42, "name": "Beeline" } }, "contract": { "contract_id": "16449203-0000-009b-a125-351b7bfbd207", "authorization_type": "SMS_PIN", "expires_at": "2025-03-29T20:00:08Z", "merchant_contract_id": "1234567890" } }}JSON v3 request fields
Invoices_Create| Request fields | Type | Req. | Description |
|---|---|---|---|
client_ip | string | optional | IP address from which the customer makes the request. Required by default (configurable per project). |
customer | object | optional | Polymorphic customer block. The actual subset of fields depends on
Choosing between the two card types. They are different payment routes, so the type is always stated explicitly — it is never inferred from other fields:
|
type | string | optional | mobile_phonebank_cardundefined_bank_card |
msisdn | string | optional | Customer's MSISDN in international E.164 format (no |
email | string (email) | optional | Customer's email |
country | string | optional | Country code (ISO 3166-1 alpha-2). Required for |
network | object | optional | +2 |
id | integer (int32) | optional | Network ID (see operators reference) |
name | string | optional | |
operator | object | optional | +2 |
id | integer (int32) | optional | Operator ID (see operators reference) |
name | string | optional | |
source | string | optional | Source name in the merchant's system (unique per partner). Required for |
merchant_customer_id | string | optional | Unique customer ID in the merchant's system. Required for |
bank_card | unknown | optional | |
order | object | optional | |
merchant_order_id | string | optional | Order ID in the merchant's system. Must be unique. |
price | object | optional | Monetary amount with currency. Used for prices, profits and totals. |
amount | string | optional | Fixed-point decimal as string (two digits after the dot). String is used to avoid floating-point rounding. |
currency | string | optional | Payment currency code (ISO 4217). |
vat_included | boolean | optional | Whether the amount includes VAT. |
description | string | optional | Order description text |
additional_parameters | object | optional | Arbitrary invoice parameters stored with the invoice, the JSON counterpart of the XML |
contract | object | optional | Optional contract block used during invoice creation to associate or create a contract along with the invoice. |
create_if_not_exists | booleannull | optional | If |
merchant_contract_id | string | optional | The ID of the contract in the merchant's system. Unique within a single customer identity. |
application | object | optional | |
name | string | optional | Application name (e.g. game or app where the user makes purchases) |
is_subscription | boolean | optional | Marks the invoice as a subscription charge. Stored with the invoice and used in reporting; does not by itself create a recurring schedule. |
product | object | optional | |
name | string | optional | Product name — what exactly the user paid for |
XML 2.9 request fields
createInvoice| Request fields | Type | Req. | Description |
|---|---|---|---|
CreateInvoiceRequest | object & object | required | |
ProjectID | integer (int32) | required | Project ID in the Platform system. Assigned during project setup. |
UndefinedMobilePhoneCustomer | object & object | optional | +2 |
NetworkID | integer (int32) | required | |
Email | string | optional | |
MobilePhoneCustomer | object & object | optional | Customer identification by mobile phone number. MSISDN is the primary identifier. |
MSISDN | string | required | Client's MSISDN (Mobile Subscriber Integrated Services Digital Number) in international format without '+' sign |
Email | string (email) | optional | Client's e-mail address |
BankCardCustomer | object & object | optional | Customer identification by bank card. Used for card payment scenarios. |
Email | string (email) | optional | Client's e-mail address |
Source | string | required | Source Name in Merchant's system (unique for Partner Service). Should be a unique identifier (e.g. resource/brand name) guaranteeing global uniqueness for parameters source+MerchantCustomerId in all systems. |
Country | string | required | Country code (ISO 3166-1 alpha-2, lowercase) |
MerchantCustomerId | string | required | Customer ID in Merchant's system (unique) |
UndefinedBankCardCustomer | object & object | optional | Bank card customer identification without full data set. Used for initial card payment when card details are not yet known. |
Source | string | optional | Source Name in Merchant's system (unique for Partner Service). Should guarantee global uniqueness for parameters source+MerchantCustomerId. |
Country | string | required | Country code (ISO 3166-1 alpha-2, lowercase) |
MerchantCustomerId | string | required | Customer ID in Merchant's system (unique) |
Email | string (email) | optional | Client's e-mail address |
UndefinedCustomer | object & object | optional | +2 |
Country | string | optional | |
Email | string | optional | |
ClientIP | string | optional | IP address from which the client makes the request. The obligation of this parameter is set in the project settings. It is considered mandatory by default. |
InvoiceInfo | object | optional | Merchant order/invoice information in request. |
MerchantOrderID | string | optional | Order ID in Merchant's system. Must be unique. |
CustomerPrice | object | optional | Monetary amount with currency. Used for prices, profits, and totals. |
amount | number | required | Amount value. In the case of discrete tariffs, the Platform uses the nearest one. If absent in request — the default project value is used. |
currency | string | required | Payment currency code (ISO 4217). RUB by default. |
includingVAT | boolean | required | Whether the amount includes VAT. "false" by default. |
AllowDownscaling | boolean | optional | Allow amount downscaling if exact tariff not available |
MobileBillingDetails | object & object | optional | +3 |
ServiceNumber | string | required | Service number for mobile billing |
ContractRateID | integer (int32) | optional | |
PriceIncludingVAT | boolean | optional | |
Description | string | optional | Order description text |
AdditionalParameters | object | optional | +3 |
Parameter | array<object> | optional | +2 |
name | string | required | |
value | string | required | |
CustomerContractInfo | object | optional | Contract creation parameters for CreateInvoice request. |
MerchantContractID | string | optional | The ID of the contract in the Merchant's system. If the value is set, a contract will be created using the MSISDN + MerchantContractID key. If not specified, only by MSISDN. Unique within a single MSISDN. |
CreateIfNotExists | boolean | optional | If "true" and the project supports contract scheme, and user has no contract — a new contract will be created for the user. |
BindingType | string | optional | What is bound to the contract:
CardSbp |
ApplicationInfo | object | optional | Partner application information. Identifies the application where the user makes purchases. |
AppName | string | optional | Application Name where user makes purchases |
IsSubscription | boolean | optional | Whether it is a subscription payment |
ProductInfo | object | optional | Partner product information. Describes what exactly the user paid for. |
ProductName | string | optional | Product Name — what exactly the user paid for |
Items | object | optional | +7 |
Item | array<object> | optional | +6 |
name | string | required | |
price | number | required | |
quantity | integer (int32) | optional | |
priceIncludingVat | boolean | optional | |
vatRate | number | required | |
vatAmount | number | optional | |
AuthorizationInfo | object | optional | Authorization data — PIN code entered by the subscriber to confirm the payment or contract. |
PinCode | string | required | PIN code entered by the subscriber to confirm the contract/invoice |
TestInfo | object | optional | Test information for invoice creation. Used only in test/sandbox environment to simulate billing results. |
ExpectedBillingResult | string | required | Expected billing result (for test requests) FailedSuccessFailedSequencePaymentSuccessSequencePayment |
ExpectedPaymentCount | integer (int32) | required | Expected payment count |
Header | object | required | Request header with authentication. Included in every API request. |
Authentication | object | required | Request authentication data. All three fields are mandatory for every request. |
Login | string | required | Merchant Login assigned by the Platform |
NowUtc | string | required | Current UTC time in yyyyMMddHHmmss format. Must not differ from platform system time by more than 20 minutes. |
Signature | string | required | HMAC request signature. Calculated as: LOWERCASE(HMACSHA256(Password, Login + LOWERCASE(HMACSHA256(Password, NowUtc)))) |
RequestAttempt | integer (int32) | optional | Ordinal invoice request number (for idempotency). Starting from 0. |
Gateway | object | optional | +3 |
Signature | string | optional | |
ContractInfo | object | optional | +1 |
DesiredExpirationTimeUtc | string (date-time) | optional |
Parameters and headers
| Name | In | Required | Description |
|---|---|---|---|
projectId | path | yes | Project ID assigned by the platform during onboarding. |
Responses
exampleFull error codes are in Error codes.