Skip to content

Commit

Permalink
addStripeCreatePayoutForConnectedAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelbrui committed Mar 12, 2024
1 parent 4b16d60 commit 7af169d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/integrations/gei-bookings/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gei-bookings",
"version": "0.1.0",
"version": "0.1.1",
"description": "Automatically generated by graphql-editor-cli",
"main": "lib/index.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import Stripe from 'stripe';
import { resolverFor } from '../zeus/index.js';
import { FieldResolveInput } from 'stucco-js';

const stripe = new Stripe('YOUR_STRIPE_SECRET_KEY', {
apiVersion: '2020-08-27',
});

export const createPayoutForConnectedAccount = async (input: FieldResolveInput) =>
resolverFor(
'Mutation',
'createPayoutForConnectedAccount',
async ({ payload: { accountId, amount, currency} }) => {
try {
const payout = await stripe.payouts.create({
amount,
currency,
stripe_account: accountId,
});

if (payout) {
return true;
} else {
return false;
}
} catch (error) {
throw new Error('Error creating payout:' + JSON.stringify(error));
}

})(input.arguments, input.source)


0 comments on commit 7af169d

Please sign in to comment.