ovh / php-ovh

Lightweight PHP wrapper for OVH APIs. That's the easiest way to use OVH.com APIs in your PHP applications.
Other
288 stars 105 forks source link

cheking out a cart ends up with 403 forbidden. #127

Open BouzayenMohamed opened 1 year ago

BouzayenMohamed commented 1 year ago

Am trying to automate the process of provisioning a new VPS from ovh but i end up with 403 when trying to checkout the cart i dont know where the fault is (i think am misconfigured the vps item in the cart )

Client error: POST https://eu.api.ovh.com/1.0/order/cart/85c4dcbe-6b61-4078-b91b-154f373841cc/checkout resulted in a 403 Forbidden response: {"class":"Client::Forbidden","message":"You are not allowed"}

`if ($isPlanAvailable) {
                    $result = $ovh->post("/order/cart/".$cartId."/vps", array(
                    'duration' => "P1Y", // Duration selected for the purchase of the product (type: string)
                    'planCode' => "s1-2", // Identifier of the offer (type: string)
                    'pricingMode' => "default", // Pricing mode selected for the purchase of the product (type: string)
                    'quantity'=> 1, // Quantity of product desired (type: integer)
                    ));
                    $assign =$ovh->post("/order/cart/".$cartId."/assign");
                    // /order/cart/{cartId}/item/{itemId}/requiredConfiguration
                    $result = $ovh->get("/order/cart/".$cartId."/item");

                    $reqconfig = $ovh->get("/order/cart/".$cartId."/item/".$result[0]."/requiredConfiguration");
                    $config = $ovh->post("/order/cart/".$cartId."/item/".$result[0]."/configuration", array(
                    'label' => "ps_os",
                    'value' => "Ubuntu 19.10",
                    'label' => "vps_datacenter", // Label for your configuration item (type: string)
                    'value' => "GRA", // Value or resource URL on API.OVH.COM of your configuration item (type: string)
                    ));

                    //$check = $ovh->get("/order/cart/".$cartId."/checkout");

                    $checkout = $ovh->post("/order/cart/".$cartId."/checkout", array(
                    'waiveRetractationPeriod' => false, // Indicates that order will be processed with waiving retractation period (type: boolean)
                    'autoPayWithPreferredPaymentMethod' => false, // Indicates that order will be automatically paid with preferred payment method (type: boolean)
                    ));

                    } else {

                    }`
rbeuque74 commented 1 year ago

Hello @BouzayenMohamed,

Can you provide a debugging response header "X-OVH-QUERYID" to be able to investigate deeper on OVHcloud side.

Thanks, Romain