Skip to content

Instantly share code, notes, and snippets.

@hanakslr
Last active July 16, 2020 21:12
Show Gist options
  • Save hanakslr/7c6a4978084f71f029a68b215797a7b1 to your computer and use it in GitHub Desktop.
Save hanakslr/7c6a4978084f71f029a68b215797a7b1 to your computer and use it in GitHub Desktop.
GraphQL mutation for creating a Stripe customer
const resolvers = {
Mutation: {
createStripeCustomer: async (_parent, args, context) => {
const stripe = Stripe(context.headers.stripe_api_key);
const customer = await stripe.customers.create({
name: args.name,
email: args.email,
});
return { stripe_cust_id: customer.id };
},
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment