Last active
July 16, 2020 21:12
-
-
Save hanakslr/7c6a4978084f71f029a68b215797a7b1 to your computer and use it in GitHub Desktop.
GraphQL mutation for creating a Stripe customer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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