Integrate with a handful Payment API to manage payments workflows. This library allows to CRUD on the customers endpoint and then use the payments and installments endpoints to manage payments requests.
TBD:
- Installments
- Refunds
- Money Received
- Service Logger
- ERRORS
There are two ways to import the library to your project:
- Set in your script project dashboard
- Add the configuration into your
appsscript.json
- Script Id:
1LFQVmSJVu-3QhsZIKo-cp_i39uRDxrFkZ63fUwpMdQeyVR0ulCs4ZJfF
- Add the latest version: for example,
6
- Use the identifier
AsaasIntegration
These actions will update your appsscript.json
.
Or, you can update it directly adding to the dependencies
object:
"dependencies": {
"libraries": [
{
"userSymbol": "AsaasIntegration",
"version": "6",
"libraryId": "1LFQVmSJVu-3QhsZIKo-cp_i39uRDxrFkZ63fUwpMdQeyVR0ulCs4ZJfF"
}
]
}
The script runs in the timezone
Etc/GMT
.
For each API call pass the configuration parameters:
const config = {
isProduction: true, // or false for SANDBOX
apiKey: ASAAS_API_KEY,
};
Methods:
CustomerCreate(customer, config)
CustomerRead(id, config)
CustomerUpdate(id, customer, config)
CustomerRemove(id, config)
The id
is the returned by the CustomerCreate
method.
The customer object is given by:
const customer = {
name: "fullname",
email: "email",
mobilePhone: "cellphone",
cpfCnpj: "documentId",
postalCode: "postalCode",
addressNumber: "s/n",
notificationDisabled: true,
emailEnabledForProvider: false,
smsEnabledForProvider: false,
emailEnabledForCustomer: false,
smsEnabledForCustomer: false,
phoneCallEnabledForCustomer: false,
foreignCustomer: false,
};
where the following parameters are set as default values:
{
addressNumber: "s/n",
notificationDisabled: true,
emailEnabledForProvider: false,
smsEnabledForProvider: false,
emailEnabledForCustomer: false,
smsEnabledForCustomer: false,
phoneCallEnabledForCustomer: false,
foreignCustomer: false,
}
Methods:
PaymentCreate(payment, config)
PaymentRead(id, config)
PaymentUpdate(id, payment, config)
PaymentRemove(id, config)
The id
is the returned by the PaymentCreate
method.
Utilities:
PaymentGetBarCode(id, config)
PaymentGetPixCode(id, config)
The payment object is given by:
const payment = {
customer: "customerId",
dueDate: "2023-01-01",
value: 300,
description: "Put a description here.",
billingType: "UNDEFINED",
postalService: false,
};
where the following parameters are set as default values:
{
billingType: "UNDEFINED",
postalService: false,
}
TBD.
TBD.