In order to create a charge, you must first create the customer to whom it will belong. You must use the ID returned in this request when creating the charge.
If you send the customer's postalCode
, it is not necessary to send the city
, province
and address
attributes, as Asaas will fill in this information automatically based on the zip code you entered. In these cases, simply send postalCode
and addressNumber
.
The city
field returns an identifier. If you want to obtain the name and other information about the city, you must make the following request using this identifier:
GET https://api.asaas.com/v3/cities/{city_id}
Attention
The system allows the creation of duplicate customers. Therefore, if you do not want to allow this, you must implement validation before creating the customer. You can check the existence of the customer in List Customers.
Production: If your client is foreign, you will need to contact your Account Manager to request authorization in your registration to create foreign clients.
Sandbox: In the sandbox, it is possible to generate foreign clients without prior authorization.
Important
Sending and receiving email and SMS notifications works normally in Sandbox. Therefore, you should not create clients with real emails and cell phones or random numbers like (51) 9999-9999. To test receiving notifications, you can use your own emails and cell phones.