Flow: MSISDN (mobile carrier billing)
- CreateCustomerContract — create a contract for the MSISDN (see “Creating a contract”).
- AuthorizeCustomerContract — confirm the PIN (in the sandbox the correct one is
1234, three attempts). - CreateInvoice with
<MobilePhoneCustomer>— create an invoice. - The mock sends a SendPaymentTransaction callback to your callback URL.
In JSON the response to POST /invoices with customer.type: mobile_phone carries an authorization block: {"type": "SMS_PIN", "is_authorized": false} — the next step is visible from the response. The spec allows seven authorization. values, the sandbox returns one: it does not emulate the operator picking a scheme. For a paid invoice is_authorized becomes true.
The sandbox delivers no PIN by SMS — the correct value is a fixed 1234. POST /invoices/{id}/authorize with any other value returns 422 INVOICE_NOT_AUTHORIZED and reports how many attempts are left; after three failures it returns 422 INVOICE_AUTH_ATTEMPTS_EXCEEDED and never accepts authorization again, the correct PIN included. The correct PIN moves the invoice to active. The XML method AuthorizeCustomerContract still accepts any PIN — no check was added there.
TestInfo — controls the payment result in the sandbox: add <TestInfo><ExpectedBillingResult>…</ExpectedBillingResult></TestInfo> to the XML request. Values: Success · Failed · SuccessSequencePayment · FailedSequencePayment.
CreateInvoice — mobile carrier billing (XML)
Sandbox
curl
curl -X POST \
https://pay-sandbox.digitalspb.com/API/XML/InvoiceManagementService.ashx \
-H "Content-Type: text/xml; charset=utf-8" \
--data-binary @create_invoice.xml
# create_invoice.xml:
# <Request>
# <Header><Authentication>
# <Login>demo_login</Login>
# <NowUtc>20260625120000</NowUtc>
# <Signature>abcdef1234...</Signature>
# </Authentication></Header>
# <CreateInvoiceRequest>
# <ProjectID>1001</ProjectID>
# <MobilePhoneCustomer>
# <MSISDN>79600000000</MSISDN>
# </MobilePhoneCustomer>
# <InvoiceInfo>
# <MerchantOrderID>ORDER-001</MerchantOrderID>
# <CustomerPrice amount="99.00" currency="RUB" includingVAT="true"/>
# </InvoiceInfo>
# <CustomerContractInfo>
# <CreateIfNotExists>false</CreateIfNotExists>
# <MerchantContractID>contract-123</MerchantContractID>
# </CustomerContractInfo>
# <!-- Sandbox: controlling the result -->
# <TestInfo><ExpectedBillingResult>Success</ExpectedBillingResult></TestInfo>
# </CreateInvoiceRequest>
# </Request>CreateInvoice — mobile carrier billing (JSON)
Sandbox
curl
curl -X POST \
https://pay-sandbox.digitalspb.com/api/v3/projects/1001/invoices \
-H "Content-Type: application/json" \
-H "X-Login: demo_login" \
-H "X-Timestamp: $TS" \
-H "X-Signature-Version: 3" \
-H "X-Signature: $SIG" \
-d '{
"customer": { "type": "mobile_phone", "msisdn": "79600000000" },
"order": {
"merchant_order_id": "ORDER-001",
"price": { "amount": "99.00", "currency": "RUB", "vat_included": true }
},
"contract": { "create_if_not_exists": false, "merchant_contract_id": "contract-123" }
}'