2.0.18 • Published 2 years ago

@noda-ui/sdk-react v2.0.18

Weekly downloads
2
License
-
Repository
-
Last release
2 years ago

@noda-ui/sdk-react

Installation

npm i @noda-ui/sdk-react -S
#or
yarn add @noda-ui/sdk-react

Usage

<body>
    <div id="root"></div>
</body>
import { NodaButton } from '@noda-ui/sdk-react'
import '@noda-ui/sdk-react/lib/ndb.css'

const paymentInfo = {
    apiKey: 'string',
    result: (...args) => {},
    onHistory: (...args) => {},
    currency: 'string',
    amount: 0,
    customerId: 'string',
    shopId: 'string',
    email: 'string',
    iin: 0,
    disabled: false,
    description: 'string',
    paymentId: 'string',
    returnUrl: 'string',
    webhookUrl: 'string',
    ipAddress: 'string',
    replaceWindow: false
}

const country = 'gb'
const env = 'PRODUCTION'

const App = () => (
    <>
        <NodaButton env={env} country={country} payment={paymentInfo} /> 
    </>
);

ReactDOM.render(<App />, document.getElementById('root'));

Usage with TypeScript

declare module '@noda-ui/sdk-react'

Parameters

PaymentInfo

FieldTypeDescription
apiKey *requiredstringMerchant's api key, issued by Noda
amount *requirednumberPayment amount
currency *requiredstringPayment currency in ISO_4217 format. Currently accepted: {GBP, EUR}
returnUrl *requiredstringAfter the payment completed, customer will be redirected into this Url
paymentId *requiredstringOrder identificator in merchant's system
webhookUrlstringURL where the Noda will send hooks about the payment status changes
shopIdstringMerchant's shop identificator, issued by Noda. If you have more than one online shop, this parameter helps to analyse the payments afterwards
descriptionstringShort order description for the customer
customerIdstringEnd-customer Id in merchant's system. That parameter can be used to find a best button appearance for the particular customer.
emailstringEnd-customer e-mail. That parameter can be used to find a best button appearance for the particular customer.
iinintegerIIN (first six digits) of the end-customers credit card used earlier at the merchant's checkout. This parameter helps to define end-customer Bank and propose to pay with that bank.
ipAddressstringEnd-customer IP Address. That parameter can be used to detect a customer's country (for example, for EUR payments - Spain, Germany, France etc.)
resultfunctionPayment completion callback function implemented by merchant
onHistoryfunctionBilling information changes callback function implemented by merchant
disabledbooleanNoda Button component state
replaceWindowbooleanWill replace the current window with bank page after bank selection
customerEmail *depricated (use email field instead)stringEnd-customer e-mail. That parameter can be used to find a best button appearance for the particular customer.

Country

FieldTypeDescription
country *requiredstringISO 3166-1 alpha-2 country code

Environment

FieldTypeDescription
envstringApp environments, for develop and production. Currently accepted: {PRODUCTION, DEVELOPMENT}. Default: {PRODUCTION}

Security

Remember to use valid api token for apiKey field.

How to obtain the keys?

Sandbox: use 24d0034-5a83-47d5-afa0-cca47298c516 for DEVELOPMENT environment. Live: use 808e683e-9383-4717-8148-02e74b63b1f8 for testing purposes.

Please consider, that this is a real payment routing which is set up to charity organisations complete the onboarding at ui.noda.live/hub to get your production keys

Creating a Payment

In order to initiate payment, pass the payment parameters into update method.

Payment UX

Depending on the additional parameters passed, payment UX will be rather country-oriented (with the bank selection at the first step) or bank-oriented (with the particular bank pre-selected). Please switch the "Purchase scenarios" at ui.noda.live/demo in order to overview the different behavior.

If you've used some additional parameters (for example - IP, IIN, CustomerID and so on) previosly, for the same purchase, we highly recommend pass the same additional parameters, in order to keep the consistent UX for the customers.

Payment Result parameters

ParameterDescription
idPayment identificator in Noda system
statusPayment status: {Done, Failed}
signatureSignature: sha256(id+status+signatureKey)

Payment Result handling

You can receive payment result with the following options:

  • parameters in returnUrl After the payment completed, customer will be redirected into returnUrl with the Payment Result parameters in query string:
https://{domain}?id=63c507d9-4f19-46d0-ac37-5b7d4f6fe040&status=Done&signature=6ec13bda02080a4006223c1ba9d8fa97e2de0a1ca782d95d63f4b69789117cc6
  • receive a hook into webhookUrl If you passed webhookUrl earlier, you will receive the hook as POST request with the Payment Result parameters as JSON body (example):
{
    id: "63c507d9-4f19-46d0-ac37-5b7d4f6fe040",
    status: "Done",
    signature: "6ec13bda02080a4006223c1ba9d8fa97e2de0a1ca782d95d63f4b69789117cc6"
}

For the returnUrl and webhookUrl handling methods, make sure to implement the proper payment control procedures

Control procedures

If you're using returnUrl and/or webhookUrl for the results handling, it is mandatory to implement a simple control procedure in order to prevent fraudulent behaviour. After receiving the results you will need to do the following:

  • Verify the payment signature parameter The signature can be verified with the following algorythm:
signature == sha256(id+status+signatureKey)
  • Check the duplicates of signatures

You will need to make sure the payment result belongs to the concrete order you are about to proceed. Intruders can not create a valid Signature unless they know your SignatureKey. However, they can intercept the result message and then re-use its Signature. In order to prevent this action, you will need to implemenent anti-duplication control algorythm. For example, you can compare the paymentId of the current order and in the payment result.

Api usage

See the Noda API docs.

2.0.17

2 years ago

2.0.18

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.5

2 years ago

2.0.4

2 years ago

2.0.7

2 years ago

2.0.6

2 years ago

2.0.9

2 years ago

2.0.8

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

2.0.15

2 years ago

2.0.16

2 years ago

2.0.13

2 years ago

2.0.14

2 years ago

2.0.11

2 years ago

2.0.12

2 years ago

2.0.10

2 years ago

1.0.19

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.2.15

3 years ago

0.2.14

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.9

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.8

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.1.12

3 years ago

0.1.13

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.2.2

3 years ago

0.1.10

3 years ago

0.1.11

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago