Marketplace
>
listUserPayments
rainbow

listUserPayments

v
0.0.2
Latest Version
Likes
0
4
Installations
0
1
Views
0
1

Overview

Get the list of user payments.

Usage

### How this function works This HTTPS function resolves the payments made by the authenticated user via Stripe, returning an object according to Stripe paginated response, which contains an array field `data` with the user payments. Each payment is a charge type object according to Stripe API documentation. ### Requirements * You must have previous knowledge of **Firebase**. * You must have previous knowledge of **Firestore**. * You must have previous knowledge of **Stripe**. ### Function details This function resolves the Stripe customer from a Firestore collection, asuming the ID of each document is the Firebase user ID (i.e. `STRIPE_CUSTOMERS_COLLECTION_PATH/{uid}`), and the saved document is a Stripe customer object (See https://stripe.com/docs/api/customers/object). Once the customer is obtained, it is used to retrieve the Stripe payment list. To install this function you need to enter the values of the following variables: * **STRIPE_SECRET_KEY**: Your Stripe secret API key. See [https://stripe.com/docs/keys](https://stripe.com/docs/keys). * **STRIPE_CUSTOMERS_COLLECTION_PATH**: The collection path where the Stripe customers are stored. When calling this function you can pass the following parameters for pagination purposes: * limit * starting_after * ending_before For more information about the Stripe pagination, see: https://stripe.com/docs/api/pagination#pagination. Here is an example of how to call this function from your app with JavaScript: ```js // assuming `firebase` is an initialized Firebase app const listUserPayments = firebase.functions().httpsCallable('listUserPayments'); const payments = await listUserPayments({ limit: 10, starting_after: "cus_AJ6bY3VqcaLAEs" }); // payments.data is the array of payments ```
Cost
FREE
Cost
Version
0.0.2
Language
JAVASCRIPT
Created At
Updated At
Workspace
rainbow
Tags
billing
stripe
payment
© 2022 Function Store