Sending headers when using the lib "stripity_stripe"

I’m trying to create a PaymentIntent using the package stripity_stripe , I need to specify the “connected user account id” which will be the receipient of the payment. To do that I need to send a Header named “Stripe-Account” and the id as value.

I’m using Standard accounts with direct payments, so I can’t use the parameter named “on_behalf_of” (it’s dedicated for indirect payments) in the lib docs :

Here is an example in the Stripe API how to send the Header :
Erstellen von Direct Charges | Stripe-Dokumentation


The PaymentIntent.create/2 function takes extra stripe options as second parameter. You can provide a keyword list with headers as key and a map as value.

The opts are passed to the new_request/2 function: stripity_stripe/request.ex at dd89df648456f97e667938bed0e18550427c6a04 · beam-community/stripity_stripe · GitHub

opts = [headers: %{"Stripe-Account" => connected_stripe_account_id}]
PaymentIntent.create(params, opts)
1 Like

@daskycodes I think we must send this header for every operation then ? confirm, cancel etc… ?

Yes, exactly!