#daryl_code

1 messages Β· Page 1 of 1 (latest)

distant barnBOT
#

πŸ‘‹ 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/1434778022795546678

πŸ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

safe crystal
#

Hey! do give me some time to take a look at this

#

Sorry, just to clarify, is your question about how to retain a certain fee for a partcular payment method (e.g. Paynow/card)?

#

And could you clarify what you mean by destination account ?

edgy anchor
#

Hi Teddy

#

previously this is my approach:

const stripe = getStripe();
const connectedAccountId = process.env.STRIPE_CONNECTED_ACCOUNT_ID;

  if (!connectedAccountId) {
    res.status(500).json({ error: "Connected account not configured" });
    return;
  }

  const platformFee = 100; // $1.00 NET profit

  // βœ… Estimate Stripe fees (worst case: international card)
  const estimatedStripeFees = Math.round(amount * 0.039) + 50; // $0.93 for $10.90
  
  // βœ… Application fee = Platform fee + Stripe fees
  const applicationFeeAmount = platformFee + estimatedStripeFees; // $1.00 + $0.93 = $1.93

  const session = await stripe.checkout.sessions.create({
    payment_method_types: ["card", "paynow"],
    line_items: [
      {
        price_data: {
          currency,
          product_data: {
            name: promotionTitle,
            description: `Voucher for ${promotionTitle}`,
          },
          unit_amount: amount,
        },
        quantity: 1,
      },
    ],
    mode: "payment",
    success_url: successUrl,
    cancel_url: cancelUrl,

    // βœ… DESTINATION CHARGES with application fee covering Stripe fees
    payment_intent_data: {
      application_fee_amount: applicationFeeAmount, // $1.93
      transfer_data: {
        destination: connectedAccountId,
        amount: amount, // Transfer FULL $10.90 to merchant
      },
      metadata: {
        promotion_id: promotionId,
        wink_id: winkId,
        redemption_frequency: metadata?.redemption_frequency || "once",
      },
    },

    metadata: {
      promotion_id: promotionId,
      wink_id: winkId,
      redemption_frequency: metadata?.redemption_frequency || "once",
      created_at: new Date().toISOString(),
    },

    expires_at: Math.floor(Date.now() / 1000) + 30 * 60,
  });
#

where I delcare an estimatedStripeFees (the worst case scenario)

#

my question is how am I suppose to do this as Stripe always require me to fill in the transfer data first for me to make the transaction. However if I do not know what payment method customer is using first, I could not give a number to transfer to merchant (my destination account)

#

what I want to achieve is that everytime customer make a payment I keep $1.00 from the total amount. The remaining - stripe fee will be pass on to the merchant (destination account)

safe crystal
#

Ah i see, do give me some time to look into this!

edgy anchor
#

I tried doing manual transfer after a successful transaction but I got an error of insufficient available fund in your Stripe account. (But I do not think this is a smart approach as well because transferring amount will have small fees right?) Is there another approach I can look for? Don't mind if you could assist me with this problem

safe crystal
#

We have this tool called the Platform Pricing tool which helps Platform accounts who are responsible for paying Stripe fees and want to use application fees to recover payment processing costs

If your platform is responsible for paying Stripe fees, the platform pricing tool allows you to set pricing logic for all platform processing fees you charge your connected accounts.

edgy anchor
#

sorry how does this works

safe crystal
#

basically what it allows you to create pricing that has different application fees based on the properties of a transaction.

#

For e.g. you can set a certain rule for when a PayNow payment is made through the checkout session

#

How the tool looks like

edgy anchor
#

understand

#

thank you very much

safe crystal
#

Do note that if you use the paltform pricing tool, you need not specify the application_fee_amount when creating the destination charge:
https://docs.stripe.com/connect/destination-charges?platform=web&ui=stripe-hosted#collect-fees

Set your pricing rules in-house, specifying fees directly in a PaymentIntent using either the application_fee_amount or transfer_data[amount] parameter. Fees set with this method override the pricing logic specified in the Platform Pricing Tool.

edgy anchor
#

yes understand still figuring out how to use this platform pricing tool

edgy anchor
#

don't mind if u can explain how to use it. Be it the type of payment, I want to only receive $1 on my end and the remaining amount will go to the connected account (deducting the stripe fee).

#

how am I suppose to set that over here

safe crystal
#

Just to clarify, when you say :

remaining amount will go to the connected account (deducting the stripe fee).
Do you mean that the Stripe fee is charged on to the connected accounts and not the Platform account?

edgy anchor
#

yes is that possible?

safe crystal
#

So essentially, the Stripe Fee that is expected be charged be added to the application fee?

edgy anchor
#

everytime the customer make a payment I notice I receive (amount - stripe fee)

#

I am fine with either stripe fee is charge on my connected account or the platform account. As long as I received only $1 and the remaining amount goes to the connected account will do

#

remaining amount means (amount - stripe fee- $1.00(platform fee))

#

I went on to set this, but I don't see any changes. Care to let me know where I am doing it wrongly

safe crystal
#

Could you send me your Payment Intent for a recent transaction that was made?

#

It should have the prefix pi_xxxx

edgy anchor
#

ch_3SPHZ92UDTySi58h1r0uUpBx

#

pi_3SPHZ92UDTySi58h1TCMKVVt

#

I tired testing this :

Calculating fees failed Transaction pi_3SPHZ92UDTySi58h1TCMKVVt is invalid.

safe crystal
#

For Card Payments you have to select the condition as Card

edgy anchor
#

pi_3SPHMX2UDTySi58h0W2AAsuc

#

sorry I send u the paynow one now

edgy anchor
#

hi u thr

safe crystal
#

Hello! Apologies was answering other threads

#

I noticed that this wasnt a Destination Charge

#

Could you try it on a destiantion charge?

edgy anchor
#

sorry what do u mean try it on destination charges.

i have this part of the code, am I suppose to fill in the charges here?

payment_intent_data: {
transfer_data: {
destination: connectedAccountId,
// βœ… Leave amount blank - let Platform Pricing Tool handle fees!
// The amount merchant receives = customer paid - platform pricing fees
},
},

distant barnBOT
edgy anchor
#

hi anyone could assist me with this

clear cloak
#

πŸ‘‹ Hi there, I'm taking over for my colleague. Let me catch up

edgy anchor
#

ok please do thanks I am having a big trouble

clear cloak
#

The Payment Intent you shared (pi_3SPHMX2UDTySi58h0W2AAsuc) was created from a Checkout Session, but it was not a Connect charge… there was no Stripe-Header or transfer_data.destination included when creating the Checkout Session

edgy anchor
#

payment_intent_data: {
transfer_data: {
destination: connectedAccountId,
// βœ… Leave amount blank - let Platform Pricing Tool handle fees!
// The amount merchant receives = customer paid - platform pricing fees
},
},

Including this will have transfer_data.destination right

clear cloak
#

When creating a Checkout Session, yes

edgy anchor
#

ok let me try again however, is this rules enough for my requirement (I stated earlier before)

clear cloak
#

You can use that page to test against various scenarios

#

You can also use the "Card border" rule to check for domestic vs international cards

edgy anchor
#

can I check with u why is the paynow transaction fee 0.15SGD

#

1.3% of 10.9 is 0.14sgd

clear cloak
#

It says that the payment processing fee is 0.14 SGD and you pay tax on that, which is 0.01 SGD = 0.15 SGD

edgy anchor
#

so when would the tax occur?

#

because I am trying to reverse engineer it

#

by calculating the stripe processing fee + 1 each time they use paynow

#

Paynow stripe processing fee is 1.3% so when would this tax comes in?

clear cloak
#

This is calculated at the same time as the Stripe fee. You can see it for the payment above in this Balance Transaction, for example: txn_3SPJAS2UDTySi58h1N10yzuH

edgy anchor
#

sorry I dont see any numbers does it mean it uses Singapore 9% GST?

clear cloak
distant barnBOT
edgy anchor
#

ok thanks but GST does not apply to Cards?

hallow raven
#

hey there πŸ‘‹ taking over for my colleague

#

to confirm, are you asking about whether this fee should have been exempt from GST in Singapore?

edgy anchor
#

because when making paynow payments there is tax

#

but when using card payment I don't see tax

#

is card payment exempted from GST in Singapore?

hallow raven
#

yes, checking internally I can confirm that card processing fees are exempted from GST, but Stripe does charge GST on PayNow processing fees

edgy anchor
#

thank you so much