JS SDK is a library that will help you integrate with the API SDK
All you have to do is create your own form and call the corresponding method in the JS SDK
In order to use this mechanics, the merchant must install the script on their site. The script will collect site data and securely encrypt it. Then this data will be sent to the API in the form of a token
To use the JS SDK, you need to contact your personal manager
Initialization#
To initialize the SDK, you need to add the following code to the head:
Now you have the SDK object available, set your publickey and token:
publickey
and token can be obtained from your manager
Description of SDK methods#
Getting a token:#
JSTokenizeOptionsBankCard:
Name | Type | Description |
---|
type | string | Type of encrypted data. bank_card - bank card |
options.card_number | string | Card number. The card number input field must support input of 13 to 19 digits |
options.card_holder_name | string | Cardholder name |
options.card_exp_month | string | Card expiration month |
options.card_exp_year | string | Card expiration year |
Once you receive the token, you can use it to make a payment
One-step payment#
Name | Type | Description |
---|
order_id | string | Unique identifier in the store system |
auto_clearing | integer | 1 - if clearing is required automatically, 0 - if the merchant calls the clearing method himself |
amount | float | Payment amount |
currency | string | Payment currency |
description | string | Payment description |
test | integer | 1 - if test payment mode, 0 - if combat |
options.custom_params | object | Additional parameters. Will be sent back to the merchant at ResultURL after the payment is made |
options.user.email | string | Client's email |
options.user.phone | string | Client's phone number |
JSTransactionOptionsBankCardToken:
Name | Type | Description |
---|
type | string | Type of data transferred. tokenized_card - transfer of card token |
options.token | string | Previously received card token |
options.card_cvv | integer | CVC/CVV of the card for which the token was made |
Name | Type | Description |
---|
pares | string | Parameter that comes to termUrl |
md | string | Parameter that comes to termUrl |
JSTransactionOptionsBankCard:
Name | Type | Description |
---|
type | string | Type of data transferred. bank_card - transfer of open card data |
options.card_number | string | Card number. The card number input field must support input of 13 to 19 digits. |
options.card_holder_name | string | Cardholder name |
options.card_exp_month | string | Card expiration month |
options.card_exp_year | string | Card expiration year |
options.card_cvv | integer | CVC/CVV cards |
Responses#
Name | Type | Description |
---|
payment_id | integer | Type of data transferred. bank_card - transfer of open card data |
order_id | string | Card number. The card number input field must support input of 13 to 19 digits |
payment_status | string | Cardholder name |
3ds | object | Card expiration month |
3ds.version | string | Card expiration year |
3ds.acsurl | string | CVC/CVV cards |
3ds.md | string | Card expiration year |
3ds.pareq | string | CVC/CVV cards |
3ds.frame_url | string | CVC/CVV cards |
Name | Type | Description |
---|
token | integer | Token for further payment |
Name | Type | Description |
---|
response.error_code | string | Error code |
response.error_message | string | Error description |
If JSPayResult.payment_status = need_confirm
came there are several mechanics of passing 3DS:On the SDK side#
The entire 3DS process takes place on the js sdk side, the only thing the merchant needs to do is create a DOM element with id="3dsForm", in it the payer will enter 3DS data
The recommended size of the DOM element is 550px X 600px
The id property can be changed when calling the confirmInIframe(JSPayResult, "myCustom3dsElement") function
At this point, the merchant must prepare the container (3dsForm) for correct display to the client. For example, open a pop-up window, remove the form and show the container, etc
Request for confirmInIframe
Own implementation of 3ds shape processing#
When requesting a charge
, if 3ds is installed on the card, it is necessary to make a request to the ACS server of the card issuer bank
If it is necessary to pass 3ds, the response to the call to the charge
method will be JSPayResult.payment_status = need_confirm
and an additional 3ds
object with JS3dsv1Object
parameters
Name | Type | Description |
---|
PaReq | string | The pareq parameter from the response |
MD | string | Parameter md from the response |
TermUrl | string | Url to which the client will be transferred after completing 3DS |
If successful, a POST request with the following parameters will be sent to TermUrl:
Name | Type | Description |
---|
PaRes | string | The parameter is required for the paymentAcs request |
MD | string | The parameter is required for the paymentAcs request |
После получения этих параметров, требуется сделать запрос на confirm3dsv1
:
Example of full integration#