Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import stripe from "../../stripe.app.mjs";

export default {
key: "stripe-cancel-subscription",
name: "Cancel Subscription",
description: "Cancel a subscription. [See the documentation](https://docs.stripe.com/api/subscriptions/cancel?lang=node)",
version: "0.0.1",
type: "action",
props: {
stripe,
subscriptionId: {
propDefinition: [
stripe,
"subscription",
],
},
},
async run({ $ }) {
const response = await this.stripe.sdk().subscriptions.cancel(this.subscriptionId);

$.export("$summary", `Cancelled subscription ${this.subscriptionId}`);

return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import stripe from "../../stripe.app.mjs";

export default {
key: "stripe-search-subscriptions",
name: "Search Subscriptions",
description: "Search for subscriptions. [See the documentation](https://docs.stripe.com/api/subscriptions/search?lang=node)",
version: "0.0.1",
type: "action",
props: {
stripe,
query: {
type: "string",
label: "Query",
description: "The search query string. See [search query language](https://docs.stripe.com/search#search-query-language) and the list of supported [query fields for subscriptions](https://docs.stripe.com/search#query-fields-for-subscriptions).",
},
maxResults: {
type: "integer",
label: "Max Results",
description: "The maximum number of results to return",
default: 100,
optional: true,
},
},
async run({ $ }) {
const params = {
query: this.query,
limit: 100,
};
let hasMore, count = 0;

const results = [];
do {
const response = await this.stripe.sdk().subscriptions.search(params);
if (!response?.data?.length) {
break;
}
for (const subscription of response.data) {
results.push(subscription);
count++;
if (count >= this.maxResults) {
break;
}
}
hasMore = response.has_more;
params.page = response.next_page;
} while (hasMore && count < this.maxResults);

$.export("$summary", `Retrieved ${results.length} subscriptions`);

return results;
},
};
2 changes: 1 addition & 1 deletion components/stripe/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/stripe",
"version": "0.7.2",
"version": "0.8.0",
"description": "Pipedream Stripe Components",
"main": "stripe.app.mjs",
"keywords": [
Expand Down
19 changes: 5 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading