All Projects → lodosstm → yandex-checkout-node

lodosstm / yandex-checkout-node

Licence: MIT license
Node.js SDK for Yandex.Checkout (unofficial)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to yandex-checkout-node

Yandex.Checkout.V3
.NET-клиент для Яндекс.Кассы
Stars: ✭ 30 (-53.12%)
Mutual labels:  payments, yandex-kassa, yandex-checkout
YaSeeker
Yandex OSINT tool
Stars: ✭ 104 (+62.5%)
Mutual labels:  yandex
recurly-integration-examples
Examples to get you integrated with Recurly in any language.
Stars: ✭ 64 (+0%)
Mutual labels:  payments
uniteller-php-sdk
PHP (7.2+) SDK for integration internet-acquiring of the Uniteller (unofficial)
Stars: ✭ 21 (-67.19%)
Mutual labels:  payments
docker-machine-driver-yandex
Yandex.Cloud driver for Docker Machine
Stars: ✭ 21 (-67.19%)
Mutual labels:  yandex
ilp-plugin-ethereum
Settle Interledger payments with ETH and ERC-20 tokens
Stars: ✭ 41 (-35.94%)
Mutual labels:  payments
woocommerce-plugin
Accept bitcoins on your wordpress site, payments go directly into your wallet
Stars: ✭ 22 (-65.62%)
Mutual labels:  payments
graft-ng
Supernode for GRAFT Network - 2nd layer Monero implementation for instant transactions and service brokers
Stars: ✭ 20 (-68.75%)
Mutual labels:  payments
cms-prestashop
YooKassa payment module for PrestaShop
Stars: ✭ 13 (-79.69%)
Mutual labels:  payments
drupal 8 unset html head link
🤖 Module for unset any wrong HTML links (like rel="delete-form", rel="edit-form", etc.) from head on Drupal 8.x websites. This is trust way to grow up position in SERP Google, Yandex, etc.
Stars: ✭ 19 (-70.31%)
Mutual labels:  yandex
django-mercadopago
⚠️ Deprecated. Use https://github.com/jazzband/django-payments/ instead.
Stars: ✭ 32 (-50%)
Mutual labels:  payments
cybersource-sdk-java
Java SDK for CyberSource Simple Order API
Stars: ✭ 44 (-31.25%)
Mutual labels:  payments
kbcli
GO client library for Kill Bill
Stars: ✭ 22 (-65.62%)
Mutual labels:  payments
yandex-disk-api
This library is built to use Yandex Disk API with PHP
Stars: ✭ 19 (-70.31%)
Mutual labels:  yandex
xy2xy
A list of technologies similar to inner Yandex technologies
Stars: ✭ 112 (+75%)
Mutual labels:  yandex
hub20
Self-hosted payment gateway for Ethereum and any ERC20 token, integrates with Raiden for almost-zero fees.
Stars: ✭ 59 (-7.81%)
Mutual labels:  payments
robots-txt-parser
PHP class for parse all directives from robots.txt files according to specifications
Stars: ✭ 38 (-40.62%)
Mutual labels:  yandex
adyen-android
Adyen SDK for Android
Stars: ✭ 89 (+39.06%)
Mutual labels:  payments
translate
A module grouping multiple translation APIs
Stars: ✭ 321 (+401.56%)
Mutual labels:  yandex
borica-3ds
PHP Borica EMV 3DS library
Stars: ✭ 15 (-76.56%)
Mutual labels:  payments

Yandex.Checkout API SDK (unofficial)

Deprecated! The package is not supported, it is recommended to use https://github.com/a2seven/yoocheckout

Version Build Status Downloads Try on RunKit Dependencies

README на русском!

Unofficial SDK for Yandex.Checkout

Yandex.Checkout - a universal solution for working with online payments. The Yandex.Checkout API is built on REST-principles, works with real objects and has predictable behavior. Using this API, you can send payment requests, save payment information for repeated charges (and include auto payments), make refunds and much more.

The API uses HTTP as the main protocol, which means it is suitable for development in any programming language that can work with HTTP libraries (for example, cURL). Authentication uses Basic Auth, so you can make your first request directly from the browser.

The API supports POST and GET requests. POST requests use JSON arguments, GET requests work with query strings. The API always returns a response in JSON format, regardless of the type of request.

Authentication

For HTTP authentication. In the request headers it is necessary to transfer:

  • username - the identifier of your store in Yandex.Checkout;
  • password - your secret key.

Release the secret key (as well as re-issue and delete the irrelevant) in the personal cabinet of Yandex.Checkout, in the Settings section.

Example request with authentication

$ curl https://payment.yandex.net/api/v3/payments/{payment_id} \
-u <Store ID>: <Secret key>

Idempotency

In the context of the API, idempotency means that multiple requests are handled in the same way as one-time requests. This means that after receiving a repeated request with the same parameters, Yandex.Checkout will return the result of the original request (if the request is fulfilled) or the status in the processing (if the request is still executed) in response.

This behavior helps prevent unwanted repetition of transactions. For example, if there were problems with the network during the payment and the connection was interrupted, you can safely repeat the requested request an unlimited number of times. GET requests are by default idempotent, since they do not have undesirable consequences.

Example query with idempotence key

$ curl https://payment.yandex.net/api/v3/refunds \
  -X POST \
  -u <Store ID>: <Secret key> \
  -H 'Idempotence-Key: <Idempotence key>' \
  -H 'Content-Type: application / json' \
  -d '{
        "amount": {
          "value": "2.00",
          "currency": "RUB"
        },
        "payment_id": "215d8da0-000f-50be-b000-0003308c89be"
      } '

To ensure the idempotency of POST requests, the Idempotence-Key (or idempotence key) header is used.

How it works: if you repeat a query with the same data and the same key, the API treats it as a repeated one; if the data in the request is the same, and the idempotency key is different, the request is executed as new.

In the Idempotence-Key header, you can pass any value unique to this operation on your side. We recommend using the V4 UUID.

Yandex.Checkout provides Idempotency within 24 hours after the first request, then a second request will be processed as new.

Asynchrony

Each payment is a complex process in which several participants are involved. Transaction processing can take up to several seconds, so Yandex.Checkout processes requests asynchronously. This makes the API really productive and does not keep the connection open for a few seconds.

If Yandex.Checkout for some reason does not have time to process the request for the allotted time, the response comes in the HTTP code 202 and the object with processing type. To get the result, send the request again with the same data and the same Idempotence-Key. In the retry_after field, the API returns the number of milliseconds through which it is recommended to repeat the request.

Example of the body of the response, after which you need repeat the request

  {
    "type": "processing",
    "description": "Request accepted, but not processed yet. Retry again with the same Idempotence-Key",
    retry_after: 1800
  }

Reference

Yandex.Money API page

Installation

npm install yandex-checkout

Getting started

The package needs to be configured with your account's secret key and shop identifier which you can create also recreate and delete in personal area Yandex.Checkout in Settings. And tutorial for creating secret key. after you have secret key and shop identifier:

  • Add dependency 'yandex-checkout' in your package.json file.
  • Require 'yandex-checkout' in your app with shop identifier and secret key. You can use 2 variation:
first
var yandexCheckout = require('yandex-checkout')('your_shopId', 'your_secretKey');
second
var yandexCheckout = require('yandex-checkout')({ shopId: 'your_shopId', secretKey: 'your_secretKey' });
Also you can use another parameter for require:
For example:
var yandexCheckout = require('yandex-checkout')({ shopId: 'your_shopId', secretKey: 'your_secretKey', timeout: 20000 });

Examples

Payment creating
var idempotenceKey = '02347fc4-a1f0-49db-807e-f0d67c2ed5a5';
YandexCheckout.createPayment({
  'amount': {
    'value': '2.00',
    'currency': 'RUB'
  },
  'payment_method_data': {
    'type': 'bank_card'
  },
  'confirmation': {
    'type': 'redirect',
    'return_url': 'https://www.merchant-website.com/return_url'
  }
}, idempotenceKey)
  .then(function(result) {
    console.log({payment: result});
  })
  .catch(function(err) {
    console.error(err);
  })
Getting information about payment
var paymentId  = '21966b95-000f-50bf-b000-0d78983bb5bc';
YandexCheckout.getPayment(paymentId)
  .then(function(result) {
    console.log({payment: result});
  })
  .catch(function(err) {
    console.error(err);
  })

Running Tests

To install the development dependencies (run where the package.json is):

$ npm install

Run the tests:

$ npm test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].