---
title: "Create Purchase URL"
method: POST
path: "/payments/purchases/create-purchase-url"
tags: ["Payments"]
---

# Create Purchase URL

`POST /payments/purchases/create-purchase-url`

Creates a secure checkout URL for purchasing a product.

## Request body

- object
  - `customer_type` 'user' | 'team' | 'custom', required — The type of customer making the purchase
  - `customer_id` string, required — The ID of the customer (user ID, team ID, or custom customer ID)
  - `product_id` string — The ID of the product to purchase. Either this or product_inline should be given.
  - `product_inline` object — Inline product definition. Either this or product_id should be given.
    - `display_name` string, required
    - `customer_type` 'user' | 'team' | 'custom', required
    - `free_trial` integer[]
    - `server_only` boolean
    - `stackable` boolean
    - `prices` object
    - `included_items` object
    - `client_metadata` object, nullable — Client metadata. Used as a data store, accessible from the client side. Do not store information that should not be exposed to the client.
    - `client_read_only_metadata` object, nullable — Client read-only, server-writable metadata. Used as a data store, accessible from the client side. Do not store information that should not be exposed to the client. The client can read this data, but cannot modify it. This is useful for things like subscription status.
    - `server_metadata` object, nullable — Server metadata. Used as a data store, only accessible from the server side. You can store secret information related to the product here.
  - `return_url` string — URL to redirect to after purchase completion. Must be configured as a trusted domain in the project configuration.

## Response `200`

Successful response

- object
  - `url` string, required — The secure checkout URL for completing the purchase

---

[API](https://skmtc.net/hexclave/apis/hexclave-rest-api.md) · [All operations](https://skmtc.net/hexclave/apis/hexclave-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/hexclave/hexclave-rest-api/versions/86dcd8c9953c/schema)
