|
| 1 | +# hostinger_api.BillingOrdersApi |
| 2 | + |
| 3 | +All URIs are relative to *https://developers.hostinger.com* |
| 4 | + |
| 5 | +Method | HTTP request | Description |
| 6 | +------------- | ------------- | ------------- |
| 7 | +[**create_purchase_order_v1**](BillingOrdersApi.md#create_purchase_order_v1) | **POST** /api/billing/v1/orders | Create purchase order |
| 8 | + |
| 9 | + |
| 10 | +# **create_purchase_order_v1** |
| 11 | +> BillingV1OrderOrderResource create_purchase_order_v1(billing_v1_order_purchase_request) |
| 12 | +
|
| 13 | +Create purchase order |
| 14 | + |
| 15 | +Create a purchase order for any Hostinger product. |
| 16 | + |
| 17 | +This unified endpoint places an order for one or more catalog items and |
| 18 | +works across all Hostinger products, leveraging the existing billing |
| 19 | +infrastructure. Use the [catalog endpoint](#tag/billing-catalog) to look |
| 20 | +up the `item_id` values available for purchase. |
| 21 | + |
| 22 | +If no payment method is provided, your default payment method will be used automatically. |
| 23 | + |
| 24 | +This endpoint only places the order. Product-specific provisioning |
| 25 | +(e.g. VPS setup or domain registration) is not performed here — once the |
| 26 | +order completes, use the relevant product endpoints or |
| 27 | +[hPanel](https://hpanel.hostinger.com/) to finalize setup. |
| 28 | + |
| 29 | +Use this endpoint to purchase any product available in the catalog. |
| 30 | + |
| 31 | +### Example |
| 32 | + |
| 33 | +* Bearer Authentication (apiToken): |
| 34 | + |
| 35 | +```python |
| 36 | +import hostinger_api |
| 37 | +from hostinger_api.models.billing_v1_order_order_resource import BillingV1OrderOrderResource |
| 38 | +from hostinger_api.models.billing_v1_order_purchase_request import BillingV1OrderPurchaseRequest |
| 39 | +from hostinger_api.rest import ApiException |
| 40 | +from pprint import pprint |
| 41 | + |
| 42 | + |
| 43 | +# Configure Bearer authorization: apiToken |
| 44 | +configuration = hostinger_api.Configuration( |
| 45 | + access_token = os.environ["BEARER_TOKEN"] |
| 46 | +) |
| 47 | + |
| 48 | +# Enter a context with an instance of the API client |
| 49 | +with hostinger_api.ApiClient(configuration) as api_client: |
| 50 | + # Create an instance of the API class |
| 51 | + api_instance = hostinger_api.BillingOrdersApi(api_client) |
| 52 | + billing_v1_order_purchase_request = hostinger_api.BillingV1OrderPurchaseRequest() # BillingV1OrderPurchaseRequest | |
| 53 | + |
| 54 | + try: |
| 55 | + # Create purchase order |
| 56 | + api_response = api_instance.create_purchase_order_v1(billing_v1_order_purchase_request) |
| 57 | + print("The response of BillingOrdersApi->create_purchase_order_v1:\n") |
| 58 | + pprint(api_response) |
| 59 | + except Exception as e: |
| 60 | + print("Exception when calling BillingOrdersApi->create_purchase_order_v1: %s\n" % e) |
| 61 | +``` |
| 62 | + |
| 63 | + |
| 64 | + |
| 65 | +### Parameters |
| 66 | + |
| 67 | + |
| 68 | +Name | Type | Description | Notes |
| 69 | +------------- | ------------- | ------------- | ------------- |
| 70 | + **billing_v1_order_purchase_request** | [**BillingV1OrderPurchaseRequest**](BillingV1OrderPurchaseRequest.md)| | |
| 71 | + |
| 72 | +### Return type |
| 73 | + |
| 74 | +[**BillingV1OrderOrderResource**](BillingV1OrderOrderResource.md) |
| 75 | + |
| 76 | +### Authorization |
| 77 | + |
| 78 | +[apiToken](../README.md#apiToken) |
| 79 | + |
| 80 | +### HTTP request headers |
| 81 | + |
| 82 | + - **Content-Type**: application/json |
| 83 | + - **Accept**: application/json |
| 84 | + |
| 85 | +### HTTP response details |
| 86 | + |
| 87 | +| Status code | Description | Response headers | |
| 88 | +|-------------|-------------|------------------| |
| 89 | +**200** | Success response | - | |
| 90 | +**422** | Validation error response | - | |
| 91 | +**401** | Unauthenticated response | - | |
| 92 | +**500** | Error response | - | |
| 93 | + |
| 94 | +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) |
| 95 | + |
0 commit comments