npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-yookassa

v2.2.0

Published

Library for implement Yandex Checkout

Downloads

176

Readme

Yookassa Checkout on React Native

Android library: 7.0.0

iOS library: 7.1.0

Install

yarn

yarn add react-native-yookassa

npm

npm install react-native-yookassa --save

Usage

import YandexPayment, { Shop, Payment, PaymentToken } from 'react-native-yookassa';

const shop: Shop = {
    id: 'SHOP_ID',
    token: 'test_SHOP_TOKEN',
    name: 'Shop name',
    description: 'Shop description',
}
const payment: Payment = {
    amount: 399.99,
    currency: 'RUB', // 'RUB' | 'USD' | 'EUR'
    types: ['BANK_CARD'], // 'YANDEX_MONEY' | 'BANK_CARD' | 'SBERBANK' | 'PAY'. PAY - means Google Pay or Apple Pay
    yooKassaClientId: 'SHOP_ID',
    savePaymentMethod: 'OFF', // 'ON' | 'OFF' | 'USER_SELECTS'
}

try {
  const paymentToken: PaymentToken = await YandexPayment.show(shop, payment)
  console.warn(paymentToken.token) // payment token
  console.warn(paymentToken.type) // payment method type

// send token to your backend and get requestUrl for payment confirmation
// const requestUrl = <FETCH_FROM_BACKEND>

  await YandexPayment.show3ds(requestUrl, paymentToken.type)

  YandexPayment.close()
} catch (e) {
  console.error('Payment error')
}

Android

minSdkVersion = 24

  1. Add file android/app/src/main/res/xml/ym_network_security_config.xml
<domain-config cleartextTrafficPermitted="true">
  <domain includeSubdomains="true">certs.yoomoney.ru</domain>
</domain-config>
  1. Add line in android/app/src/main/AndroidManifest.xml
    <application
       ...
+      android:networkSecurityConfig="@xml/ym_network_security_config"
       ...
    />
  1. Add file android/app/src/debug/res/xml/network_security_config.xml
<network-security-config>
  <base-config cleartextTrafficPermitted="true" />
</network-security-config>
  1. Add lines in android/app/src/debug/AndroidManifest.xml
    <application
       ...
+      android:networkSecurityConfig="@xml/network_security_config"
+      tools:replace="android:networkSecurityConfig"
       ...
    />
  1. For SBP payments add your unique app schema in android/app/src/main/res/values/string.xml Details see on git.yoomoney.ru
<resources>
    ...
+    <string name="ym_app_scheme" translatable="false">exampleapp</string>
    ...
</resources>

iOS

Min CocoaPods version: 1.13.0

Min iOS version: 14.0

  1. Add dependency in ios/Podfile
source 'https://github.com/CocoaPods/Specs.git'
source 'https://git.yoomoney.ru/scm/sdk/cocoa-pod-specs.git'

...

platform :ios, '14.0'
use_frameworks!

...

target 'MyApp' do
  pod 'YooKassaPayments',
   :build_type => :dynamic_framework,
   :git => 'https://git.yoomoney.ru/scm/sdk/yookassa-payments-swift.git',
   :tag => '7.1.0'

# ... other dependencies

end
  1. Install pods in ios
pod install