#xfechx_api

1 messages ¡ Page 1 of 1 (latest)

last sluiceBOT
#

👋 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/1374758302088691883

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

subtle lintel
#

Yeah this is expected

#

Cross border payouts are only available to US platforms

#

Since your platform is AU based, you can only do destination charges (without on_behalf_of) to AU accounts

frank arrow
#

But not sure where exactly is on_behalf_of being used, so I am trying to pinpoint the exact API error. Because the platform also after checkout has an API instruction (webhook on invoice.payment_succeded OR charge.succeded) to make a transfer to a specific connected account, not sure if that is what is causing the error, or the original source transaction with the connected account.

subtle lintel
#

on_behalf_of isn't being used. that's the issue

#

you need on_behalf_of if doing a destination charge to a country other than AU

frank arrow
#

where can I see what is been used, like which instructions are been sent to API.

subtle lintel
#

In your code

frank arrow
#

it is a 3rd party app

#

this time is not my code unfortunately

subtle lintel
#

Ah

frank arrow
#

I have developed a LOT of stripe API stuff, including connect

#

but this time, it is 3rd party, so I want to know if it is my fault or 3rd party fault

subtle lintel
#

Yeah the integration is not accounting for cross border issues

#

So it's whoever developed it

frank arrow
#

so, given this, if I wanted to patch it myself:

  "cancel_url": "https://app.somamystica.com/?bkntc_stripe_split_status=cancel&bkntc_stripe_split_session_id={CHECKOUT_SESSION_ID}&tenant_id=68",
  "line_items": {
    "0": {
      "price_data": {
        "currency": "USD",
        "product_data": {
          "images": {
            "0": "https://app.somamystica.com/wp-content/plugins/booknetic/app/Backend/Services/assets/images/no-photo.png"
          },
          "name": "Consult"
        },
        "unit_amount": "300"
      },
      "quantity": "1"
    }
  },
  "metadata": {
    "appointment_ids": "",
    "payment_id": "c9dd747b1385f180730ba776bc61984d",
    "type": ""
  },
  "mode": "payment",
  "payment_intent_data": {
    "application_fee_amount": "60",
    "transfer_data": {
      "destination": "acct_1RJW8kQYkxTHZCIU"
    }
  },
  "payment_method_types": {
    "0": "card"
  },
  "success_url": "https://app.somamystica.com/?bkntc_stripe_split_status=success&bkntc_stripe_split_session_id={CHECKOUT_SESSION_ID}&tenant_id=68"
}```
#

I would need to add on_behalf_of?

#

on the checkout session array

#

also, for me it would be best by doing a webhook, then I don't have to tamper with 3rd party code, is there a way of intercepting the checkout session BEFORE it is created, or just after it is created and modify for on_behalf_of ?

subtle lintel
#

No there's not

#

This is something that needs to be set on creation

#

You'd need to reach out to the third party to get this corrected

frank arrow
#

found this in the code:

#
    {
        try
        {
            $checkout_session = $this->_stripeClient->checkout->sessions->create([
                'payment_method_types' => ['card'],
                'line_items' => $this->_items,
                'mode' => 'payment',
                'payment_intent_data' => [
                    'application_fee_amount' => $this->_fee['fee'],
                    'transfer_data' => [
                        'destination' => $this->_fee['destination'],
                    ],
                ],
                'success_url' => $this->_successURL,
                'cancel_url' => $this->_cancelURL,
                "metadata" => ['payment_id' => $this->_paymentId ,'type'=>$this->_type,'appointment_ids'=>$this->_appointmentIds]
            ]);
        }
        catch (ApiErrorException $e)
        {
            return 0;
        }

        return $checkout_session->id;
    }```
#

what do I need to add here, to account for cross-border connected accounts

subtle lintel
#

Oh so you do have access to the code?

#

You need to add a check to check the country of the connect account

frank arrow
#

Yes, it is open source

subtle lintel
frank arrow
#

Can I just add on_behalf_of for every time no matter what account?

subtle lintel
#

You can but you should understand the impact of doing that

frank arrow
#

What would the impact be? Thanks for your help

frank arrow
#

I think it should be fine, so on_behalf_of, the connected account takes more responsibility, correct?

I am looking where do I need to add on_behalf_of, and where in the code can I see the connected account id

#

Would you be able to help me with that snippet?

subtle lintel
#

No platform still is responsible for disputes, etc

subtle lintel
#

I shared the doc

#

You just add it in payment_intent_data

frank arrow
#

What changes would I need to add, like where exactly to add the on_behalf_of

#

Ok

subtle lintel
frank arrow
#

Where in the snippet I shared, is that code using the connected account id?

subtle lintel
#

transfer_data[destination] is how you specify the connect merchant for destination charges

frank arrow
#

can you help me see if this is ok?

                    'application_fee_amount' => $this->_fee['fee'],
                    'transfer_data' => [
                        'destination' => $this->_fee['destination'],
                    ],
                    'on_behalf_of' => $this->_fee['destination'],
                ],```
subtle lintel
#

I'm not familiar with the plugin code so idk where $this->_fee['destination'] comes from

#

That's up to you to trace

#

You're passing obo correctly in payment_intent_data at least

frank arrow
#

I know, but that is how transfer_data is been passed, and it receives the same data, correct? (the connected account id)

subtle lintel
#

You should just try this out yourself to see it works

#

You're passing the param correctly