https://github.com/paypal/paypal-funding-components
PayPal JavaScript SDK Funding Components
https://github.com/paypal/paypal-funding-components
Last synced: 4 months ago
JSON representation
PayPal JavaScript SDK Funding Components
- Host: GitHub
- URL: https://github.com/paypal/paypal-funding-components
- Owner: paypal
- License: apache-2.0
- Created: 2019-05-29T03:09:53.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2023-12-19T16:32:55.000Z (over 2 years ago)
- Last Synced: 2024-04-13T19:27:17.142Z (over 2 years ago)
- Language: JavaScript
- Size: 109 KB
- Stars: 20
- Watchers: 23
- Forks: 50
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
PayPal Funding Components
-------------------------
[![build status][build-badge]][build]
[![code coverage][coverage-badge]][coverage]
[![npm version][version-badge]][package]
[![apache license][license-badge]][license]
[build-badge]: https://img.shields.io/github/actions/workflow/status/paypal/paypal-funding-components/main.yml?branch=main&logo=github&style=flat-square
[build]: https://github.com/paypal/paypal-funding-components/actions?query=workflow%3Abuild
[coverage-badge]: https://img.shields.io/codecov/c/github/paypal/paypal-funding-components.svg?style=flat-square
[coverage]: https://codecov.io/github/paypal/paypal-funding-components/
[version-badge]: https://img.shields.io/npm/v/@paypal/funding-components.svg?style=flat-square
[package]: https://www.npmjs.com/package/@paypal/funding-components
[license-badge]: https://img.shields.io/npm/l/@paypal/funding-components.svg?style=flat-square
[license]: https://github.com/paypal/paypal-funding-components/blob/main/LICENSE
PayPal JavaScript SDK module to deal with funding sources and eligibility.
## Remember a funding source from the client-side
Note: your client-id and domain must be approved to call this function
```javascript
paypal.rememberFunding([ paypal.FUNDING.VENMO ]);
```
## Remember a funding source from the server-side
```javascript
import { rememberFunding } from '@paypal/funding-components';
import { FUNDING } from '@paypal/sdk-constants';
rememberFunding(req, res, [ FUNDING.VENMO ]);
```
## Check a remembered funding source from the server-side
```javascript
import { isFundingRemembered } from '@paypal/funding-components';
import { FUNDING } from '@paypal/sdk-constants';
if (isFundingRemembered(req, FUNDING.VENMO)) {
// ...
}
```
Pass in a custom set of cookies:
```javascript
isFundingRemembered(req, FUNDING.VENMO, { cookies })
```
Quick Start
-----------
#### Installing
```bash
npm install --save @paypal/funding-components
```
#### Getting Started
- Fork the module
- Run setup: `npm run setup`
- Start editing code in `./src` and writing tests in `./tests`
- `npm run build`
#### Building
```bash
npm run build
```
#### Tests
- Edit tests in `./test/tests`
- Run the tests:
```bash
npm test
```