For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://docs.wisboo.com/wisboo-api/llms.txt. For full documentation content, see https://docs.wisboo.com/wisboo-api/llms-full.txt.

# Search purchases

GET https://api.wisboo.com/v3/public/purchases/search

Permite buscar una venta según los parámetros indicados. Se pueden buscar las ventas por order_id, email o user_id.

Reference: https://docs.wisboo.com/wisboo-api/search-purchases

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /v3/public/purchases/search:
    get:
      operationId: search-purchases
      summary: Search purchases
      description: >-
        Permite buscar una venta según los parámetros indicados. Se pueden
        buscar las ventas por order_id, email o user_id.
      tags:
        - ''
      parameters:
        - name: page
          in: query
          description: Página a consultar
          required: false
          schema:
            type: string
        - name: order_id
          in: query
          description: Orden de la compra
          required: false
          schema:
            type: string
        - name: email
          in: query
          description: Email del comprador
          required: false
          schema:
            type: string
        - name: user_id
          in: query
          description: ID del usuario comprador
          required: false
          schema:
            type: string
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Search purchases_Response_200'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/GetV3PublicPurchasesSearchRequestBadRequestError
servers:
  - url: https://api.wisboo.com
components:
  schemas:
    V3PublicPurchasesSearchGetResponsesContentApplicationJsonSchemaDataItemsBuyer:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        email:
          type: string
          format: email
        last_name:
          type: string
      required:
        - id
        - name
        - email
        - last_name
      title: >-
        V3PublicPurchasesSearchGetResponsesContentApplicationJsonSchemaDataItemsBuyer
    V3PublicPurchasesSearchGetResponsesContentApplicationJsonSchemaDataItems:
      type: object
      properties:
        id:
          type: integer
        buyer:
          $ref: >-
            #/components/schemas/V3PublicPurchasesSearchGetResponsesContentApplicationJsonSchemaDataItemsBuyer
        status:
          type: string
        paid_at:
          type: string
          format: date-time
        currency:
          type: string
        order_id:
          type: string
        created_at:
          type: string
          format: date-time
        product_id:
          type: integer
        coupon_code:
          description: Any type
        external_id:
          type: string
        product_name:
          type: string
        total_amount:
          type: integer
        payment_method:
          description: Any type
        payment_gateway:
          type: string
        discounted_amount:
          type: integer
        payment_method_type:
          type: string
      required:
        - id
        - buyer
        - status
        - paid_at
        - currency
        - order_id
        - created_at
        - product_id
        - external_id
        - product_name
        - total_amount
        - payment_gateway
        - discounted_amount
        - payment_method_type
      title: V3PublicPurchasesSearchGetResponsesContentApplicationJsonSchemaDataItems
    V3PublicPurchasesSearchGetResponsesContentApplicationJsonSchemaMetadata:
      type: object
      properties:
        page_size:
          type: integer
        page_number:
          type: integer
        total_record_count:
          type: integer
      required:
        - page_size
        - page_number
        - total_record_count
      title: V3PublicPurchasesSearchGetResponsesContentApplicationJsonSchemaMetadata
    Search purchases_Response_200:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: >-
              #/components/schemas/V3PublicPurchasesSearchGetResponsesContentApplicationJsonSchemaDataItems
        metadata:
          $ref: >-
            #/components/schemas/V3PublicPurchasesSearchGetResponsesContentApplicationJsonSchemaMetadata
      required:
        - data
        - metadata
      title: Search purchases_Response_200
    GetV3PublicPurchasesSearchRequestBadRequestError:
      type: object
      properties:
        code:
          type: string
        type:
          type: string
        message:
          type: string
        timestamp:
          type: string
          format: date-time
        request_id:
          type: string
          format: uuid
      required:
        - code
        - type
        - message
        - timestamp
        - request_id
      title: GetV3PublicPurchasesSearchRequestBadRequestError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

```

## SDK Code Examples

```python Search purchases_example
import requests

url = "https://api.wisboo.com/v3/public/purchases/search"

querystring = {"page":"","order_id":""}

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript Search purchases_example
const url = 'https://api.wisboo.com/v3/public/purchases/search?page=&order_id=';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Search purchases_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.wisboo.com/v3/public/purchases/search?page=&order_id="

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Search purchases_example
require 'uri'
require 'net/http'

url = URI("https://api.wisboo.com/v3/public/purchases/search?page=&order_id=")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Search purchases_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.wisboo.com/v3/public/purchases/search?page=&order_id=")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php Search purchases_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.wisboo.com/v3/public/purchases/search?page=&order_id=', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp Search purchases_example
using RestSharp;

var client = new RestClient("https://api.wisboo.com/v3/public/purchases/search?page=&order_id=");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Search purchases_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.wisboo.com/v3/public/purchases/search?page=&order_id=")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```