#.borjasanchez
1 messages · Page 1 of 1 (latest)
I think you want to make API calls on behalf of your connected account. Yes you can do that by
specifying a stripe_account, refer to this doc to learn more about making API request for connected account (https://stripe.com/docs/connect/authentication)
Nice!
And what about subscriptions and payments ?
I'm redirecting the money to the accounts through the checkOut
Same, as long as you specify a stripe_account
But the subscriptions and payments are created automatically
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
And when you want to get a customer or price from that particular account ? which option should I use ?
You should always add stripe_account in the request header when accessing resources (i.e., customer, price) from a connected account.
but using serve.Get, requestOptions is not valid ...
Can you share with me your code?
Can you copy and paste here?
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;
}
{
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
same error: cannot convert stripe.requestoptions to stripeCustomerGetOptions
But stripeCustomerGetOptions doesn't have Stripe_account
Are you using a old version of .NET library?
define old 🤣
Do you want to upgrade the library and try again?
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 ?
What version are you using now?
I don't see 4.7.2 in the changelog https://github.com/stripe/stripe-dotnet/blob/master/CHANGELOG.md
Stripe.net is a sync/async .NET 4.6.1+ client, and a portable class library for stripe.com. - stripe/stripe-dotnet
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.'
Yup, you should set connected account as the destination
Do i need destination =>
TransferData = new SessionPaymentIntentDataTransferDataOptions
{
Destination = accountId,
},
if I have
var requestOptions = new RequestOptions
{
IdempotencyKey = idempotencyKey,
StripeAccount = accountId
};
??
actually you don't need to set stripe_account if you are doing a destination charge