# Merchant API

Important!

You should start the integration with Mandarin system only after the business process of interaction is coordinated between representatives of business departments of the store and a client manager or Project Manager (in case of a joint integration project) from Mandarin. This need is due to the fact that Mandarin is not a boxed solution and adapts to the needs of a particular store. The implementation of integration without prior approval from employees of business units may lead to the inability to actually implement the business process of interaction and, as a consequence, to financial losses on the part of the store.

# Introduction

# Addresses for sending requests

# Getting the ApiKey

The API key to connect is transferred through the Client Manager or Project Manager (in case of a joint integration project) from Mandarin.

The ApiKey from the test loop is initially issued.

ApiKey from the product loop is issued after the integration is completed and successful testing of the interaction is performed.

# Basic API methods

# Check if the queries are correctly formed

You can check the correctness of the generated query by using the service https://www.jsonschemavalidator.net/

# Submitting order details

Method is used to send order information to Mandarin.

This method will return the ApplicationID, which should be used to call the Mandarin questionnaire using the following link `home/uforms?applicationId=received when requesting the ApplicationID'

Checks performed by Mandarin when receiving data:

  1. Amount = Price × Quantity
  2. AmountWithDiscount = PriceWithDiscount × Quantity
  3. Amount ≥ AmountWithDiscount

If the value of the "DeliveryCost" parameter is not zero, then an item with the following parameters is created as part of the cart (array "Cart"):

  • Category: "Other"
  • ProductID: "Delivery"
  • Price: value of the "DeliveryCost" parameter
  • PriceWithDiscount: the value of the "DeliveryCost" parameter
  • ProductName: "Delivery"
  • Quantity: 1 All amounts are given in kopecks. At the end of processing the request, depending on its result goes to the store page specified in the parameters CallBackURLsuccess or CallBackURLfail

Important!

The following JSON request parameters are coordinated by the store business representatives with the Client Manager or Project Manager (in case of a joint integration project) from Mandarin. If they are transmitted incorrectly, the correctness of interaction within the business process is not guaranteed

Parameter Required Description
ProductName Yes Title
InitialFee The amount of the down payment, in case of transfer, this parameter will be set by default on the calculator screen.
InitialFeeInStore parameter that determines where the down payment will be collected - in store, through Mandarin, or no down payment is provided (in this case, the client will not be able to indicate the down payment on the calculator screen)
DeliveryCost shipping costs
DeliveryCostUse the parameter that determines the use of the delivery cost - do nothing, include it in the credit amount, assign it to payment via Mandarin from the client’s card.
CallBackURLsuccess the page to which the client will be redirected after the loan is approved.
CallBackURLfail the page to which the client will be redirected in the event of a loan refusal.
PriceWithDiscount similar to AmountWithDiscount , but for an individual product.
LoanTerm Default loan term; in case of transfer, this parameter will be set by default on the calculator screen.
ClientCanChangeTerm a parameter that determines whether the client will be able to change the loan term on the calculator screen.
SigningByTheStore a parameter that determines who will sign loan documents - store employees or Mandarin employees.
ClientCanChangeInitialFee

Simple request:

POST https://api.7seconds.ru/api/merch/order
{
     "$schema": "http://json-schema.org/draft-04/schema#",
     { "description": "Comment describing your JSON Schema",
     { "type": "object",
     { "properties": {
         { "ApiKey." {
             "description": "Password obtained when registering with Mandarin, the passwords for the test and product loops are different."
             { "type": "string",
             "minLength": 32,
             "maxLength": 32
        },
         "OrderID": {
             "description": "store order number",
             { "type": "string",
             "minLength": 1,
             "maxLength": 16
        },
         { "orderDesc": {
             { "description": "order description",
             { "type": "string",
             "minLength": 1,
             "maxLength": 128
        },
         { "Amount": {
             "description": "Amount of the order in kopecks excluding the store discount (the price that the client sees in the cart)",
             { "type": "integer",
             { "minimum": 1,
             "maximum": 100000000
        },
         "AmountWithDiscount: {
             "description": "The amount of the order in kopecks, taking into account the discount of the store (by discount we mean the size of the discount of the store for the client to have an installment plan or a reduced rate on the loan). This amount will be in the loan agreement,
             { "type": "integer",
             { "minimum": 1,
             "maximum": 100000000
        },
         { "InitialFee": {
             "description": "The amount of the down payment in kopecks (This value will be preset on the loan calculator)",
             { "type": "integer",
             { "minimum": 0,
             "maximum": 100000000
        },
         "InitialFeeInStore: {
             "description": "Parameter that determines where the down payment will be made. If the value 1 is specified, the customer must pay the down payment in the store, if 2, then the down payment is made through Mandarin by card, if 3, then the down payment is not provided, the SP field on the calculator will be hidden",
             { "type": "integer",
             { "minimum": 1,
             "maximum": 3
        },
         { "DeliveryCost": {
             "description": "Shipping cost in pennies, should not be included in the Amount and AmountWithDiscount parameters",
             { "type": "integer",
             { "minimum": 0,
             "maximum": 100000000
        },
         "DeliveryCostUse: {
             "description": "Parameter for using the shipping cost, determines depending on the specified value of the parameter. Value 1 - do nothing with the shipping cost. Value 2 - include the shipping cost in the cost of credit. Value 3 - assign the cost of delivery to the payment through Mandarin by card.",
             { "type": "integer",
             { "minimum": 1,
             "maximum": 3
        },
         "FirstName": {
             { "description": "client name",
             { "type": "string",
             "minLength": 1,
             "maxLength": 128
        },
         "LastName": {
             "description": "client name",
             { "type": "string",
             "minLength": 1,
             "maxLength": 128
        },
         { "MiddleName": {
             { "description": "client patronymic",
             { "type": "string",
             "minLength": 1,
             "maxLength": 128
        },
         { "Email." {
             { "description": "client email",
             { "type": "string",
             "minLength": 6,
             "maxLength": 128
        },
         "Phone: {
             "description": "Client's contact phone number in the format 7XXXXXXXXXXXXXX,
             { "type": "string",
             "minLength": 1,
             "maxLength": 20
        },
         { "Address." {
             "description": "order delivery address",
             { "type": "string",
             "minLength": 1,
             "maxLength": 512
        },
         "CallBackURLsuccess": {
             "description": "URL to return to the site from the Mandarin questionnaire when approving a loan",
             { "type": "string",
             "minLength": 1,
             "maxLength": 512
        },
         "CallBackURLfail": {
             "description": "URL to return to the site from the Mandarin form when credit is denied",
             { "type": "string",
             "minLength": 1,
             "maxLength": 512
        },
         { "Cart": {
             "description": "Array of customer cart data",
             { "type": "array",
             { "items": {
                 { "type": "object",
                 { "properties": {
                     { "Category": {
                         "description": "Product categories by store classification",
                         { "type": "array",
                         "minItems": 1,
                         "uniqueItems": true,
                         { "items": {
                             { "description": "separate category",
                             { "type": "string",
                             "minLength": 1,
                             "maxLength": 128
                        }
                    },
                     { "ProductID": {
                         "description": "Product ID in the store",
                         { "type": "string",
                         "minLength": 1,
                         "maxLength": 128
                    },
                     { "Price": {
                         "description": "Unit cost in kopecks excluding the discount, (the price that the client sees in the cart),
                         { "type": "integer",
                         { "minimum": 1,
                         "maximum": 100000000
                    },
                     "PriceWithDiscount: {
                         "description": "Cost per unit of goods in kopecks, taking into account the store discount (by discount we mean the size of the store discount in order for the client to have an installment plan or reduced rate on the loan)."
                         { "type": "integer",
                         { "minimum": 1,
                         "maximum": 100000000
                    },
                     { "ProductName": {
                         "description": "product name",
                         { "type": "string",
                         "minLength": 1,
                         "maxLength": 128
                    },
                     { "Quantity": {
                         "description": "number of items",
                         { "type": "integer",
                         { "minimum": 1,
                         "maximum": 100
                    }
                },
                 { "required": [
                    { "Category",
                    { "ProductID",
                    { "price",
                    "PriceWithDiscount",
                    "Quantity."
                ],
                 "additionalProperties": false
            }
        },
         { "LoanTerm": {
             "description": "Loan term preset on the calculator screen. The available term range is communicated by the client manager",
             { "type": "integer",
             { "minimum": 1,
             "maximum": 240
        },
         "ClientCanChangeTerm": {
             "description": "Parameter that determines whether the client can change the term on the calculator screen independently. This term is mandatory if the LoanTerm parameter is not null",
             "type": "boolean".
        },
         "SigningByTheStore." {
             "description": "Parameter that determines whether the store will sign credit documents from the client. 1 - the store signs, 0 - Mandarin signs",
             { "type": "integer",
             { "minimum": 0,
             "maximum": 1
        },
         "PhoneFilling": {.
             "description": "Parameter, which means that you have to fill out the client questionnaire by phone through Mandarin Call Center. If the value 0 is specified, the client fills in the questionnaire himself. If value 1 is specified, a call center employee will call the client back to fill the questionnaire. If value 1 is specified, it is obligatory to pass the Phone parameter",
             { "type": "integer",
             { "minimum": 0,
             "maximum": 1
        },
         "ClientCanChangeInitialFee": {
             "description": "Parameter that determines whether the customer can change the amount of the down payment on the calculator screen independently."
             "type": "boolean".
        },
         "ListFinOrgToSendApp: {
             "description": "Array with the list of financial organizations to which the request should be sent (in case financial organizations disabled for the store are passed in the array, sending to them will not happen). If this parameter is not passed, the request is sent to all financial organizations enabled for the store",
             { "type": "array",
             "minItems": 1,
             "uniqueItems": true,
             { "items": {
                 "description": "specific financial institution code",
                 { "type": "string",
                 { "enum": [
                    "Tinkoff,
                    "Rassrochka24",
                    "PochtaBank",
                    "ExpressBank,
                    "AlfaBank,
                    "CreditEuropeBank,
                    "GoodMoney",
                    "MigCredit012",
                    { "payps",
                    "SevenSecondsPay",
                    { "Otp",
                    "SmsFinance",
                    { "Rsb",
                    "Raiffeisen"
                ]
            }
        }
    },
     { "required": [
        { "ApiKey."
        { "orderID",
        { "Amount",
        "AmountWithDiscount",
        "InitialFeeInStore",
        "DeliveryCost",
        "DeliveryCostUse",
        "CallBackURLsuccess",
        "CallBackURLfail",
        { "cart",
        "SigningByTheStore"
    ],
     "additionalProperties": false
}

Sample answer:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    { "type": "object",
    { "properties": {
        { "Result": {
            { "description": "query processing result",
            { "type": "string",
            { "enum": [
                "True."
                "False."
            ]
        },
        { "Errors": {
            "description": "Array of error data (if any)",
            { "type": "array",
            { "items": {
                { "type": "object",
                { "properties": {
                    { "ErrorCode": {
                        "description": "error code",
                        "type": "string"
                    },
                    { "ErrorDescription." {
                        { "description": "error description",
                        "type": "string"
                    }
                },
                { "required": [
                    { "ErrorCode",
                    "ErrorDescription".
                ],
                "additionalProperties": false
            }
        },
        { "application_id": {
            "description": "Mandarin-side application identifier",
            { "type": "string",
            "minLength": 36,
            "maxLength": 36
        }
    },
    { "required": [
        "Result."
    ],
    "additionalProperties": false
}

# - Query examples

# Example 1

This query contains a minimum set of required parameters.

The content of this request will be successfully failed.

In this query:

  • The store order number is 123
  • The cost of goods - 100 rubles.
  • There is no discount on the item (parameters Amount and AmountWithDiscount are equal).
  • The initial fee is paid by the customer in the store (parameter InitialFeeInStore = 1).
  • Delivery is not paid (parameter DeliveryCost = 0).
  • If approved, the client gets to the page http://123.ru (parameter CallBackURLsuccess = "http://123.ru")
  • In the case of refusal of credit, the client gets to the page http://234.ru (parameter CallBackURLfail = "http://234.ru")
  • The documents are signed by Mandarin (parameter SigningByTheStore =0). The shopping cart contains one product:
  • Phone category
  • Item "T1"
  • Price 100 rubles.
  • Quantity - 1

Request

POST https://api.7seconds.ru/api/merch/order
{
    "ApiKey": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "OrderID": "123",
    { "Amount": 10000,
    "AmountWithDiscount": 10000,
    "InitialFeeInStore": 1,
    "DeliveryCost": 0,
    "DeliveryCostUse": 1,
    "CallBackURLsuccess": "http://123.ru",
    "CallBackURLfail": "http://234.ru",
    { "cart": [
        {
            { "Category": [
                "Phone."
            ],
            "ProductID": "T1",
            "Price": 100,
            "PriceWithDiscount": 100,
            "Quantity": 1
        }
    ],
    "SigningByTheStore": 0
}

This response is returned if the request was successfully processed:

{
    { "Result": "True",
    "application_id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}

This response is returned if the request is unsuccessful:

{
     { "Result": "False",
     "application_id": "",
     "Errors": [
        {
             "ErrorCode": "CartAmount",
             "ErrorDescription": "The amount of the order items does not match the total amount"
        }
    ]
}

# Example 2

This query contains a minimum set of required parameters.

The content of this request will be successfully failed.

In this query:

  • The store order number is 123
  • The cost of goods - 150 rubles.
  • There is no discount on the item (parameters Amount and AmountWithDiscount are equal).
  • The initial fee is paid by the customer through Mandarin (parameter InitialFeeInStore = 2).
  • Delivery is not paid (parameter DeliveryCost = 0).
  • If approved, the client gets to the page http://123.ru (parameter CallBackURLsuccess = "http://123.ru")
  • In the case of refusal of the credit, the client gets to the page http://234.ru (parameter CallBackURLfail = "http://234.ru")
  • The documents are signed by Mandarin (parameter SigningByTheStore =0) Shopping cart contains two items: First product:
  • Phone category
  • Item "T1"
  • Price 100 rubles.
  • Quantity - 1 Second product:
  • Pouch category
  • Item "Ch1"
  • Price 50 rubles.
  • Quantity - 1

Request

POST https://api.7seconds.ru/api/merch/order
{
    "ApiKey": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "OrderID": "123",
    { "Amount": 15000,
    "AmountWithDiscount": 15000,
    "InitialFeeInStore": 2,
    "DeliveryCost": 0,
    "DeliveryCostUse": 1,
    "CallBackURLsuccess": "http://123.ru",
    "CallBackURLfail": "http://234.ru",
    { "cart": [
        {
            { "Category": [
                "Phone."
            ],
            "ProductID": "T1",
            "Price": 10,000,
            "PriceWithDiscount": 10000,
            "Quantity": 1
        },
        {
             { "Category": [
                "Pouch."
            ],
             "ProductID": "Ch1",
             "Price": 5000,
             "PriceWithDiscount": 5000,
             "Quantity": 1
        }
    ],
    "SigningByTheStore": 0
}

Response if the request was processed successfully (200 OK)

{
    { "Result": "True",
    "application_id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}

Response in case of unsuccessful request processing (400 Bad request)

{
     { "Result": "False",
     "application_id": "",
     "Errors": [
        {
             "ErrorCode": "CartAmount",
             "ErrorDescription": "The amount of the order items does not match the total amount"
        }
    ]
}

Response in case of sending an incorrect request format (401 Unauthorized)

{
 "errors": {
 "request": "Error serializing request"
 },
 "Errors": [
 {
 "ErrorCode": "request",
 "ErrorDescription": "Request serialization error"
 }
 ],
 "result": false,
 "Result": false
}

Response in case of sending an incorrect ApiKey (401 Unauthorized)

{
 "errors": {
 "ApiKey": "API key is incorrect"
 },
 "Errors": [
 {
 "ErrorCode": "ApiKey",
 "ErrorDescription": "API key is invalid"
 }
 ],
 "result": false,
 "Result": false
}

Example response in case of validation error (200 OK)

{
 "result": false,
 "Result": false,
 "errors": {
 "application_id": "Invalid application id"
 },
 "Errors": [
 {
 "ErrorCode": "application_id",
 "ErrorDescription": "Incorrect application id"
 }
 ]
}

# Example 3

This query contains a minimum set of required parameters.

The content of this request will be successfully failed. In this query:

  • The store order number is 123
  • The cost of goods - 150 rubles.
  • There is no discount on the item (parameters Amount and AmountWithDiscount are equal).
  • The initial fee is paid by the customer through Mandarin (parameter InitialFeeInStore = 2).
  • Delivery paid through Mandarin
  • Delivery cost 50 rubles (parameter DeliveryCost = 5000)
  • Shipping cost is included in the credit (parameter DeliveryCostUse = 2)
  • If approved, the client gets to the page http://123.ru (parameter CallBackURLsuccess = "http://123.ru")
  • In the case of refusal of the credit, the client gets to the page http://234.ru (parameter CallBackURLfail = "http://234.ru")
  • The documents are signed by Mandarin (parameter SigningByTheStore =0) Shopping cart contains two items: First product:
  • Phone category
  • Item "T1"
  • Price 100 rubles.
  • Quantity - 1 Second product:
  • Pouch category
  • Item "Ch1"
  • Price 50 rubles.
  • Quantity - 1 JSON query text:
{
     "ApiKey": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
     "OrderID": 123,
     { "Amount": 15000,
     "AmountWithDiscount": 15000,
     "InitialFeeInStore": 2,
     "DeliveryCost": 5000,
     "DeliveryCostUse": 2,
     "CallBackURLsuccess": "http://123.ru",
     "CallBackURLfail": "http://234.ru",
     { "cart": [
        {
             { "Category": [
                "Phone."
            ],
             "ProductID": "T1",
             "Price": 10000,
             "PriceWithDiscount": 10000,
             "Quantity": 1
        },
        {
             { "Category": [
                "Pouch."
            ],
             "ProductID": "Ch1",
             "Price": 5000,
             "PriceWithDiscount": 5000,
             "Quantity": 1
        }
    ],
     "SigningByTheStore": 0
}

Response if the request was processed successfully (200 OK)

{
    { "Result": "True",
    "application_id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}

Response in case of unsuccessful request processing (400 Bad request)

{
     { "Result": "False",
     "application_id": "",
     "Errors": [
        {
             "ErrorCode": "CartAmount",
             "ErrorDescription": "The amount of the order items does not match the total amount"
        }
    ]
}

Response in case of sending an incorrect request format (401 Unauthorized)

{
 "errors": {
 "request": "Error serializing request"
 },
 "Errors": [
 {
 "ErrorCode": "request",
 "ErrorDescription": "Request serialization error"
 }
 ],
 "result": false,
 "Result": false
}

Response in case of sending an incorrect ApiKey (401 Unauthorized)

{
 "errors": {
 "ApiKey": "API key is incorrect"
 },
 "Errors": [
 {
 "ErrorCode": "ApiKey",
 "ErrorDescription": "API key is invalid"
 }
 ],
 "result": false,
 "Result": false
}

Example response in case of validation error (200 OK)

{
 "result": false,
 "Result": false,
 "errors": {
 "application_id": "Invalid application id"
 },
 "Errors": [
 {
 "ErrorCode": "application_id",
 "ErrorDescription": "Incorrect application id"
 }
 ]
}

# Example 4

This query contains a minimum set of required parameters.

The content of this request will be successfully failed.

In this query:

  • The store order number is 123
  • The cost of goods - 150 rubles.
  • The cost of goods with the discount is 130 rubles.
  • The item is discounted (Amount and AmountWithDiscount parameters are not equal). The discount applies to both items.
  • The initial fee is paid by the customer through Mandarin (parameter "InitialFeeInStore" = 2).
  • Delivery paid through Mandarin
  • Delivery cost 50 rubles (parameter "DeliveryCost" = 5000)
  • Delivery cost is included in the credit (parameter "DeliveryCostUse"=2)
  • If approved, the client gets to the page http://123.ru (parameter "CallBackURLsuccess" = "http://123.ru")
  • In the case of refusal of credit, the client gets to the page http://234.ru (parameter "CallBackURLfail" = "http://234.ru")
  • Signing documents is done by Mandarin (parameter "SigningByTheStore" =0). Shopping cart contains two items:

First product:

  • Phone category
  • Item "T1"
  • Price - 100 rubles.
  • Price with discounts - 90 rubles.
  • Quantity - 1

Second product:

  • Pouch category
  • Item "Ch1"
  • Price 50 rubles.
  • Price with discounts - 40 rubles.
  • Quantity - 1

Request

POST https://api.7seconds.ru/api/merch/order
{
     "ApiKey": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
     "OrderID": 123,
     { "Amount": 15000,
     "AmountWithDiscount": 13000,
     "InitialFeeInStore": 2,
     "DeliveryCost": 5000,
     "DeliveryCostUse": 2,
     "CallBackURLsuccess": "http://123.ru",
     "CallBackURLfail": "http://234.ru",
     { "cart": [
        {
             { "Category": [
                "Phone."
            ],
             "ProductID": "T1",
             "Price": 10,000,
             "PriceWithDiscount": 9000,
             "Quantity": 1
        },
        {
             { "Category": [
                "Pouch."
            ],
             "ProductID": "Ch1",
             "Price": 5000,
             "PriceWithDiscount": 4000,
             "Quantity": 1
        }
    ],
     "SigningByTheStore": 0
}

Response if the request was processed successfully (200 OK)

{
    { "Result": "True",
    "application_id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}

Response in case of unsuccessful request processing (400 Bad request)

{
     { "Result": "False",
     "application_id": "",
     "Errors": [
        {
             "ErrorCode": "CartAmount",
             "ErrorDescription": "The amount of the order items does not match the total amount"
        }
    ]
}

Response in case of sending an incorrect request format (401 Unauthorized)

{
 "errors": {
 "request": "Error serializing request"
 },
 "Errors": [
 {
 "ErrorCode": "request",
 "ErrorDescription": "Request serialization error"
 }
 ],
 "result": false,
 "Result": false
}

Response in case of sending an incorrect ApiKey (401 Unauthorized)

{
 "errors": {
 "ApiKey": "API key is incorrect"
 },
 "Errors": [
 {
 "ErrorCode": "ApiKey",
 "ErrorDescription": "API key is invalid"
 }
 ],
 "result": false,
 "Result": false
}

Example response in case of validation error (200 OK)

{
 "result": false,
 "Result": false,
 "errors": {
 "application_id": "Invalid application id"
 },
 "Errors": [
 {
 "ErrorCode": "application_id",
 "ErrorDescription": "Incorrect application id"
 }
 ]
}

# Example 5

This query contains a minimum set of required parameters. The content of this request will be successfully failed. In this query:

  • The store order number is 123
  • The cost of goods - 150 rubles.
  • The cost of goods with the discount is 130 rubles.
  • The item discount is given (Amount and AmountWithDiscount parameters are not equal). The discount applies to one item.
  • The initial fee is paid by the customer through Mandarin (parameter "InitialFeeInStore" = 2).
  • Delivery paid through Mandarin
  • Delivery cost 50 rubles (parameter "DeliveryCost" = 5000)
  • Delivery cost is included in the credit (parameter "DeliveryCostUse"=2)
  • If approved, the client gets to the page http://123.ru (parameter "CallBackURLsuccess" = "http://123.ru")
  • In the case of refusal of credit, the client gets to the page http://234.ru (parameter "CallBackURLfail" = "http://234.ru")
  • Signing documents is done by Mandarin (parameter "SigningByTheStore" =0). Shopping cart contains two items:

First product:

  • Phone category
  • Item "T1"
  • Price - 100 rubles.
  • Price including discount - 80 rubles.
  • Quantity - 1 Second product:
  • Pouch category
  • Item "Ch1"
  • Price 50 rubles.
  • Price including discount - 50 rubles.
  • Quantity - 1

Request

POST https://api.7seconds.ru/api/merch/order
{
     "ApiKey": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
     "OrderID": 123,
     { "Amount": 15000,
     "AmountWithDiscount": 13000,
     "InitialFeeInStore": 2,
     "DeliveryCost": 5000,
     "DeliveryCostUse": 2,
     "CallBackURLsuccess": "http://123.ru",
     "CallBackURLfail": "http://234.ru",
     { "cart": [
        {
             { "Category": [
                "Phone."
            ],
             "ProductID": "T1",
             "Price": 10,000,
             "PriceWithDiscount": 8000,
             "Quantity": 1
        },
        {
             { "Category": [
                "Pouch."
            ],
             "ProductID": "Ch1",
             "Price": 5000,
             "PriceWithDiscount": 5000,
             "Quantity": 1
        }
    ],
     "SigningByTheStore": 0
}

Response if the request was processed successfully (200 OK)

{
    { "Result": "True",
    "application_id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
}

Response in case of unsuccessful request processing (400 Bad request)

{
     { "Result": "False",
     "application_id": "",
     "Errors": [
        {
             "ErrorCode": "CartAmount",
             "ErrorDescription": "The amount of the order items does not match the total amount"
        }
    ]
}

Response in case of sending an incorrect request format (401 Unauthorized)

{
 "errors": {
 "request": "Error serializing request"
 },
 "Errors": [
 {
 "ErrorCode": "request",
 "ErrorDescription": "Request serialization error"
 }
 ],
 "result": false,
 "Result": false
}

Response in case of sending an incorrect ApiKey (401 Unauthorized)

{
 "errors": {
 "ApiKey": "API key is incorrect"
 },
 "Errors": [
 {
 "ErrorCode": "ApiKey",
 "ErrorDescription": "API key is invalid"
 }
 ],
 "result": false,
 "Result": false
}

Example response in case of validation error (200 OK)

{
 "result": false,
 "Result": false,
 "errors": {
 "application_id": "Invalid application id"
 },
 "Errors": [
 {
 "ErrorCode": "application_id",
 "ErrorDescription": "Incorrect application id"
 }
 ]
}

# Transmission of shipment information to Mandarin

Method is used after the online store has shipped goods/services to the customer. This information must be forwarded to Mandarin. If there is a partial rejection on an order, the store must transmit the status in accordance with the section "Sending information by the store about the return/rejection of the customer from the product/service" before transmitting the status of the shipment. Simple request:

POST https://api.7seconds.ru/api/merch/shipmentstatus
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Comment describing your JSON Schema",
    { "type": "object",
    { "properties": {
        { "ApiKey." {
            "description": "Password obtained when registering with Mandarin, the passwords for the test and product loops are different."
            { "type": "string",
            "minLength": 32,
            "maxLength": 32
        },
        "OrderID": {
            "description": "store order number",
            { "type": "string",
            "minLength": 1,
            "maxLength": 16
        },
        "ApplicationID": {
            "description": "Mandarin Application ID",
            "type": "string"
        }
    },
    { "required": [
        { "ApiKey."
        { "orderID",
        "ApplicationID"
    ],
    "additionalProperties": false
}

Sample answer:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    { "type": "object",
    { "properties": {
        { "Result": {
            { "description": "query processing result",
            { "type": "string",
            { "enum": [
                "True."
                "False."
            ]
        },
        { "Errors": {
            "description": "Array of error data (if any)",
            { "type": "array",
            { "items": {
                { "type": "object",
                { "properties": {
                    { "ErrorCode": {
                        "description": "error code",
                        "type": "string"
                    },
                    { "ErrorDescription." {
                        { "description": "error description",
                        "type": "string"
                    }
                },
                { "required": [
                    { "ErrorCode",
                    "ErrorDescription".
                ],
                "additionalProperties": false
            }
        }
    },
    { "required": [
        "Result."
    ],
    "additionalProperties": false
}

Possible values of the Result parameter:

  • True - the request is accepted successfully
  • False - the request is unsuccessful.

# - Example queries

The content of this request will be successfully failed. In this query:

  • The number of the order in the store, for which the shipment of goods took place - 123456
  • Mandarin application number - `8c24bd01-dddf-4123-a52d-b8c1010b1908

Request

POST https://api.7seconds.ru/api/merch/shipmentstatus
{
 "ApiKey": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
 "OrderID": "123456",
 "ApplicationID": "8c24bd01-dddf-4123-a52d-b8c1010b1908"
}

Response if the request was processed successfully (200 OK)

{
 { "Result": "True",
}

Response in case of unsuccessful request processing (400 Bad request)

{
    { "Result": "False",
    "Errors": [
        {
            "ErrorCode": "AppID",
            "ErrorDescription": "Application with the passed ApplicationID was not found"
        }
    ]
}

Response in case of sending an incorrect request format (401 Unauthorized)

{
 "errors": {
 "request": "Error serializing request"
 },
 "Errors": [
 {
 "ErrorCode": "request",
 "ErrorDescription": "Request serialization error"
 }
 ],
 "result": false,
 "Result": false
}

Response in case of sending an incorrect ApiKey (401 Unauthorized)

{
 "errors": {
 "ApiKey": "API key is incorrect"
 },
 "Errors": [
 {
 "ErrorCode": "ApiKey",
 "ErrorDescription": "API key is invalid"
 }
 ],
 "result": false,
 "Result": false
}

Example response in case of validation error (200 OK)

{
 "result": false,
 "Result": false,
 "errors": {
 "application_id": "Invalid application id"
 },
 "Errors": [
 {
 "ErrorCode": "application_id",
 "ErrorDescription": "Incorrect application id"
 }
 ]
}

# Request request status

Method is used to request the current status of the request. Simple request:

POST https://api.7seconds.ru/api/merch/getapplicationstatus
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Comment describing your JSON Schema",
    { "type": "object",
    { "properties": {
        { "ApiKey." {
            "description": "Password obtained when registering with Mandarin, the passwords for the test and product loops are different."
            { "type": "string",
            "minLength": 32,
            "maxLength": 32
        },
        { "application_id": {
            "description": "Mandarin-side application identifier",
            { "type": "string",
            "minLength": 36,
            "maxLength": 36
        }
    },
    "additionalProperties": false
}

Sample answer:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Comment describing your JSON Schema",
    { "type": "object",
    { "properties": {
        { "ApiKey." {
            "description": "Password obtained when registering with Mandarin, the passwords for the test and product loops are different."
            { "type": "string",
            "minLength": 32,
            "maxLength": 32
        },
        "ApplicationID": {
            "description": "Mandarin-side application identifier",
            { "type": "string",
            "minLength": 36,
            "maxLength": 36
        },
        { "ApplicationDate": {
            "description": "The date and time the request was received from the store in the format "yyyyy-mm-dd hh:mm:ss zzz"",
            { "type": "string",
            { "format": "date-time".
        },
        { "status": {
            { "description": "application status",
            "type": "string"
        },
        "StatusID": {
            "description": "request status code",
            "type": "string"
        },
        "OrderID": {
            "description": "store order number",
            { "type": "string",
            "minLength": 1,
            "maxLength": 16
        },
        "FirstName": {
            { "description": "client name",
            { "type": "string",
            "minLength": 1,
            "maxLength": 128
        },
        "LastName": {
            "description": "client name",
            { "type": "string",
            "minLength": 1,
            "maxLength": 128
        },
        { "MiddleName": {
            { "description": "client patronymic",
            { "type": "string",
            "minLength": 1,
            "maxLength": 128
        },
        "Phone: {
            "description": "Client's contact phone number in the format 7XXXXXXXXXXXXXX,
            { "type": "string",
            "minLength": 1,
            "maxLength": 20
        },
        { "Email." {
            { "description": "client email",
            { "type": "string",
            "minLength": 6,
            "maxLength": 128
        },
        { "Amount": {
            "description": "Amount of the order in kopecks excluding the store discount (the price that the client sees in the cart)",
            { "type": "integer",
            { "minimum": 1,
            "maximum": 100000000
        },
        "AmountWithDiscount: {
            "description": "The amount of the order in kopecks, taking into account the store discount (by discount we mean the size of the store discount in order for the client to have an installment plan or a reduced rate on the loan). This amount will be in the credit agreement",
            { "type": "integer",
            { "minimum": 1,
            "maximum": 100000000
        },
        { "InitialFee": {
            "description": "The amount of the down payment in kopecks (This value will be preset on the loan calculator)",
            { "type": "integer",
            { "minimum": 0,
            "maximum": 100000000
        },
        "InitialFeeInStore: {
            "description": "Parameter that determines where the down payment will be made. If the value 1 is specified, the customer must pay the down payment in the store, if 2, then the down payment is made through Mandarin by card, if 3, then the down payment is not provided, the SP field on the calculator will be hidden",
            { "type": "number",
            { "minimum": 1,
            "maximum": 3
        },
        { "CreditDate": {
            "description": "Date and time of loan disbursement (the moment the disbursement status is transferred from Mandarin to the financial institution) in the format "yyyyy-mm-dd hh:mm:ss zzz"",
            { "type": "string",
            { "format": "date-time".
        },
        { "CreditSumm": {
            { "description": "Amount of the actual payment on the merchant's account (in kopecks)",
            { "type": "integer",
            { "minimum": 1,
            "maximum": 100000000
        },
        "FinOrg": {
            "description": "Name of the financial institution that approved the loan",
            { "type": "string",
            "minLength": 1,
            "maxLength": 1000
        },
        { "RejectDate": {
            "description": "Date and time of the refund transfer from Mandarin to the financial institution in the format "yyyyy-mm-dd hh:mm:ss zzz"",
            { "type": "string",
            { "format": "date-time".
        },
        "RejectOrderID": {
            "description": "store return number",
            { "type": "string",
            "minLength": 1,
            "maxLength": 16
        },
        "RejectPrincipal." {
            { "description": "The amount of principal transferred from Mandarin to the financial institution as part of the repayment in pennies",
            { "type": "integer",
            { "minimum": 1,
            "maximum": 100000000
        },
        { "RejectInterest": {
            { "description": "The amount of interest transferred from Mandarin to the financial institution as part of the refund in pennies is indicated only if the store compensates the interest for the customer."
            { "type": "integer",
            { "minimum": 1,
            "maximum": 100000000
        },
        { "RejectInitialFee": {
            { "description": "The amount of the down payment transferred from Mandarin to the borrower as part of the repayment in pennies."
            { "type": "integer",
            { "minimum": 1,
            "maximum": 100000000
        },
        "CardNumber": {
            "description": "The mask of the card from which the down payment is made in the format 123456XXXXXXXX7890",
            { "type": "string",
            "minLength": 16,
            "maxLength": 16
        }
    },
    { "required": [
        { "ApiKey."
        { "ApplicationID",
        "ApplicationDate",
        { "status",
        { "statusID",
        { "orderID",
        { "Amount",
        "AmountWithDiscount",
        "InitialFeeInStore"
    ],
    "additionalProperties": false
}

# Transmission to Mandarin of rejected/returned data

This method is used if the customer has applied to the store with the purpose of returning the goods. Simple request:

POST https://api.7seconds.ru/api/merch/Applicationreject
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Comment describing your JSON Schema",
    { "type": "object",
    { "properties": {
        { "ApiKey." {
            "description": "Password obtained when registering with Mandarin, the passwords for the test and product loops are different."
            { "type": "string",
            "minLength": 32,
            "maxLength": 32
        },
        "OrderID": {
            "description": "store order number",
            { "type": "string",
            "minLength": 1,
            "maxLength": 16
        },
        "ApplicationID": {
            "description": "Mandarin Application ID",
            "type": "string"
        },
        { "ApplicationDate": {
            "description": "The date and time the request was received from the store in the format "yyyyy-mm-dd hh:mm:ss zzz"",
            { "type": "string",
            { "format": "date-time".
        },
        "RejectOrderID": {
            "description": "store return number",
            "type": "string"
        },
        { "MoneySource": {
            { "description": "Source of funds transfer to the store. Passes 1 if the source of funds is Mandarin. Passes 2 if the source of funds is Financial Institution",
            { "type": "number",
            { "minimum": 1,
            "maximum": 2
        },
        { "PercentCompensation": {
            "description": "The parameter that determines whether the store repays the interest on the loan for the client. Passes 1 if it does, and 2 if it doesn't",
            { "type": "number",
            { "minimum": 1,
            "maximum": 2
        },
        "ShipmentType": {
            "description": "Parameter that determines whether the product was shipped to the customer or not. Passes 1 if there was a shipment, and 2 if there was no shipment,
            { "type": "number",
            { "minimum": 1,
            "maximum": 2
        },
        { "InitialFee": {
            "description": "The amount of the down payment in kopecks (This value will be preset on the loan calculator)",
            { "type": "integer",
            { "minimum": 0,
            "maximum": 100000000
        },
        { "CreditSumm": {
            { "description": "Amount of the actual payment on the merchant's account (in kopecks)",
            { "type": "integer",
            { "minimum": 1,
            "maximum": 100000000
        },
        "CompensationSumm: {
            "description": "Amount transferred by the store to Mandarin when returning goods",
            { "type": "integer",
            { "minimum": 0,
            "maximum": 100000000
        },
        "InitialFeeInStore: {
            "description": "Parameter that determines where the down payment was made. If the value is 1, then the customer must pay the down payment in the store, if 2, then the down payment is made through Mandarin, if 3, there was no down payment",
            "type": "number"
        },
        { "RejectType": {
            "description": "Type of return, if 1 is specified, then a full return, if 2, then a partial return."
            { "type": "integer",
            { "minimum": 1,
            "maximum": 2
        },
        { "RejectCart": {
            "description": "Array of data about the goods that make up the return/rejection",
            { "type": "array",
            { "items": {
                { "type": "object",
                { "properties": {
                    { "Category": {
                        "description": "Product categories by store classification",
                        { "type": "array",
                        "minItems": 1,
                        "uniqueItems": true,
                        { "items": {
                            { "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                        }
                    },
                    { "ProductID": {
                        "description": "Product ID in the store",
                        { "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                    },
                    { "Price": {
                        "description": "Unit cost in kopecks excluding discount, (the price that the client sees in the cart)",
                        { "type": "integer",
                        { "minimum": 1,
                        "maximum": 100000000
                    },
                    "PriceWithDiscount: {
                        "description": "Unit cost in kopecks, taking into account the store discount (the discount means the size of the store discount in order for the client to have an installment plan or reduced rate on the loan),
                        { "type": "integer",
                        { "minimum": 1,
                        "maximum": 100000000
                    },
                    { "ProductName": {
                        "description": "product name",
                        { "type": "string",
                        "minLength": 1,
                        "maxLength": 128
                    },
                    { "Quantity": {
                        "description": "number of items",
                        { "type": "integer",
                        { "minimum": 1,
                        "maximum": 100
                    }
                },
                { "required": [
                    { "Category",
                    { "ProductID",
                    { "price",
                    "PriceWithDiscount",
                    "Quantity."
                ],
                "additionalProperties": false
            }
        }
    },
    { "required": [
        { "ApiKey."
        { "orderID",
        { "ApplicationID",
        "RejectOrderID",
        "MoneySource",
        "PercentCompensation",
        "ShipmentType",
        { "InitialFee",
        "CreditSumm",
        "CompensationSumm",
        "InitialFeeInStore",
        { "RejectType",
        "RejectCart."
    ],
    "additionalProperties": false
}

PercentCompensation" parameter is mandatory if the value of ShipmentType = 1 The compulsivity of the CompensationSumm parameter is defined according to the table:

Value of parameter ShipmentType Value of parameter MoneySource Value of parameter PercentCompensation Binding parameter CompensationSumm
1 1 1 true
2 1 1 false
1 2 1 true
2 2 1
1 1 2
2 1 2
1 2 2
2 2 2

Sample answer:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    { "type": "object",
    { "properties": {
        { "Result": {
            { "description": "query processing result",
            { "type": "string",
            { "enum": [
                "True."
                "False."
            ]
        },
        { "Errors": {
            "description": "Array of error data (if any)",
            { "type": "array",
            { "items": {
                { "type": "object",
                { "properties": {
                    { "ErrorCode": {
                        "description": "error code",
                        "type": "string"
                    },
                    { "ErrorDescription." {
                        { "description": "error description",
                        "type": "string"
                    }
                },
                { "required": [
                    { "ErrorCode",
                    "ErrorDescription".
                ],
                "additionalProperties": false
            }
        }
    },
    { "required": [
        "Result."
    ],
    "additionalProperties": false
}

Possible values for the Result parameter:

  • True - the request is accepted successfully
  • False - the request is unsuccessful.

# Pre-approval method

# Requesting the client's indebtedness status in Mandarin

This method provides an opportunity to find out the client's current debt to financial institutions.

Important! This option is not available for all financial institutions.

It available only for stores that have received approval from Mandarin through the Client Manager or Project Manager (in case of a joint integration project).

Simple request:

POST https://api.7seconds.ru/api/merch/ClientDebtStatus
{
    "ApiKey ": {
        "description": "Password obtained when registering with Mandarin, the passwords for the test and product loops are different."
        { "type": "String",
        { "Lenght": 32,
        { "required": true
    },
    "OrderID": {
        "description": "store order number",
        { "type": "String",
        "minLenght": 1,
        "maxLenght": 16,
        { "required": true
    },
    "ApplicationID": {
        "description": "Mandarin Application ID",
        "type": "GUID",
        { "required": true
    }
}

Sample answer:

{
    "ApplicationID": {
        "description": "Mandarin Application ID",
        "type": "GUID"
    },
    { "DebtStatus": {
        { "description": "Indebtedness status, 0 - credit was not issued, 1 - credit is active, 2 - credit was repaid",
        { "type": "integer",
        { "minimum": 0,
        "maximal": 2
    },
    { "BasicDebt": {
        { "description": "Principal debt balance in kopecks",
        { "type": "integer",
        { "minimum": 0,
        { "maximal": 1000000000
    },
    { "interest": {
        { "description": "Balance of interest on the principal debt",
        { "type": "integer",
        { "minimum": 0,
        { "maximal": 1000000000
    },
    "StatusDate": {
        "description": "Date on which the information about the debt is current "yyyyy-mm-dd"",
        { "type": "String",
        "minLenght": 1,
        "maxLenght": 1000
    },
    "FinOrg": {
        "description": "name of financial institution",
        { "type": "String",
        "minLenght": 1,
        "maxLenght": 100
    },
    { "AgreementNumber." {
        "description": "Loan Agreement/Loan Agreement Number",
        { "type": "String",
        "minLenght": 1,
        "maxLenght": 100
    }
}

# Pre-approval method

This method is used to request a customer form ID for pre-approval of a loan. This method will return PrescoreAppID in response to the request, which should be used to call the Mandarin questionnaire by the following link: /home/prescore?prescoreid=received when requesting PrescoreAppID At the end of processing the request, depending on its result goes to the store page specified in the parametersCallBackURLsuccessorCallBackURLfail` Simple request:

POST https://api.7seconds.ru/api/merch/prescore/
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Comment describing your JSON Schema",
    { "type": "object",
    { "properties": {
        { "ApiKey." {
            "description": "Password obtained when registering with Mandarin, the passwords for the test and product loops are different."
            { "type": "string",
            "minLength": 32,
            "maxLength": 32
        },
        "CallBackURLsuccess": {
            "description": "URL to return to the site from the Mandarin widget when the limit is approved,
            { "type": "string",
            "minLength": 1,
            "maxLength": 512
        },
        "CallBackURLfail": {
            "description": "URL to return to the site from the Mandarin widget when the limit is denied",
            { "type": "string",
            "minLength": 1,
            "maxLength": 512
        },
    { "required": [
        { "ApiKey."
        "CallBackURLsuccess",
        "CallBackURLfail",

    ],
    "additionalProperties": false
}

Sample answer:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    { "type": "object",
    { "properties": {
        { "Result": {
            { "description": "query processing result",
            { "type": "string",
            { "enum": [
                "True."
                "False."
            ]
        },
        { "Errors": {
            "description": "Array of error data (if any)",
            { "type": "array",
            { "items": {
                { "type": "object",
                { "properties": {
                    { "ErrorCode": {
                        "description": "error code",
                        "type": "string"
                    },
                    { "ErrorDescription." {
                        { "description": "error description",
                        "type": "string"
                    }
                },
                { "required": [
                    { "ErrorCode",
                    "ErrorDescription".
                ],
                "additionalProperties": false
            }
        },
        "PrescoreAppID": {
            "description": "Mandarin-side pre-approval application identifier",
            { "type": "string",
            "minLength": 36,
            "maxLength": 36
        }
    },
    { "required": [
        { "Result",
        "application_id"
    ],
    "additionalProperties": false
}

# Methods for working with credit documents via API (document signing)

# Method for obtaining a list of documents to sign

This method is used to get the store a list of documents that need to be signed by the client to obtain a loan from the financial institution of his choice. This method can only be accessed by applications that have a status of LoanOpened. Simple request:

POST https://api.7seconds.ru/api/merch/getdocumentslist
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Comment describing your JSON Schema",
    { "type": "object",
    { "properties": {
        { "ApiKey." {
            "description": "Password obtained when registering with Mandarin, the passwords for the test and product loops are different."
            { "type": "string",
            "minLength": 32,
            "maxLength": 32
        },
        { "application_id": {
            "description": "Mandarin-side application identifier",
            { "type": "string",
            "minLength": 36,
            "maxLength": 36
        }
    },
    { "required": [
        { "ApiKey."
        "application_id"
    ],
    "additionalProperties": false
}

Sample answer:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Comment describing your JSON Schema",
    { "type": "object",
    { "properties": {
        "ResultData: {
            { "type": "object",
            { "properties": {
                { "DownloadDocs": {
                    { "type": "array",
                    { "items": {
                        { "type": "object",
                        "minProperties": 1,
                        { "properties": {
                            "DownloadDocumentId": {
                                "description": "Document ID for download",
                                { "type": "string",
                                "minLength": 36,
                                "maxLength": 36
                            },
                            { "DocumentName": {
                                "description": "name of the document to be downloaded",
                                "type": "string"
                            }
                        },
                        { "required": [
                            "DownloadDocumentId",
                            "DocumentName"
                        ],
                        "additionalProperties": false
                    }
                },
                { "UploadDocs": {
                    { "type": "array",
                    { "items": {
                        { "type": "object",
                        "minProperties": 1,
                        { "properties": {
                            { "UploadDocumentId": {
                                "description": "Document ID to download",
                                "type": "string"
                            },
                            { "DocumentName": {
                                "description": "Name of the document to be downloaded",
                                "type": "string"
                            },
                            { "MultiPage": {
                                "description": "Parameter that specifies whether the document loaded from the store can have multiple pages (True) or not (False).",
                                "type": "boolean".
                            }
                        },
                        { "required": [
                            "UploadDocumentId",
                            { "DocumentName",
                            "MultiPage."
                        ],
                        "additionalProperties": false
                    }
                }
            },
            { "required": [
                { "DownloadDocs",
                "UploadDocs."
            ],
            "additionalProperties": false
        },
        { "Result": {
            { "description": "query processing result",
            { "type": "string",
            { "enum": [
                "True."
                "False."
            ]
        },
        { "Errors": {
            "description": "Array of error data (if any)",
            { "type": "array",
            { "items": {
                { "type": "object",
                { "properties": {
                    { "ErrorCode": {
                        "description": "error code",
                        "type": "string"
                    },
                    { "ErrorDescription." {
                        { "description": "error description",
                        "type": "string"
                    }
                },
                { "required": [
                    { "ErrorCode",
                    "ErrorDescription".
                ],
                "additionalProperties": false
            }
        }
    },
    { "required": [
        "Result."
    ],
    "additionalProperties": false
}

# Method for getting document files to sign

This method is used to obtain files of credit documents to be signed by the client. This method can be used only for applications with "WaitSignDocs" status Simple request:

POST https://api.7seconds.ru/api/merch/downloaddocument
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Comment describing your JSON Schema",
    { "type": "object",
    { "properties": {
        { "ApiKey." {
            "description": "Password obtained when registering with Mandarin, the passwords for the test and product loops are different."
            { "type": "string",
            "minLength": 32,
            "maxLength": 32
        },
        { "application_id": {
            "description": "Mandarin-side application identifier",
            { "type": "string",
            "minLength": 36,
            "maxLength": 36
        },
        "DownloadDocumentId": {
            "description": "Document ID for download",
            { "type": "string",
            "minLength": 36,
            "maxLength": 36
        }
    },
    { "required": [
        { "ApiKey."
        { "application_id",
        "DownloadDocumentId"
    ],
    "additionalProperties": false
}

In response, the document file is transmitted for signature.

# Method for downloading scans of signed documents

This method is used to send scans of signed credit documents to HappyLend. This method can only be accessed by applications that meet one of the following conditions:

  • There is a status of WaitSignDocs and no status of SentToVerification
  • There is a status of VerificationFailed and no status of VerificationPassed. In the case of loading multiple pages for a single-page document (the MultiPage:true parameter is set for the document within the Method for getting the list of documents to sign, an error is returned. Simple request:
POST https://api.7seconds.ru/api/merch/uploadsigneddocument
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    { "description": "Comment describing your JSON Schema",
    { "type": "object",
    { "properties": {
        { "ApiKey." {
            "description": "Password obtained when registering with Mandarin, the passwords for the test and product loops are different."
            { "type": "string",
            "minLength": 32,
            "maxLength": 32
        },
        { "application_id": {
            "description": "Mandarin-side application identifier",
            { "type": "string",
            "minLength": 36,
            "maxLength": 36
        },
        { "UploadDocument": {
            { "description": "downloadable document",
            { "type": "object",
            { "properties": {
                { "UploadDocumentId": {
                    "description": "Document ID to download",
                    "type": "string"
                },
                { "DocumentPages": {
                    "description": "document page array",
                    { "type": "array",
                    { "items": {
                        { "type": "object",
                        "minProperties": 1,
                        { "properties": {
                            { "PageNumber." {
                                "description": "order page of the document",
                                "type": "integer"
                            },
                            { "DocumentTypeExtention": {
                                "description": "file extension",
                                "type": "string"
                            },
                            { "data": {
                                "description": "Document content in base64binary format",
                                "type": "string"
                            }
                        },
                        { "required": [
                            "PageNumber",
                            "DocumentTypeExtention",
                            "Data."
                        ],
                        "additionalProperties": false
                    }
                }
            },
            { "required": [
                "UploadDocumentId",
                "DocumentPages"
            ],
            "additionalProperties": false
        }
    },
    { "required": [
        { "ApiKey."
        { "application_id",
        "UploadDocument."
    ],
    "additionalProperties": false
}

Sample answer:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    { "type": "object",
    { "properties": {
        { "Result": {
            { "description": "query processing result",
            { "type": "string",
            { "enum": [
                "True."
                "False."
            ]
        },
        { "Errors": {
            "description": "Array of error data (if any)",
            { "type": "array",
            { "items": {
                { "type": "object",
                { "properties": {
                    { "ErrorCode": {
                        "description": "error code",
                        "type": "string"
                    },
                    { "ErrorDescription." {
                        { "description": "error description",
                        "type": "string"
                    }
                },
                { "required": [
                    { "ErrorCode",
                    "ErrorDescription".
                ],
                "additionalProperties": false
            }
        }
    },
    { "required": [
        "Result."
    ],
    "additionalProperties": false
}

# Method for running document verification

This method is used to start on HappyLend side the process of client's signed credit documents verification. This method can be used only for applications with WaitSignDocs status and without VerificationPassed status If this method is called when not all documents are attached to the request, an error is returned. Sample request

POST https://api.7seconds.ru/api/merch/verifydocuments
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Comment describing your JSON Schema",
    { "type": "object",
    { "properties": {
        { "ApiKey." {
            "description": "Password obtained when registering with Mandarin, the passwords for the test and product loops are different."
            { "type": "string",
            "minLength": 32,
            "maxLength": 32
        },
        { "application_id": {
            "description": "Mandarin-side application identifier",
            { "type": "string",
            "minLength": 36,
            "maxLength": 36
        }
    },
    { "required": [
        { "ApiKey."
        "application_id"
    ],
    "additionalProperties": false
}

Sample answer

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    { "type": "object",
    { "properties": {
        { "Result": {
            { "description": "query processing result",
            { "type": "string",
            { "enum": [
                "True."
                "False."
            ]
        },
        { "Errors": {
            "description": "Array of error data (if any)",
            { "type": "array",
            { "items": {
                { "type": "object",
                { "properties": {
                    { "ErrorCode": {
                        "description": "error code",
                        "type": "string"
                    },
                    { "ErrorDescription." {
                        { "description": "error description",
                        "type": "string"
                    }
                },
                { "required": [
                    { "ErrorCode",
                    "ErrorDescription".
                ],
                "additionalProperties": false
            }
        }
    },
    { "required": [
        "Result."
    ],
    "additionalProperties": false
}

# Method for obtaining comments on document verification

This method is used to get comments on the verification of credit documents signed by the client in case the verification was unsuccessful. Only applications with VerificationFailed status and without VerificationPassed status can access this method. Sample request

POST https://api.7seconds.ru/api/merch/getverificationcomments
{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Comment describing your JSON Schema",
    { "type": "object",
    { "properties": {
        { "ApiKey." {
            "description": "Password obtained when registering with Mandarin, the passwords for the test and product loops are different."
            { "type": "string",
            "minLength": 32,
            "maxLength": 32
        },
        { "application_id": {
            "description": "Mandarin-side application identifier",
            { "type": "string",
            "minLength": 36,
            "maxLength": 36
        }
    },
    { "required": [
        { "ApiKey."
        "application_id"
    ],
    "additionalProperties": false
}

Sample answer

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Comment describing your JSON Schema",
    { "type": "object",
    { "properties": {
        "ResultData: {
            { "type": "object",
            { "properties": {
                "VerificationFailComment." {
                    { "description": "Comments with reasons for refusing to verify documents",
                    "type": "string"
                }
            },
            "additionalProperties": false
        },
        { "Result": {
            { "description": "query processing result",
            { "type": "string",
            { "enum": [
                "True."
                "False."
            ]
        },
        { "Errors": {
            "description": "Array of error data (if any)",
            { "type": "array",
            { "items": {
                { "type": "object",
                { "properties": {
                    { "ErrorCode": {
                        "description": "error code",
                        "type": "string"
                    },
                    { "ErrorDescription." {
                        { "description": "error description",
                        "type": "string"
                    }
                },
                { "required": [
                    { "ErrorCode",
                    "ErrorDescription".
                ],
                "additionalProperties": false
            }
        }
    },
    { "required": [
        "Result."
    ],
    "additionalProperties": false
}

# Working with CallBack notifications

# Introduction

  • Sending method: POST
  • Format: application/jsonCallBackis a notification to the store about the status of processing credit. This method is used in the case of "deep" integration, when there is an integration of backoffice systems of the store with the Mandarin system. To useCallBack, the store must implement a service on its side to receiveCallBack` and pass a URL to Mandarin to which POST requests with statuses will be sent. An example of the implementation code is given at the end of the section. The format of the transmitted JSON is described below

# Security

CallBack contains an HTTP header Content-HMAC, which contains the check value of the request calculated using the HMAC algorithm. If you need to verify the authenticity and integrity of notifications, you can calculate the verification value on your side and compare it with what came in the request. A match confirms that the notification was sent from Mandarin and came to you in its original form. When implementing message verification, pay attention to the following points:

  1. The message is the body of the request
  2. the hash is calculated by the SHA-1 function
  3. The ApiKey obtained from Mandarin is used as the key (when testing - from the test loop, when working on the product loop - from the product loop).
  4. The calculated value is transferred in base64 encoding.

# Request format

Important! Parameters of the `Passport` object are transferred by separate agreement with Mandarin.

Simple request:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    { "type": "object",
    { "properties": {
        "ApplicationID": {
            "description": "Mandarin-side application identifier",
            { "type": "string",
            "minLength": 36,
            "maxLength": 36
        },
        "ApplicationDate": {
            "description": "Date and time of receipt of the request from the store",
            { "type": "string",
            { "format": "date-time".
        },
        { "status": {
            { "description": "deciphering the status of the application",
            { "type": "string",
            "minLength": 1,
            "maxLength": 100
        },
        "StatusID": {
            "description": "request status code",
            { "type": "string",
            "minLength": 1,
            "maxLength": 100
        },
        "OrderID": {
            "description": "store order number",
            { "type": "string",
            "minLength": 1,
            "maxLength": 100
        },
        "FirstName": {
            { "description": "client name",
            { "type": "string",
            "minLength": 1,
            "maxLength": 100
        },
        "LastName": {
            "description": "client name",
            { "type": "string",
            "minLength": 1,
            "maxLength": 100
        },
        { "MiddleName": {
            { "description": "client patronymic",
            { "type": "string",
            "minLength": 1,
            "maxLength": 100
        },
        "Phone: {
            "description": "Client's cell phone in the format 7XXXXXXXXXXXXX (all confirmation codes are sent to this number)",
            { "type": "string",
            "minLength": 11,
            "maxLength": 11
        },
        { "Email." {
            "description": "client email",
            { "type": "string",
            { "format": "email".
        },
        { "Amount": {
            "description": "Order amount in pennies without taking into account the store discount",
            { "type": "integer",
            { "minimum": 1,
            "maximum": 100000000
        },
        "AmountWithDiscount: {
            "description": "The amount of the order in kopecks, taking into account the store discount (by discount we mean the size of the store discount in order for the client to have an installment plan or a reduced rate on a loan)",
            { "type": "integer",
            { "minimum": 1,
            "maximum": 100000000
        },
        { "InitialFee": {
            { "description": "Amount of down payment in kopecks",
            { "type": "integer",
            { "minimum": 1,
            "maximum": 100000000
        },
        "InitialFeeInStore: {
            "description": "Parameter that determines where the down payment will be made. If the value 1 is specified, the customer must pay the down payment in the store, if 2, then the down payment is made through Mandarin, if 3, then the down payment is not provided",
            { "type": "integer",
            { "minimum": 1,
            "maximum": 3
        },
        { "CreditDate": {
            "description": "Date and time of loan disbursement (the moment the disbursement status is transferred from Mandarin to the financial institution)",
            { "type": "string",
            { "format": "date-time".
        },
        { "CreditSumm": {
            { "description": "Amount of the actual payment on the merchant's account (in kopecks)",
            { "type": "integer",
            { "minimum": 1,
            "maximum": 100000000
        },
        "FinOrg": {
            "description": "Name of the financial institution that the client has chosen to obtain the loan,
            { "type": "string",
            "minLength": 1,
            "maxLength": 100
        },
        { "RejectDate": {
            "description": "Date and time of transfer of refunds from Mandarin to the financial institution",
            { "type": "string",
            { "format": "date-time".
        },
        "RejectOrderID": {
            "description": "store return number",
            { "type": "string",
            "minLength": 1,
            "maxLength": 16
        },
        "RejectPrincipal." {
            { "description": "The amount of principal transferred from Mandarin to the financial institution as part of the refund in pennies",
            { "type": "integer",
            { "minimum": 1,
            "maximum": 1000000
        },
        { "RejectInterest": {
            { "description": "The amount of interest transferred from Mandarin to the financial institution as part of the refund in pennies is indicated only if the store compensates the interest for the customer."
            { "type": "integer",
            { "minimum": 1,
            "maximum": 100000000
        },
        { "RejectInitialFee": {
            { "description": "The amount of the down payment transferred from Mandarin to the borrower as part of the repayment in pennies."
            { "type": "integer",
            { "minimum": 1,
            "maximum": 100000000
        },
        "CardNumber": {
            "description": "The mask of the card from which the down payment is made in the format 123456XXXXXXXX7890",
            { "type": "string",
            "minLength": 16,
            "maxLength": 16
        },
        { "Passport": {
            "description": "Passport data array (transferred by agreement with the store),
            { "type": "object",
            { "properties": {
                { "Number": {
                    "description": "passport number",
                    { "type": "string",
                    "minLength": 6,
                    "maxLength": 6
                },
                { "Series": {
                    "description": "passport series",
                    { "type": "string",
                    "minLength": 4,
                    "maxLength": 4
                },
                "BirthDate": {
                    { "description": "date of birth",
                    { "type": "string",
                    { "format": "date-time".
                },
                "IssueDate": {
                    "description": "passport issue date",
                    { "type": "string",
                    { "format": "date-time".
                },
                { "code": {
                    "description": "Passport issuance subdivision code in the format XXXXXXX",
                    { "type": "string",
                    "minLength": 6,
                    "maxLength": 6
                },
                { "emitent": {
                    { "description": "By whom was the passport issued",
                    { "type": "string",
                    "minLength": 1,
                    "maxLength": 1000
                },
                { "BirthPlace": {
                    { "description": "birthplace",
                    { "type": "string",
                    "minLength": 1,
                    "maxLength": 300
                },
                { "gender": {
                    "description": "Client gender (True - Male, False - Female)",
                    "type": "boolean".
                }
            },
            "additionalProperties": false
        },
        { "FIOTranslit": {
            "description": "Array of transliteration data of the name in English",
            { "type": "object",
            { "properties": {
                "FirstNameEng": {
                    "description": "Client name transliterated into English",
                    "type": "string"
                },
                "LastNameEng": {
                    "description": "Client's last name in transliteration into English,
                    "type": "string"
                },
                "MiddleNameEng": {
                    { "description": "Client's patronymic transliterated into English,
                    "type": "string"
                }
            },
            "additionalProperties": false
        }
    },
    "additionalProperties": false
}

When you receive a CallBack from Mandarin, the store must send a response to Mandarin formed according to the following JSON schema:

{
     "$schema": "http://json-schema.org/draft-04/schema#",
     "title": "",
     "description": "",
     { "type": "object",
     { "properties": {
         { "Result": {
             { "description": "query processing result",
             { "type": "string",
             { "enum": [
                "True."
                "False."
            ]
        },
         { "Errors": {
             "description": "Array of error data (if any)",
             { "type": "array",
             { "items": {
                 { "type": "object",
                 { "properties": {
                     { "ErrorCode": {
                         "description": "Error code, determined on the store side",
                         "type": "string"
                    },
                     { "ErrorDescription." {
                         { "description": "Error description, defined on the store side",
                         "type": "string"
                    }
                },
                 { "required": [
                    { "ErrorCode",
                    "ErrorDescription".
                ],
                 "additionalProperties": false
            }
        }
    },
     { "required": [
        "Result."
    ],
     "additionalProperties": false
}

# Examples

Example CallBack notification from Mandarin

{
    "ApplicationID": "445a75a2-4a0f-462c-9380-afdb8c6f103d",
    "ApplicationDate": "2018-05-16 14:49:51+03:00",
    { "status": "Loan Approved",
    "StatusID": "CredAppr",
    "OrderID": "31978",
    "FirstName": "Ivan",
    "LastName": "Ivanov",
    "MiddleName": "Ivanovich",
    "Phone: "71112223344",
    { "Email": "mail@mail.ru",
    "Amount":1000,
    "AmountWithDiscount":9000,
    "InitialFee":0,
    "InitialFeeInStore":1,
    "CreditDate": "2018-05-16 14:59:25+03:00",
    "CreditSumm:9000,
    "FinOrg: Alfa Bank,
    "RejectDate": "2018-05-16 14:49:51+03:00",
    "RejectOrderID": "31978",
    "RejectPrincipal":8500,
    "RejectInterest":1000,
    "RejectInitialFee":0,
    "CardNumber": "123456XXXXXXXX7890",
    { "Passport": {
        { "number": "1234",
        { "Series": "123456",
        "BirthDate": "1990-05-16 00:00:00+03:00",
        "IssueDate": "2000-05-16 00:00:00+03:00",
        "Code": "123456",
        "Emitent: "Passport Office of Moscow",
        "BirthPlace: "Gor. Moscow",
        "Gender": true
    },
    { "FIOTranslit": {
        "FirstNameEng": "Ivan",
        "LastNameEng": "Ivanov",
        "MiddleNameEng": "Ivanovitch"
    }
}

An example of the store's response to CallBack by Mandarin In case of successful processing of the received CallBack:

{
    { "result": "True"
}

In case of unsuccessful processing of received CallBack:

{
    { "Result": "False",
    "Errors": ["Error in the Amount parameter", "AmountError"]
}

Example implementation code

Below is an example of a service implementation code in C# language:

// ASP.NET Web API controller
public CallbackController: ApiController
 {
  // Attribute indicating that the request comes by HTTP POST method with data in the body of the request
  [HttpPost]
  // callback processing method, the callback format is described in the JSON schema
  public HttpResponseMessage GetMandarinCallback([FromBody] SevenSecondsCallback callback) {
   // callback processing

   return Json(new // return processing result
    {
     result = true
    });
  }
 }