#norparn_connect-payment
1 messages ยท Page 1 of 1 (latest)
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.
- norparn_code, 8 minutes ago, 16 messages
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1241022520522571826
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Can you share the Payment Intent ID? Doesn't look like you're actually confirming and capturing the Payment Intent, but I can check
{
id: 'pi_3PHQrjHaVaCK9Atm1WbIFzjw',
object: 'payment_intent',
amount: 10000,
amount_capturable: 0,
amount_details: { tip: {} },
amount_received: 0,
application: null,
application_fee_amount: null,
automatic_payment_methods: { allow_redirects: 'always', enabled: true },
canceled_at: null,
cancellation_reason: null,
capture_method: 'automatic',
client_secret: 'pi_3PHQrjHaVaCK9Atm1WbIFzjw_secret_Uo7tU8yVGuRtkopuNLHB59YMl',
confirmation_method: 'automatic',
created: 1715952631,
currency: 'sek',
customer: 'cus_Q7dFQKys73d9xn',
description: null,
invoice: null,
last_payment_error: null,
latest_charge: null,
livemode: false,
metadata: {
insurance: 'false',
partyId: 'ad7059ee-4f37-4355-8835-92336b0e6c70',
userId: 'b0259a61-c030-4d90-9175-073f545d6331'
},
next_action: null,
on_behalf_of: null,
payment_method: null,
payment_method_configuration_details: { id: 'pmc_1OtGXJHaVaCK9AtmMFEyJKtc', parent: null },
payment_method_options: {
card: {
installments: null,
mandate_options: null,
network: null,
request_three_d_secure: 'automatic'
},
swish: { reference: null }
},
payment_method_types: [ 'card', 'swish' ],
processing: null,
receipt_email: null,
review: null,
setup_future_usage: null,
shipping: null,
source: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: 'requires_payment_method',
transfer_data: { amount: 10000, destination: 'acct_1P41LLHDEsACIOV6' },
transfer_group: null
}
Yeah see its status
requires_payment_method
You need to provide a payment method and the confirm and capture the payment intent for it to be charged
aaah i see, i will try that
Hi again can you help me with another problem, got it working so that i get the latest_charge parameter.
I have an app in which is created for a "main" client, in this app users can register as hosts which can create events in which "normal" users can buy tickets to. I want to set up so that if the ticket price 100, 10% of that should go the "main" client and the rest to the host. How do i do that?
Yea i've read the documentation for collecting fees, https://docs.stripe.com/connect/separate-charges-and-transfers?platform=react-native#collect-fees
And this is my current code
const paymentIntent = await this.stripe.paymentIntents.create({
amount: totalAmount,
currency: 'sek',
customer: stripeCustomerId,
transfer_data: {
destination: company.stripeAccountId,
amount: party.priceSEK * 100,
},
payment_method: body.paymentMethod.id,
automatic_payment_methods: { enabled: true },
metadata: {
partyId: party.partyId,
userId: user.userId,
insurance: body.hasInsurance.toString(),
},
});
const confirmedIntent = await this.stripe.paymentIntents.confirm(
paymentIntent.id,
{
payment_method: body.paymentMethod.type,
return_url: ${this.redirectURLPrefix}/hosthome/${company.companyId},
},
);
console.log('paymentIntent', confirmedIntent);
if (paymentIntent.lastResponse.statusCode == 200) {
const fee_transfer = await this.stripe.transfers.create({
amount: totalAmount * 0.1,
currency: 'sek',
destination: '...',
source_transaction: confirmedIntent.latest_charge as string,
});
console.log('fee transfer', fee_transfer);
}
Should the destination in the transfer be "hardcoded" since it will allways be the same?
So you're mixing up two flows here
Passing transfer_data will automatically create the transfer
If you do that then you don't need to call await this.stripe.transfers.create({
This is the transfer_data flow: https://docs.stripe.com/connect/destination-charges
Okey but how do i split it up so that 10% goes to the "main" client and the rest goes to the host?
Hi there ๐ jumping in as my teammate needs to step away soon. Your code already seems to be doing that, sort of.
You're specifying transfer_data when creating the Payment Intent, so you're performing a destination charge:
https://docs.stripe.com/connect/destination-charges
which will automatically create a Transfer when the payment has completed. If you only want to transfer a portion of the funds from the payment, then you'll adjust the amount you specify in the transfer_data.amount parameter.
If you want to create a Transfer separately, that is a Separate Charges and Transfers flow which we walk through here:
https://docs.stripe.com/connect/separate-charges-and-transfers
Okey, so first a create a paymentintent from the customer to the host, then i create a transfer from the host to the client?
Depends on what you want the flow to be.
It sounds like you may still be scoping how you want to build your flow, in which case I'd recommend looking at the three different charge patterns we offer for Connect payments:
https://docs.stripe.com/connect/charges
Start by selecting the flow that matches the look/feel that you're going for, then worry about exactly to implement it. For implementation, each charge type has a link to the guide that walks through how to build that flow for various integration paths.