In short: through the API, domains are paid from credit only. If the credit is not enough, the registration does not go ahead: the answer is 402 insufficient_credit and nothing is charged, but your client is left waiting. To avoid that, set an alert amount on the reseller page and top up before you hit zero. It is the last tip on the domain reseller page.
Setting the alert amount
| 2 |
In Warn me when credit goes below, enter the amount in your account currency. Left empty, it uses the amount shown underneath; 0 turns the alert off.
|
|
The alert goes out once per drop: when your credit falls below the amount you get an e-mail, and you only get another one after the credit has gone back above it. It can also arrive by SMS, depending on your notification preferences. The same part of the page shows your available credit and the latest movements.
|
Which amount? Think about what you register and renew in a normal week and set the alert a little above that. That leaves you time to top up before a registration fails.
|
The same alert in your own system
If your program registers domains on its own, get the alert by webhook. Save an HTTPS address with PUT /v1/webhooks and choose the events; it needs webhooks:write. The reseller.credit_low event arrives when your credit drops below the chosen amount, with the credit in balance and the alert amount in low_warning_at. Add domain.registration_failed to hear about any registration that fails.
curl https://api.interweb.ao/v1/webhooks -X PUT \
-H "Authorization: Bearer $INTERWEB_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://asuaempresa.ao/webhooks", "events": ["reseller.credit_low", "domain.registration_failed"]}'
It is the same address and the same signature as the SMS webhook. POST /v1/webhooks/test sends a test, so you can confirm your side receives it. How to check the signature is in receiving a webhook in PHP.
Checking before you buy, and topping up from your system
| Request |
What for |
| GET /v1/billing/credit |
Your available credit, before each registration. |
| GET /v1/reseller/program |
Your Agence, your discount and your credit, in one answer. |
| POST /v1/reseller/top-up |
Creates the top-up invoice for the amount you give, without charging anything. You pay it at pay_url; the minimum comes in top_up_minimum. It needs reseller:write. |
| GET /v1/reseller/statements?month=... |
The credit movements of one month, with the opening and closing balance. |
In Meu Interweb, you top up under Add funds, with the payment methods available to your account.
|
If a registration fails for lack of credit, nothing was charged. Top up and ask again. If our team has given you a credit line, a purchase with too little credit uses it up to the limit and an invoice follows; above the limit, or with that invoice overdue, the answer is 402 again.
|