Skip to content

Instantly share code, notes, and snippets.

@OmarKhattab
Created November 19, 2020 06:43
Show Gist options
  • Save OmarKhattab/4380dc0b83660cd009fdd1d060793e20 to your computer and use it in GitHub Desktop.
Save OmarKhattab/4380dc0b83660cd009fdd1d060793e20 to your computer and use it in GitHub Desktop.
charge customer and transfer money to connected account
const paymentMethods = await stripe.paymentMethods.list({
customer: stripeCustomerID,
type: "card",
});
const payment_method = paymentMethods.data[0].id;
const paymentIntent = await stripe.paymentIntents.create({
payment_method_types: ["card"],
amount: 1000,
customer: stripeCustomerID,
payment_method,
currency: "usd",
application_fee_amount: 123,
confirm: true,
transfer_data: {
destination: stripeConnectID,
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment