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
Expand Up @@ -2,15 +2,18 @@ import app from "../../stripe.app.mjs";

export default {
key: "stripe-cancel-or-reverse-payout",
name: "Cancel Or Reverse a Payout",
name: "Cancel Or Reverse A Payout",
type: "action",
version: "0.1.1",
description: "Cancel or reverse a [payout](https://stripe.com/docs/payouts). " +
"A payout can be canceled only if it has not yet been paid out. A payout can be reversed " +
"only if it has already been paid out. Funds will be refunded to your available balance. [See" +
" the docs](https://stripe.com/docs/api/payouts/cancel) for more information",
version: "0.1.2",
description: "Cancel a pending payout or reverse a paid payout. [See the documentation here](https://docs.stripe.com/api/payouts/cancel) and [here](https://docs.stripe.com/api/payouts/reverse)",
props: {
app,
// eslint-disable-next-line pipedream/props-label, pipedream/props-description
alert: {
type: "alert",
alertType: "info",
content: "A payout can be canceled only if it has not yet been paid out. A payout can be reversed only if it has already been paid out. Funds will be refunded to your available balance. [See the documentation](https://stripe.com/docs/api/payouts/cancel).",
},
id: {
propDefinition: [
app,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,43 @@
import pick from "lodash.pick";
import app from "../../stripe.app.mjs";

export default {
key: "stripe-cancel-payment-intent",
name: "Cancel a Payment Intent",
name: "Cancel A Payment Intent",
type: "action",
version: "0.1.1",
description: "Cancel a [payment intent](https://stripe.com/docs/payments/payment-intents). " +
"Once canceled, no additional charges will be made by the payment intent and any operations " +
"on the payment intent will fail with an error. For payment intents with status=" +
"`requires_capture`, the remaining amount_capturable will automatically be refunded. [See the" +
" docs](https://stripe.com/docs/api/payment_intents/cancel) for more information",
version: "0.1.2",
description: "Cancel a PaymentIntent. [See the documentation](https://stripe.com/docs/payments/payment-intents).",
props: {
app,
// eslint-disable-next-line pipedream/props-label, pipedream/props-description
alert: {
type: "alert",
alertType: "info",
content: "Once canceled, no additional charges will be made by the payment intent and any operations on the payment intent will fail with an error. For payment intents with `status=requires_capture`, the remaining amount_capturable will automatically be refunded. [See the documentation](https://stripe.com/docs/api/payment_intents/cancel).",
},
id: {
propDefinition: [
app,
"payment_intent",
"paymentIntent",
],
optional: false,
},
cancellation_reason: {
cancellationReason: {
propDefinition: [
app,
"payment_intent_cancellation_reason",
"paymentIntentCancellationReason",
],
},
},
async run({ $ }) {
const params = pick(this, [
"cancellation_reason",
]);
const resp = await this.app.sdk().paymentIntents.cancel(this.id, params);
const {
app,
id,
cancellationReason,
} = this;

const resp = await app.sdk().paymentIntents.cancel(id, {
cancellation_reason: cancellationReason,
});
$.export("$summary", "Successfully cancelled payment intent");
return resp;
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,51 +1,97 @@
import pick from "lodash.pick";
import app from "../../stripe.app.mjs";

export default {
key: "stripe-capture-payment-intent",
name: "Capture a Payment Intent",
type: "action",
version: "0.1.1",
description: "Capture the funds of an existing uncaptured payment intent. [See the " +
"docs](https://stripe.com/docs/api/payment_intents/capture) for more information",
version: "0.1.2",
description: "Capture the funds of an existing uncaptured payment intent. [See the documentation](https://stripe.com/docs/api/payment_intents/capture).",
props: {
app,
// eslint-disable-next-line pipedream/props-label, pipedream/props-description
alert: {
type: "alert",
alertType: "info",
content: "Use this Pipedream component to capture funds from an existing PaymentIntent if its status is `requires_capture`. Be aware that uncaptured PaymentIntents will automatically cancel after a certain period (typically 7 days), so ensure timely capture. This process is part of a separate authorization and capture flow for payments. [See the documentation](https://stripe.com/docs/api/payment_intents/capture).",
},
id: {
propDefinition: [
app,
"payment_intent",
"paymentIntent",
],
optional: false,
},
amount_to_capture: {
amountToCapture: {
description: "The amount to capture from the PaymentIntent, which must be less than or equal to the original amount. Defaults to the full `amount_capturable` if it's not provided.",
propDefinition: [
app,
"amount",
],
description: "The amount to capture, which must be less than or equal to the original " +
"amount. Any additional amount will be automatically refunded. Defaults to the full " +
"`amount_capturable` if not provided.",
},
advanced: {
metadata: {
propDefinition: [
app,
"metadata",
],
label: "Advanced Options",
description: "Specify less-common options that you require. See [Capture a PaymentIntent]" +
"(https://stripe.com/docs/api/payment_intents/capture) for a list of supported options.",
},
applicationFeeAmount: {
type: "integer",
label: "Application Fee Amount",
description: "The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner’s Stripe account. The amount of the application fee collected will be capped at the total amount captured. For more information, see the PaymentIntents use case for connected accounts.",
optional: true,
},
finalCapture: {
type: "boolean",
label: "Final Capture",
description: "When capturing a PaymentIntent, setting final_capture to false notifies Stripe to not release the remaining uncaptured funds to make sure that they're captured in future requests. You can only use this setting when multicapture is available for PaymentIntents.",
optional: true,
},
statementDescriptor: {
propDefinition: [
app,
"statementDescriptor",
],
},
statementDescriptorSuffix: {
type: "string",
label: "Statement Descriptor Suffix",
description: "Provides information about a card charge. Concatenated to the account’s statement descriptor prefix to form the complete statement descriptor that appears on the customer’s statement.",
optional: true,
},
transferDataAmount: {
type: "integer",
label: "Transfer Data Amount",
description: "The amount that will be transferred automatically when a charge succeeds.",
optional: true,
},
},
async run({ $ }) {
const params = pick(this, [
"amount_to_capture",
]);
const resp = await this.app.sdk().paymentIntents.capture(this.id, {
...params,
...this.advanced,
const {
id,
amountToCapture,
metadata,
applicationFeeAmount,
finalCapture,
statementDescriptor,
statementDescriptorSuffix,
transferDataAmount,
} = this;

const resp = await this.app.sdk().paymentIntents.capture(id, {
amount_to_capture: amountToCapture,
metadata,
application_fee_amount: applicationFeeAmount,
final_capture: finalCapture,
statement_descriptor: statementDescriptor,
statement_descriptor_suffix: statementDescriptorSuffix,
...(transferDataAmount && {
transfer_data: {
amount: transferDataAmount,
},
}),
});
$.export("$summary", `Successfully captured ${params.amount_to_capture
? params.amount_to_capture
$.export("$summary", `Successfully captured ${amountToCapture
? amountToCapture
: `the full ${resp.amount_capturable}`} from the payment intent`);
return resp;
},
Expand Down
Loading
Loading