Skip to content
Open
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
113 changes: 112 additions & 1 deletion ww-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,37 @@ export default {
!!cancelPage
);
},
copilot: {
description: "Create a Stripe checkout session and redirect to the payment page",
returns: "void - Redirects to Stripe checkout page",
schema: {
mode: {
type: "string",
description: "Payment mode (payment or subscription)",
bindable: true
},
prices: {
type: "array",
description: "Array of price objects with price IDs and quantities",
bindable: true
},
paymentMethods: {
type: "array",
description: "Allowed payment methods",
bindable: true
},
successPage: {
type: "string",
description: "Page ID to redirect after successful payment",
bindable: true
},
cancelPage: {
type: "string",
description: "Page ID to redirect if payment is cancelled",
bindable: true
}
}
},
/* wwEditor:end */
},
{
Expand All @@ -45,6 +76,22 @@ export default {
getIsValid({ customerId, cancelPage }) {
return !!customerId && !!cancelPage;
},
copilot: {
description: "Create and redirect to Stripe customer portal session",
returns: "void - Redirects to customer portal",
schema: {
customerId: {
type: "string",
description: "Stripe customer ID",
bindable: true
},
cancelPage: {
type: "string",
description: "Page ID to redirect when leaving portal",
bindable: true
}
}
},
/* wwEditor:end */
},
{
Expand All @@ -61,6 +108,27 @@ export default {
((!!prices.length && !!prices.every(({ price }) => !!price)) || prices.__wwtype !== undefined)
);
},
copilot: {
description: "Create a new Stripe payment intent",
returns: "Payment intent object",
schema: {
prices: {
type: "array",
description: "Array of price objects with price IDs and quantities",
bindable: true
},
customerId: {
type: "string",
description: "Optional Stripe customer ID",
bindable: true
},
paymentMethods: {
type: "array",
description: "Allowed payment methods",
bindable: true
}
}
},
/* wwEditor:end */
},
{
Expand All @@ -72,6 +140,17 @@ export default {
getIsValid({ clientSecret }) {
return !!clientSecret;
},
copilot: {
description: "Retrieve an existing payment intent by client secret",
returns: "Payment intent object",
schema: {
clientSecret: {
type: "string",
description: "Client secret of the payment intent",
bindable: true
}
}
},
/* wwEditor:end */
},
{
Expand All @@ -83,6 +162,22 @@ export default {
getIsValid({ elementId, redirectPage }) {
return !!elementId && !!redirectPage;
},
copilot: {
description: "Confirm a payment using Stripe Elements",
returns: "void - Redirects to result page",
schema: {
elementId: {
type: "string",
description: "ID of the Stripe payment element",
bindable: true
},
redirectPage: {
type: "string",
description: "Page ID to redirect after confirmation",
bindable: true
}
}
},
/* wwEditor:end */
},
{
Expand All @@ -94,7 +189,23 @@ export default {
getIsValid({ clientSecret, elementId }) {
return !!clientSecret && !!elementId;
},
copilot: {
description: "Confirm a card payment using Stripe Elements",
returns: "Payment intent object",
schema: {
clientSecret: {
type: "string",
description: "Client secret of the payment intent",
bindable: true
},
elementId: {
type: "string",
description: "ID of the Stripe card element",
bindable: true
}
}
},
/* wwEditor:end */
},
],
};
};