@appstitch/google-calendar
Version:
App Stitch Google Calendar API
78 lines (52 loc) • 1.51 kB
Markdown
# AppStitch Stripe
A flexible convenience wrapper for Stripe's API
# Install
```
npm install @appstitch/stripe
```
Install Peer Dependancies [AppStitch Core](https://www.npmjs.com/package/@appstitch/core) and [AppStitch Types](https://www.npmjs.com/package/@appstitch/types)
```
npm install @appstitch/core
npm install @appstitch/types
```
---
# Usage
Initialize Appstitch in your root file
```
import appStitch from "@appstitch/core";
appStitch.initialize({ appStitchKey:your_stitch_key"});
```
## Create a Stripe Charge
```
import { createCharge } from "@appstitch/stripe";
const createACharge = (chargeOptions) => {
const {currency,amount } = chargeOptions;
createCharge({currency,amount }).then(result => {
if(result.object === "charge")
{
// Success
}
})
}
```
## List Stripe Charges
```
import { listCharges } from "@appstitch/stripe";
const listCharges = ({
starting_after,
ending_before,
limit,
autoPaginate
}) => {
listCharges({starting_after, ending_before, limit, autoPaginate})
.then(result => {
if(result.object === "list")
{
// Success
}
})
}
```
**NOTE** Using autoPaginate will fetch all results. It will be slow so only use if it is absolutely necessary!
Reference [Stripe's Docs](https://stripe.com/docs/api?lang=node) and [AppStitch Types](https://www.npmjs.com/package/@appstitch/types) to find out the attributes for each object/resource
###