#theraihan
1 messages · Page 1 of 1 (latest)
Can you share an example API request you make to create Accounts and/or Account Links
sure
@api_view(['GET'])
@permission_classes([IsAuthenticated])
def stripe_account_link(request):
"""summary
It will return an url which will be used in the frontend to redirect the user to that url for completing the onboarding process of stripe connected accounts.
Returns:
{
"object": "account_link",
"created": 1680577733,
"expires_at": 1680578033,
"url": "https://connect.stripe.com/setup/c/acct_1Mt0CORHFI4mz9Rw/TqckGNUHg2mG"
}
"""
vendor = Vendor.objects.filter(user = request.user).first()
if vendor is None:
return Response({"error": "You are not vendor"})
stripe.api_key = STRIPE_API_KEY
if vendor.stripe_id is None:
try:
response = stripe.Account.create(
type="custom",
country=str(vendor.country),
email=str(vendor.email),
capabilities={
"card_payments": {"requested": True},
"transfers": {"requested": True},
},
)
vendor.stripe_id = response.id
vendor.save()
except Exception as e:
return Response({"error": f"{e}"})
if vendor.stripe_onboarding is False:
try:
response = stripe.AccountLink.create(
account= vendor.stripe_id,
refresh_url="https://vendors.pinksurfing.com/reauth", # if link expires or visited. this url may be the url where he can click to start the onboarding again.
return_url="https://vendors.pinksurfing.com/", # after complition of onboarding process
type="account_onboarding",
)
return Response(response)
except Exception as e:
print(e)
return Response({"error": f"{e}"})
else:
This is an example python refrence
I suspect it's because you're passing the country parameter
And the value is likely US?
Which if true, means that the user can't change country during onboarding UI
No vendor.country variable means that it’ll pass the vendors country
Suppose Canada, India…
So should i remove it
What specificvally do you mean by ' stripe onboarding the default currency is set to USA'? Can you share a screenshot?
Then would i get option to change my country to whatever i want?
Actually im creating a multivendor ecommerce so im using stripe onboarding to onboard vendors to my platform
Sure
See even though my country is India then also United States is default
acct_1Mt0CORHFI4mz9Rw is a US account
But if im onboarding then it should select my country right?
So how can i do onboarding sitting in India?
Or any other country
Well you should be using test data for onboarding from here anyway, not actual data: https://stripe.com/docs/connect/testing
But otherwise, if you create a US account you need to provide US addresses as there needs to be a legal entity for the company located in the US
Then after testing should switch to production?
What about my main account is in the US and im using stripe connect to create an onboarding account in India or Canada?
Then the same applies, but for those other countries. Whatever country you pass when creating the account you need to onboard with an address there
And would i be able to change the home address?
I don't understand the question