Endpoints Overview

The following API endpoints allow you to create, update, manage, and retrieve products, including uploading images for them.

ActionMethodEndpoint
Create ProductPOST/products
Update ProductPATCH/products/{product_id}
Upload Product ImagePUT/products/{product_id}/images
Retrieve ProductsGET/products
Archive ProductPOST/products/{product_id}/archive
Unarchive ProductPOST/products/{product_id}/unarchive

Creating a Product

A product can be a one-time item or a subscription-based service. To create a new product, send a POST request to the /products endpoint with details such as name, description, price, currency, and whether it is a recurring product.

For detailed request and response structure, refer to the Create Product API documentation.

Updating a Product

To modify an existing product, send a PATCH request to the /products/{product_id} endpoint. You can update properties such as name, price, and description while keeping other details unchanged.

For the full list of updateable fields and response formats, refer to the Update Product API documentation.

Retrieving Products

You can fetch a list of products stored in your account using a GET request to the /products endpoint. This allows you to retrieve product details, including active and archived products.

For more details, refer to the Retrieve Products API documentation.

Archiving a Product

If you no longer wish to display or use a product, you can archive it using a POST request to the /products/{product_id}/archive endpoint. This action hides the product but does not delete it permanently.

For more details, refer to the Archive Product API documentation.

Unarchiving a Product

If you need to restore an archived product, send a POST request to the /products/{product_id}/unarchive endpoint. This will reactivate the product and make it available for use again.

For more details, refer to the Unarchive Product API documentation.

Uploading a Product Image

You can associate an image with a product by uploading it to AWS S3 using a pre-signed URL provided by the API. First, request an image upload URL from the /products/{product_id}/images endpoint, then use the provided URL to upload the image within 60 seconds.

For more details, refer to the Upload Product Image API documentation.

Upload Image to S3

Once the pre-signed URL is received from the API, upload the image within 60 seconds using the PUT method. This ensures secure and temporary access to AWS S3 for uploading the image.

Example Request

PUT https://s3.amazonaws.com/bucket_name/img_67890?AWSAccessKeyId=xyz&Expires=123456789&Signature=abc
Content-Type: image/png

<BINARY IMAGE DATA>

Libraries for Uploading to S3

To simplify the upload process, you can use the following libraries for different programming languages:

  • Node.js: axios, node-fetch
  • Python: requests, boto3
  • Go: net/http
  • PHP: GuzzleHttp
  • Ruby: rest-client

Successful Upload Response

If the upload is successful, AWS S3 will return a 200 OK status, indicating that the image has been stored successfully.

Notes

  • All requests must include an authorization token in the Authorization header.
  • Ensure that the product_id in the update and image upload endpoints matches an existing product.
  • For recurring products, set recurring: true and specify a billing_cycle (daily, weekly, monthly, yearly).
  • The pre-signed URL expires in 60 seconds, so the image must be uploaded within that timeframe.