Payments

Create Purchase URL

Creates a secure checkout URL for purchasing a product.

post/payments/purchases/create-purchase-url

Request body

customer_type'user' | 'team' | 'custom' required

The type of customer making the purchase

customer_idstring required

The ID of the customer (user ID, team ID, or custom customer ID)

product_idstring

The ID of the product to purchase. Either this or product_inline should be given.

return_urlstring

URL to redirect to after purchase completion. Must be configured as a trusted domain in the project configuration.

Example request

{
  "customer_type": "user",
  "customer_id": "user_1234567890abcdef",
  "product_id": "prod_premium_monthly",
  "return_url": "https://myapp.com/purchase-success"
}

Response

Successful response

urlstring required

The secure checkout URL for completing the purchase

Changes

Changed in 2 of the 24 revisions of this API.39

    • the request property product_inline/client_metadata became nullable

      request-property-became-nullable

    • the request property product_inline/client_read_only_metadata became nullable

      request-property-became-nullable

    • the request property product_inline/server_metadata became nullable

      request-property-became-nullable

  • 180fda38d09936See the full diff
    • request property customer_type was restricted to a list of enum values

      request-property-became-enum

    • request property product_inline/customer_type was restricted to a list of enum values

      request-property-became-enum

    • the product_inline/free_trial/items/ request property type/format changed from number/ to integer/

      request-property-type-changed

    • added the new custom enum value to the request property customer_type

      request-property-enum-value-added

    • added the new custom enum value to the request property product_inline/customer_type

      request-property-enum-value-added

    • added the new team enum value to the request property customer_type

      request-property-enum-value-added

    • added the new team enum value to the request property product_inline/customer_type

      request-property-enum-value-added

    • added the new user enum value to the request property customer_type

      request-property-enum-value-added

    • added the new user enum value to the request property product_inline/customer_type

      request-property-enum-value-added