#phillips-paymentintent-destination
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- phillips-connect-express, 2 days ago, 36 messages
Hi 👋
What are you trying to do in the bigger picture?
It looks like you are attempting to create Destination charges. You can review our documentation on this subject here: https://docs.stripe.com/connect/destination-charges
Essentially, the transfer destination identifies the account you wish to share funds with.
Our platform facilitates payments between customers and contractors, with a commission (25%) being transferred to our platform's Stripe account, and the remaining amount (75%) being transferred to the contractor's bank account.
i successfully create customer
now i want to do payments and transfer to contractor 75% of his share
Okay, so the transfer_data.destination parameter value is the Account ID for the Stripe Account that represents the contractor.
I understand that the transfer_data.destination parameter is used to specify the Account ID of the Stripe Account that represents the contractor or the recipient of the funds. However, I am unsure about how the customer's payment is processed in this setup.
Given that the transfer_data.destination is the account to which funds are transferred, I am curious about how the customer's payment is linked to this process.
Did you read the document I sent you? It's pretty explicit about how this works.
How the customer's payment source is linked to the payment intent creation process.
const paymentIntent = await stripe.paymentIntents.create({
amount: 1000,
currency: 'usd',
automatic_payment_methods: {
enabled: true,
},
application_fee_amount: 250,
customer: "cus_PcGXbZcEZAsuQH",
transfer_data: {
destination: 'acct_1On8szGbABriXxNa',
},
});
Okay...this is much more fundamental that Connect. So let's take a step back.
Does that customer have a valid payment method?
I have a specific workflow that I would like to clarify. My process involves creating both a customer and a contractor account, followed by the creation of a payment intent. I am seeking to understand how these components interact within the Stripe Connect ecosystem.
Firstly, I create a customer account using the stripe.customers.create method, providing details such as name, email, phone number, address, and a source for the customer's payment method. This is done as follows:
const customer = await stripe.customers.create({
name, // name not mandatory
email, // mandatory
phone: phonenumber, // not mandatory
address: { // not mandatory
line1: primaryaddress,
line2: secondaryaddress
},
source: cusCardId // token of bank card details provided by client side
});
Next, I create a contractor account using the stripe.accounts.create method, specifying the country, type, capabilities, email, and business type. Following this, I generate an account link for the contractor to complete the onboarding process:
const account = await stripe.accounts.create({
country: 'US',
type: 'express',
capabilities: {
card_payments: {
requested: true,
},
transfers: {
requested: true,
},
},
email: 'ns265331@gmail.com',
business_type: 'individual',
});
console.log(account.id);
const accountLink = await stripe.accountLinks.create({
account: account.id,
refresh_url: 'https://example.com/reauth',
return_url: 'https://example.com/return',
type: 'account_onboarding',
});
Finally, I create a payment intent using the stripe.paymentIntents.create method, specifying the amount, currency, automatic payment methods, application fee amount, customer ID, and the destination account ID for the transfer:
const paymentIntent = await stripe.paymentIntents.create({
amount: 1000,
currency: 'usd',
automatic_payment_methods: {
enabled: true,
},
application_fee_amount: 250,
customer: "cus_PcGXbZcEZAsuQH",
transfer_data: {
destination: 'acct_1On8szGbABriXxNa',
},
});
My question pertains to the process of how the customer's payment is linked to this setup. Specifically, I am seeking clarification on:
How the customer's payment source is linked to the payment intent creation process.
If there is a specific field or method I should use to ensure that the customer's payment is correctly processed and associated with the intended transaction.
Okay that's a lot of text for what is essentially a simple question
Does the Customer have a saved Payment Method?
Or do you want to collect new payment method details?
user have the saved payment method
And you want to confirm the payment intent immediately upon creating it?
yes
Okay, great so what you want to do is include the Payment Method ID in the payment_method parameter when creating the Payment Intent
https://docs.stripe.com/api/payment_intents/create#create_payment_intent-payment_method
You will also want to set confirm=True https://docs.stripe.com/api/payment_intents/create#create_payment_intent-confirm