#zero-connect-destination

1 messages · Page 1 of 1 (latest)

dark owlBOT
#

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.

wicked belfry
#

zero-connect-destination

#

@hot nebula you are a platform acct_A and you have a connected account acct_B. You need to set the acct_B as the on_behalf_of.

#

you're likely incorrectly passing your own id acct_A in one of those parameters by mistake (or a null value)

hot nebula
#

I just doubled checked and confirmed I am passing the acc of the person I am trying to pay in the behalf of field 🤔

#

code

  getTipClientSecret: protectedProcedure
    .input(
      z.object({
        price: z.number(),
        customerId: z.string(),
        connectAccountId: z.string(),
        creatorId: z.string(),
      }),
    )
    .query(async ({ ctx, input }) => {
      try {
        const { price, customerId, connectAccountId, creatorId } = input;

        const paymentIntent = await stripe.paymentIntents.create({
          customer: customerId,
          setup_future_usage: "off_session",
          amount: price * 100,
          currency: "usd",
          automatic_payment_methods: {
            enabled: true,
          },
          application_fee_amount: Math.round(price * 100 * 0.19),
          on_behalf_of: connectAccountId,
          metadata: {
            paymentType: PaymentType.TIP,
            senderId: ctx.auth.userId,
            recieverId: creatorId,
          },
        });

        return {
          clientSecret: paymentIntent.client_secret,
        };
      } catch (error: any) {
        throw new TRPCError({
          code: "INTERNAL_SERVER_ERROR",
          message: error,
        });
      }
    }),
wicked belfry
#

you're missing transfer_data though

#

you need both on_behalf_of and transfer_data

hot nebula
#

kek