Инструменты страницы



Request for payment using Apple Pay (applePay)

The request used for payment via Apple Pay is applePay.

Use the following URL to connect to the Test Service (WSDL):
https://3dsec.sberbank.ru/payment/webservices/merchant-ws?wsdl.

Use the standard requests to the payment gateway for the operations of reversal, refund and payment completion.

In this document, the following data type conventions are used when describing request and response parameters:

  • A<n> – a sequence of Latin letters of length <n>;
  • A..<n> – a sequence of Latin letters with a length not exceeding <n>;
  • N<n> – a sequence of digits of length <n>;
  • N..<n> – a sequence of digits with a length not exceeding <n>;
  • AN<n> – a sequence of Latin letters and numbers of fixed length <n>;
  • AN.. <n> – a sequence of Latin letters and numbers with a length not exceeding <n>;
  • ANS<n> – a sequence of Latin letters, numbers and characters of fixed length <n>
  • ANS.. <n> – a sequence of Latin letters, numbers and characters with a length not exceeding <n>;
  • UTC – date and time, in this case: the date must be passed without specifying the time zone, Moscow time, for the SOAP protocol, the standard encoding xs: dateTime is used.

Request parameters

The request parameters are given in table below.

Name Type Mandatory Description

merchant

AN..255

Yes

Merchant login in the payment gateway.

orderNumber

ANS..32

Yes

The number (identifier) of the order in the store system is unique for each store within the system – up to 30 characters. If the order number is generated on the Payment Gateway side, this parameter is not mandatory.

description

ANS..512

No

Description of the order in any format. Only the first 24 characters of this field are transferred to Sberbank's processing for inclusion in the merchant's financial statements.

To enable sending this field to the processing system, contact the technical support service.

paymentToken

AN..8192

Yes

The paymentToken parameter must contain a Base64 encoded value of the paymentData property that was received in PKPaymentToken Object from the Apple Pay system (see Apple Pay documentation). Thus, to send a payment request to the payment gateway, the merchant must:

  1. Receive from the Apple Pay system the PKPaymentToken Object object containing the paymentData property;
  2. Extract the value of the paymentData property and encode it in Base64;
  3. Include the encoded value of the paymentData property as the value of the paymentToken parameter in the payment request that the merchant sends to the payment gateway.

language

A2

No

Language in the ISO 639-1 encoding. If the language is not specified, the default language defined in the store settings is used.

clientID

ANS..255

No

Identifier of the Customer in the Store system. Used to implement the functionality of bindings.

additionalParameters

Not applicable

No

Additional parameters of the order that are stored in the merchant personal account for the subsequent viewing. For each additional parameter, use the entry block which includes the following nested parameters.

Name Type Description

key

String

The name of the optional parameter.

value

AN..1024

The value of the additional parameter is up to 1024 characters.

Below is an example of how to use this parameter.

<entry>
    <key>parameter_1</key>
    <value>value_1</value>
</entry>
<entry>
    <key>parameter_2</key>
    <value>value_2</value>
</entry>

If the merchant has fiscalization set up, when indicating email (the buyer's email address) and/or phone (the buyer's cell phone number) as additional parameters, these parameters are first used to send the fiscal receipt.

It is forbidden to pass reserved names in the parameter (if they are passed, the order may be rejected):

  • sbrf_spasibo:amount_bonus
  • sbrf_sbermiles:amount_bonus
  • loyaltyId

preAuth

A..5

No

Parameter that defines the necessity of a pre-authorization (putting the amount on hold on the customer's account until its debiting). The following values are available:

  • true – the parameter is enabled, a two-phase payment is made;
  • false – the parameter is disabled, a one-phase payment is made (funds are debited immediately).

If the parameter is not specified in the request, a one-phase payment occurs.

Two-phase payments functionality is available if specifically requested by Merchant from the bank.

This parameter can be passed either as a boolean value (without quotation marks) or as a string (with quotation marks).

ip

ANS..39

No

IP-address of the buyer. IPv6 is supported in all requests (up to 39 characters).

billingPayerData

See description

No

Customer's registration data (street address, postal code). Required for AVS/AVV checks.

Mandatory if «AVS/AVV use allowed» permission is enabled for merchant

dynamicCallbackUrl

ANS..512

No

This parameter enables dynamic callback functionality. In it, you can pass the address to which all «payment» callback notifications activated for the merchant will be sent. Payment-related notifications are callback notifications about the following events: successful hold, payment rejected by timeout, cardpresent payment rejected, successful debiting, refund, reversal. Notably, payment-unrelated callbacks that are active for the Merchant (enabling/disabling a binding, binding creation) will be sent to static callback URL.

billingPayerData



billingPayerData block parameters

Name Type Mandatory Description

billingCity

AN..50

No

City registered for the card at the Issuer Bank.

billingCountry

AN..50

No

billingAddressLine1

AN..50

No

Address registered for the card at the Issuer Bank.

Line 1.

Mandatory if «AVS/AVV use allowed» permission is enabled for merchant.

billingAddressLine2

AN..50

No

Address registered for the card at the Issuer Bank.

Line 2.

billingAddressLine3

AN..50

No

Address registered for the card at the Issuer Bank.

Line 3.

billingPostalCode

AN..50

No

Postal code registered for the card at the Issuer Bank.

Mandatory if «AVS/AVV use allowed» permission is enabled for merchant.

billingState

AN..50

No

State registered for the card at the Issuer Bank (ISO 3166-2).

Response parameters

The response parameters are given in table below.

Name Type Mandatory Description

success

A..5

Yes

Designates a successful request. The following values are available:

  • true – request is processed successfully;
  • false – request failed.
data block (returned only if the request was successful)

orderId

ANS36

Yes

Identifier of the order in the payment system. It is unique within the system. The identifier is missing if the order registration failed due to an error detailed in errorCode.

error block (returned only if the request resulted in an error)

code

N3

Yes

Error code.

description ANS..512 Yes A detailed technical explanation of the error – the contents of this parameter is not to be displayed to the customer.
The OrderStatus element contains order status parameters and is returned only if the payment gateway recognized all request parameters as correct. See the list of nested parameters below.

errorCode

ANS..3

No

Error code.

See description of error codes on this page.

orderNumber

ANS..32

Yes

The number (identifier) of the order in the store system is unique for each store within the system – up to 30 characters. If the order number is generated on the Payment Gateway side, this parameter is not mandatory.

orderStatus

N1

No

The order status in the payment system is defined by the value of this parameter. It is missing if the order has not been found. The following values are available:

  • 0 – order is registered but unpaid;
  • 1 – the preauthorized amount is held (for two-phase payments);
  • 2 – full authorization of the order amount was carried out;
  • 3 – authorization is canceled;
  • 4 – a refund operation was performed for the transaction;
  • 5 – authorization via ACS of the issuing bank was initiated;
  • 6 – authorization is declined.

actionCode

N..5

Yes

Processing code Full list of processing response codes and description of these codes is available on a separate page.

actionCodeDescription

AN..512

Yes

Description of actionCode returned by processing. Full list of processing response codes and description of these codes is available on a separate page.

amount

N..12

Yes

Payment amount in minimum currency units.

currency

N3

No

ISO 4217 code of the payment currency. If not specified, default value is used.

date

ANS

Yes

Date of order registration in Unix-time format (POSIX-time).

ip

ANS..39

Yes

IP-address of the buyer. IPv6 is supported in all requests (up to 39 characters).

merchantOrderParams element

Name

name

Type

AN..20

Type2

ANS..255

Type3

A7

Type4

ANS..100

Description

REST

Name of the additional parameter.

REST Online Lending

The attribute name, always takes the value of mdOrder.

WS

Name of the additional parameter.

Spasibo

Name or the description of an item in any format.

Spasibo2

Name of the parameter describing the details of a line item

AN..20

No

Name of the additional parameter.

value

AN..1024

No

The value of the additional parameter is up to 1024 characters.

attributes element

name

A7

No

Name of the additional parameter.

value

AN..1024

No

The value of the additional parameter is up to 1024 characters.

cardAuthInfo element

pan

N12…19

No

Masked number of the card that has been used for the payment. This parameter is to be specified only after the order has been paid.

In the case of payment via Apple Pay, DPAN is used as the card number: a number associated with the buyer's mobile device and acting as a payment card number in the Apple Pay system.

expiration

ANS

No

Expiry date of the card in the format YYYYMM.

cardholderName

A..200

No

Cardholder's name in Latin characters, if available.

approvalCode

AN6

No

International payment system authorization code. This field has a fixed length (six characters) and can contain digits and Latin letters.

authDateTime

ANS

No

Authorization date and time in Unix time (POSIX time).

terminalId

AN..10

No

Identifier of the terminal in processing through which the payment was made.

authRefNum

AN..24

No

Registration number of the payment authorization that has been assigned to it on the payment registration.

paymentAmountInfo element

approvedAmount

N..12

No

Amount confirmed to be debited.

depositedAmount

N..12

No

The amount in the minimum currency units (for example, in kopecks), confirmed to be debited from the card.

refundedAmount

N..12

No

The refund amount in minimum currency units.

paymentState

A..10

No

Order status; the parameter can take the following values:

  • CREATED – order is created;
  • APPROVED – order is approved;
  • DEPOSITED – order is completed;
  • DECLINED – the order is declined;
  • REVERSED – order is reversed;
  • REFUND – there has been a refund for this order;

totalAmount

N..12

No

Order amount + fee (if applicable to the order).

The bankInfo element contains the following parameters.

bankCountryName

AN..160

No

Country of the issuing bank.

Error codes from the error parameter

Error code Error text
1

The funds on the card are not sufficient.

4

Invalid parameter value [paymentToken.signature], the check failed.

4

Authorization is invalid.

10

Invalid parameter value [merchant].

10

Invalid parameter value [orderNumber].

10

Invalid parameter value [paymentToken].

10

Invalid parameter value [paymentToken.version].

10

Invalid parameter value [paymentToken.header].

10

Invalid parameter value [paymentToken.signature].

10

Invalid parameter value [paymentToken.header.transactionId].

10

Invalid parameter value [paymentToken.header.wrappedKey].

10

Invalid parameter value [paymentToken.header.publicKeyHash].

Error codes from parameter errorCode

POST request example

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mer="http://engine.paymentgate.ru/webservices/merchant">
   <soapenv:Header/>
   <soapenv:Body>
      <mer:applePay>
         <arg0>
            <merchant>OurBestMerchantLogin</merchant>
            <orderNumber>UAF-203974-DE</orderNumber>
            <description>Test description</description>
            <paymentToken>ew0KICB7DQoJICAidmVyc2lvbiI6ICJSU0FfdjEiLA0KCSAgInNpZ25hdHVyZSI6ICJabUZyWlNCemFXZHVZWFIxY21VPSIsDQoJICAiaGVhZGVyIjogew0KCQkiZXBoZW1lcmFsUHVibGljS2V5IjogIk1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRW14Q2hDcGpLemY5YVh6MjZXVDZaVE4yekUzaUdYUWpjWlJZWUFkUUlURFgyUmtBTmJ0N2s5cmFoRjFoempqbWVWVHhjZ0NvZkg4MXprMkdOVFozZHRnPT0iICAgICAgIA0KCQkid3JhcHBlZEtleSI6ICJYejI2V1Q2WlROMnpFM2lHWFFqYz0iDQoJCSJwdWJsaWNLZXlIYXNoIjogIk9yV2dqUkdrcUVXamRrUmRVclhmaUxHRDBoZS96cEV1NTEyRkpXckdZRm89IiwNCgkJInRyYW5zYWN0aW9uSWQiOiAiYXBwbGUtMTIzNDU2Nzg5MEFCQ0RFRiINCgkgIH0sDQoJICAiZGF0YSI6ICIxZFhFMTNrdnpUVlA2bldFTjhEMnBoclBsZlFjR3I4VzN5ajJTSFlZai9QeWNIV1RqbnBWN3ovRXI3OGJyaT09Ig0KICB9DQp9</paymentToken>
            <language>RU</language>
            <additionalParameters>
               <entry>
                  <key>firstParamName</key>
                  <value>firstParamValue</value>
               </entry>
            </additionalParameters>
            <preAuth>true</preAuth>
            <ip>127.0.0.1</ip>
         </arg0>
      </mer:applePay>
   </soapenv:Body>
</soapenv:Envelope>

Пример ответа

Successful payment

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns1:applePayResponse xmlns:ns1="http://engine.paymentgate.ru/webservices/merchant">
         <return>
            <success>true</success>
            <data>
               <orderId>4574f3e8-0d9a-418e-adcc-4b63aadee95b</orderId>
            </data>
            <orderStatus orderNumber="1478528500391" orderStatus="2" actionCode="0" actionCodeDescription="" amount="960000" currency="643" date="2016-11-07T17:24:13.573+03:00" ip="81.18.144.51" errorCode="0">
               <attributes name="mdOrder" value="4574f3e8-0d9a-418e-adcc-4b63aadee95b"/>
               <cardAuthInfo maskedPan="520424**0010" expiration="201907" cardholderName="CARD HOLDER" approvalCode="123456"/>
               <authDateTime>2016-11-07T17:24:13.890+03:00</authDateTime>
               <terminalId>12345678</terminalId>
               <authRefNum>111111111111</authRefNum>
               <paymentAmountInfo paymentState="DEPOSITED" approvedAmount="960000" depositedAmount="960000" refundedAmount="0"/>
               <bankInfo bankCountryName="&lt;UNKNOWN>"/>
            </orderStatus>
         </return>
      </ns1:applePayResponse>
   </soap:Body>
</soap:Envelope>

Failed payment

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <ns1:applePayResponse xmlns:ns1="http://engine.paymentgate.ru/webservices/merchant">
         <return>
            <success>false</success>
            <error>
               <code>10</code>
               <description>Merchant hasn't private key</description>
            </error>
            <orderStatus errorCode="0"/>
         </return>
      </ns1:applePayResponse>
   </soap:Body>
</soap:Envelope>