You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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/apikeysstripe.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 clientletmut headers = stripe::Headers::default();
headers.stripe_account = Some( account.id.to_string());let client = client.with_headers(headers);// Then, all requests can be made normallyletmut 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 :
#[derive(Serialize)]structCreatePerson{pubperson_token:String,}#[derive(Deserialize,Debug)]structCreatePersonResponse{id:String,account:String,}fnattach_person(client:&stripe::Client,account_id:String,person_id:String) -> stripe::Response<CreatePersonResponse>{
client.post_form(&format!("accounts/{}/persons",account_id),CreatePerson{person_token: person_id })}
...
let person = attach_person(&client, account.id.to_string(),"cpt_1HwxXsHMKCJ5sXRrcJBuH0UF".into());
...
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: