Search code examples
javasquare

How to see created order in square pos


I am able to create order using square(v2/locations/location_id/orders)api and getting order id. But I am not able to get this order details and also how I can see this created order on square dashboard? please help me.

I am using the below method for doing it:

public CreateOrderResponse createOrder(String locationId, CreateOrderRequest body) throws ApiException {
    Object localVarPostBody = body;

    // verify the required parameter 'locationId' is set
    if (locationId == null) {
        throw new ApiException(400, "Missing the required parameter 'locationId' when calling createOrder");
    }

    // verify the required parameter 'body' is set
    if (body == null) {
        throw new ApiException(400, "Missing the required parameter 'body' when calling createOrder");
    }

    // create path and map variables
    String localVarPath = "/v2/locations/{location_id}/orders".replaceAll("\\{" + "location_id" + "\\}",
                    apiClient.escapeString(locationId.toString()));

    // query params
    List<Pair> localVarQueryParams = new ArrayList<Pair>();
    Map<String, String> localVarHeaderParams = new HashMap<String, String>();
    Map<String, Object> localVarFormParams = new HashMap<String, Object>();

    final String[] localVarAccepts = { "application/json" };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = { "application/json" };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "oauth2" };

    GenericType<CreateOrderResponse> localVarReturnType = new GenericType<CreateOrderResponse>() {
    };
    CompleteResponse<CreateOrderResponse> completeResponse = (CompleteResponse<CreateOrderResponse>) apiClient
                    .invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams,
                                    localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames,
                                    localVarReturnType);
    return completeResponse.getData();
}

Thanks


Solution

  • The orders endpoint is only for creating itemized orders for e-commerce transactions. You won't see them anywhere until you charge them, and then you'll see the itemizations for the order in your dashboard with the transaction.