#.borjasanchez

1 messages · Page 1 of 1 (latest)

proven waspBOT
main garnet
upper adder
#

Nice!

#

And what about subscriptions and payments ?

#

I'm redirecting the money to the accounts through the checkOut

main garnet
#

Same, as long as you specify a stripe_account

upper adder
#

But the subscriptions and payments are created automatically

main garnet
#

What do you mean?

#

Ah you mean the subscriptions were created by checkout sessions?

upper adder
#

yes, I do not create them

#

is the checkout who is doing it for me

main garnet
#

Yup, you can also specify a stripe_account when creating a checkout session, and checkout session would create subscriptions or payments on the connected account accordingly

upper adder
#

And when you want to get a customer or price from that particular account ? which option should I use ?

main garnet
#

You should always add stripe_account in the request header when accessing resources (i.e., customer, price) from a connected account.

upper adder
#

but using serve.Get, requestOptions is not valid ...

main garnet
#

Can you share with me your code?

upper adder
main garnet
#

Can you copy and paste here?

upper adder
#

public Customer GetStripeCustomerByIdNoMap(string id)
{

        var accountId = "acct_1NnPnuGbu6PdCzTw";

        if (id == null)
            return null;

        var requestOptions = new RequestOptions();
        requestOptions.StripeAccount = accountId;


        var service = new CustomerService();
        var response = service.Get(id, requestOptions);

        if (response == null)
            return null;

        var customer = _bLStripeCustomer.GetStripeCustomerById(response.Id);
        if (customer == null)
            return null;

        return response;
    }
main garnet
#
{
  StripeAccount = "acct_1N7qUrDJQpCnZQUV"
};
var service = new CustomerService();
Customer customer = service.Get(
  "cu_XXX",
  options
);```

Can you try the example code from the API reference https://stripe.com/docs/api/connected_accounts#connected_accounts
upper adder
#

same error: cannot convert stripe.requestoptions to stripeCustomerGetOptions

#

But stripeCustomerGetOptions doesn't have Stripe_account

main garnet
#

Are you using a old version of .NET library?

upper adder
#

define old 🤣

main garnet
#

Do you want to upgrade the library and try again?

upper adder
#

I can't update my .Net version ...

#

public Customer GetStripeCustomerByIdNoMap(string id)
{

        var accountId = "acct_1NnPnuGbu6PdCzTw";

        if (id == null)
            return null;

        var service = new CustomerService();
        var options = new CustomerGetOptions
        {
        };
        var requestOptions = new RequestOptions
        {
            StripeAccount = accountId
        };
        var response = service.Get(id, options, requestOptions);

        if (response == null)
            return null;

        var customer = _bLStripeCustomer.GetStripeCustomerById(response.Id);
        if (customer == null)
            return null;

        return response;
    }
#

May be this could work ?

main garnet
#

What version are you using now?

upper adder
#

4.7.2

#

framework

main garnet
upper adder
#

its works ... but the checkout throw me this alert:

Stripe.StripeException: 'The 'subscription_data[transfer_data][destination]' param cannot be set to your own account.'

main garnet
#

Yup, you should set connected account as the destination

upper adder
#

Do i need destination =>
TransferData = new SessionPaymentIntentDataTransferDataOptions
{
Destination = accountId,
},

if I have
var requestOptions = new RequestOptions
{
IdempotencyKey = idempotencyKey,
StripeAccount = accountId
};

#

??

main garnet
#

actually you don't need to set stripe_account if you are doing a destination charge

upper adder
#

If I don't the method won't find the customer

#

let me check the other way around

#

no destination

#

is with no destination

#

🙂

#

solved !