SOLVED Create account wrong package when customer orders via API

evilcrytk

Registered
Feb 14, 2022
3
0
1
Vietnam
cPanel Access Level
Website Owner
I use the API to create a hosting account when a customer places an order, through the api:


- The plan will include many packages, depending on the customer's choice: userreseller_Enterprise1, userreseller_Enterprise2, userreseller_Enterprise3, ....

However, the Api does not work well, sometimes it points to the right plan, sometimes it points to the "default" package, I don't know the reason.

Please help me how to fix this problem, many thanks
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
9,904
1,544
313
cPanel Access Level
Root Administrator
Hey there! It sounds like the issue would be with whatever tool is sending data to the API. The API itself doesn't have the ability to "think" so it wouldn't pick a random package, but just processes the information it has.

Unfortunately the API also doesn't have any logging at this level. Do you have a way to capture the API call that is being sent? If so, you could try running that outside of your order system to see if it completes properly there.
 

evilcrytk

Registered
Feb 14, 2022
3
0
1
Vietnam
cPanel Access Level
Website Owner
Thank you for responding

Currently, in my hosting order system, the customer will choose the "package" and enter the "domain". The customer system will automatically generate hosting account information (user, pass) based on the domain, then send the api link to the cPanel server (including all params - (user, pass, domain, plan-package))

For example:
I have 3 plans (userreseller_Enterprise1, userreseller_Enterprise2, userreseller_Enterprise3),
- Customer order package (userreseller_Enterprise1, userreseller_Enterprise2) then api link works fine. When the customer selects userreseller_Enterprise3, it points to the default package
- I restart the server, the api packages (serreseller_Enterprise2, userreseller_Enterprise3) are working fine, but the userreseller_Enterprise1 package is pointing back to the default package.

It seems that, every time I restart the server, the api link that is failing will work properly and the properly working links will randomly fail (pointing to the default package)

This error is weird, is there any way to fix it?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
9,904
1,544
313
cPanel Access Level
Root Administrator
Thanks for the additional details. With the information I have here I can't say for sure what the problem may be. It would be best to open a ticket with our team so we could check the issue on your specific server while replicating the actual API calls in use. If you are able to submit a ticket, please post the number here so I can follow along.
 

evilcrytk

Registered
Feb 14, 2022
3
0
1
Vietnam
cPanel Access Level
Website Owner
I found the cause
My password constructor encloses characters as plaintext ( including "#&" characters), when "#" or "&&" characters appear will lose the params after it. So it can't find the "plan" param