API · Invoices

Create invoice

Protocol: JSON v3 · XML 2.9POST/api/v3/projects/YOUR_PROJECT_ID/invoices

Description

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: 2
  • SignatureVersion: 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.

POST/api/v3/projects/YOUR_PROJECT_ID/invoicesPRODUCTION
Request
curl -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"  }}'
Read-only example. Runnable examples are available in the Sandbox section.
201
{  "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 fieldsTypeReq.Description
client_ipstringoptional

IP address from which the customer makes the request. Required by default (configurable per project).

customerobjectoptional

Polymorphic customer block. The actual subset of fields depends on type:

  • mobile_phone: msisdn, email
  • bank_card: source, country, merchant_customer_id, email, and — on the PCI DSS contour host only — bank_card with the card details
  • undefined_bank_card: same fields as bank_card, minus the card details

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:

  • undefined_bank_card — the payer enters the card on the payment page opened by authorization.url. The card is not bound, contracts are not supported.
  • bank_card — the card is bound to a contract and can be charged again later. Requires approved bank card settings for the project and the payer's country; on the PCI DSS contour the card details are sent with the request.
typestringoptional
mobile_phonebank_cardundefined_bank_card
msisdnstringoptional

Customer's MSISDN in international E.164 format (no +). Required for mobile_phone.

emailstring (email)optional

Customer's email

countrystringoptional

Country code (ISO 3166-1 alpha-2). Required for bank_card.

networkobjectoptional+2
operatorobjectoptional+2
sourcestringoptional

Source name in the merchant's system (unique per partner). Required for bank_card.

merchant_customer_idstringoptional

Unique customer ID in the merchant's system. Required for bank_card.

bank_cardunknownoptional
orderobjectoptional
merchant_order_idstringoptional

Order ID in the merchant's system. Must be unique.

priceobjectoptional

Monetary amount with currency. Used for prices, profits and totals.

+3
descriptionstringoptional

Order description text

additional_parametersobjectoptional

Arbitrary invoice parameters stored with the invoice, the JSON counterpart of the XML <AdditionalParameters>/<Parameter name= value=/> block. Parameter names are case-insensitive and must be unique. On cancel/refund/authorize the given values are merged into the ones already stored: names that match are overwritten, the rest are kept.

contractobjectoptional

Optional contract block used during invoice creation to associate or create a contract along with the invoice.

create_if_not_existsbooleannulloptional

If true and the project supports contract scheme and customer has no contract — a new contract will be created.

merchant_contract_idstringoptional

The ID of the contract in the merchant's system. Unique within a single customer identity.

applicationobjectoptional
namestringoptional

Application name (e.g. game or app where the user makes purchases)

is_subscriptionbooleanoptional

Marks the invoice as a subscription charge. Stored with the invoice and used in reporting; does not by itself create a recurring schedule.

productobjectoptional
namestringoptional

Product name — what exactly the user paid for

XML 2.9 request fields

createInvoice
Request fieldsTypeReq.Description
CreateInvoiceRequestobject & objectrequired
ProjectIDinteger (int32)required

Project ID in the Platform system. Assigned during project setup.

UndefinedMobilePhoneCustomerobject & objectoptional+2
MobilePhoneCustomerobject & objectoptional

Customer identification by mobile phone number. MSISDN is the primary identifier.

+2
BankCardCustomerobject & objectoptional

Customer identification by bank card. Used for card payment scenarios.

+4
UndefinedBankCardCustomerobject & objectoptional

Bank card customer identification without full data set. Used for initial card payment when card details are not yet known.

+4
UndefinedCustomerobject & objectoptional+2
ClientIPstringoptional

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.

InvoiceInfoobjectoptional

Merchant order/invoice information in request.

+15
CustomerContractInfoobjectoptional

Contract creation parameters for CreateInvoice request.

+3
ApplicationInfoobjectoptional

Partner application information. Identifies the application where the user makes purchases.

+2
ProductInfoobjectoptional

Partner product information. Describes what exactly the user paid for.

+9
AuthorizationInfoobjectoptional

Authorization data — PIN code entered by the subscriber to confirm the payment or contract.

+1
TestInfoobjectoptional

Test information for invoice creation. Used only in test/sandbox environment to simulate billing results.

+2
Headerobjectrequired

Request header with authentication. Included in every API request.

Authenticationobjectrequired

Request authentication data. All three fields are mandatory for every request.

+3
RequestAttemptinteger (int32)optional

Ordinal invoice request number (for idempotency). Starting from 0.

Gatewayobjectoptional+3

Parameters and headers

NameInRequiredDescription
projectIdpathyesProject ID assigned by the platform during onboarding.

Responses

201
Invoice createdexample
400
401
403
500
503

Full error codes are in Error codes.