// Create a connected account
let mut params = stripe::CreateAccount::new();
params.type_ = Some(stripe::AccountType::Custom);
params.requested_capabilities = Some (
vec![
stripe::RequestedCapability::CardPayments,
stripe::RequestedCapability::Transfers,
]
);
params.country = Some("FR");
params.account_token = Some("ct_1Hwl4gHMKCJ5sXRrmJvYNJTQ");
let account = stripe::Account::create(&client, params).unwrap();
println!( "Create Account :\n\n{:#?}\n\n", account );
But I'm blocked with the person part.
The account have a individual part, should use that ?
In the stripe doc, the Go implementation use PersonParams to achieve that, we have PersonParams in this lib, should use that ?
Go example :
// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
stripe.Key = "sk_test_nkieGSlT2YjYFPw"
token := r.FormValue("token-person")
params := &stripe.PersonParams{
Account: stripe.String("{{CONNECTED_ACCOUNT_ID}}"), // id of the account created earlier,
PersonToken: stripe.String(token),
}
per, _ := person.New(params)
So I have try.
I have understand how to impersonate an account, with the header. But the PersonParams seems differents from go version, I don't know what to provide for metadata :
// ----------------------------------------------------------------------------------
// impersonate the client
let mut headers = stripe::Headers::default();
headers.stripe_account = Some( account.id.to_string() );
let client = client.with_headers(headers);
// Then, all requests can be made normally
let mut params = stripe::PersonParams {
metadata : stripe::Metadata
}
Pretty certain I'm simply going down the wrong path, so in short, any example would be highly appreciated. Or maybe the feature is missing ? I was initially searching for a CreatePerson struct.
Thanks.
After some pain, I have figure how to send custom request to stripe, see my implementation :
It's little dirty, but it's work. Accordingly to the code base, I imagine we should add a person_ext.rs file in resource to implement this properly. I will see if I can write something like that, It seems complicated at first glance.
Hi guys !
I follow this guide to create connected account : https://stripe.com/docs/connect/account-tokens (i'm french, must use account_id method) and it show the use of create person. I've been trying for a while now to create a person (https://stripe.com/docs/api/persons/create). I just don't understand how to do this, I'm just starting stripe;
I use this code to create account :
But I'm blocked with the person part. The account have a individual part, should use that ? In the stripe doc, the Go implementation use PersonParams to achieve that, we have PersonParams in this lib, should use that ? Go example :
So I have try. I have understand how to impersonate an account, with the header. But the PersonParams seems differents from go version, I don't know what to provide for metadata :
Pretty certain I'm simply going down the wrong path, so in short, any example would be highly appreciated. Or maybe the feature is missing ? I was initially searching for a CreatePerson struct.
Thanks.
After some pain, I have figure how to send custom request to stripe, see my implementation :
It's little dirty, but it's work. Accordingly to the code base, I imagine we should add a person_ext.rs file in resource to implement this properly. I will see if I can write something like that, It seems complicated at first glance.