# Payhip

Payhip is an e-commerce platform that enables individuals and businesses to sell digital products, memberships, and physical goods directly to their audience.

- **Category:** ecommerce
- **Auth:** API_KEY
- **Composio Managed App Available?** N/A
- **Tools:** 9
- **Triggers:** 0
- **Slug:** `PAYHIP`
- **Version:** 20260223_00

## Tools

### Create Coupon

**Slug:** `PAYHIP_CREATE_COUPON`

Tool to create a coupon for discounts in Payhip. Use when you need to create a new coupon code with either percentage or fixed amount discounts. Coupons can apply to single products, all products, or collections.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `code` | string | Yes | The coupon code the customer is required to enter at checkout |
| `notes` | string | No | For administrative purposes you can remind yourself why you created this coupon by adding a note - not visible to customers |
| `amount_off` | integer | No | A positive integer representing the amount to subtract from the cart total in cents. For example $5 off would be 500. Required if percent_off is not provided. Cannot be used together with percent_off. |
| `coupon_type` | string ("single" | "multi" | "collection") | Yes | Specifies if the coupon will be applied for a single product, all your products or a single collection |
| `percent_off` | number | No | A positive float larger than 0, and smaller or equal to 100, that represents the discount percentage the coupon will apply. Required if amount_off is not provided. Cannot be used together with amount_off. |
| `product_key` | string | No | The unique product key. Required if coupon_type is set to 'single' |
| `usage_limit` | integer | No | The maximum number of times this coupon can be redeemed before it becomes invalid |
| `collection_id` | string | No | The unique collection ID. Required if coupon_type is set to 'collection' |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Delete Coupon

**Slug:** `PAYHIP_DELETE_COUPON`

Tool to delete a coupon by ID. Use when you need to remove a coupon from the Payhip account. Only available in v1 API.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | string | Yes | The unique identifier for the coupon to delete. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Coupon

**Slug:** `PAYHIP_GET_COUPON`

Tool to retrieve a coupon with the given ID. Use when you need to fetch details about a specific coupon from Payhip.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | integer | Yes | Unique identifier for the coupon object |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Update Coupon

**Slug:** `PAYHIP_UPDATE_COUPON`

Tool to edit an existing coupon in Payhip. Use when you need to modify coupon details like code, percentage, expiry, or usage limit. Only available in v1 API.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | string | Yes | The unique identifier for the coupon. |
| `code` | string | No | The code for the coupon. |
| `limit` | string | No | The maximum limit for the coupon usage. |
| `expiry` | string | No | The expiry of the coupon in a timestamp format. |
| `percentage` | string | No | The percentage discount for the coupon. |
| `product_id` | string | No | The product ID if coupon is specific to a product. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Verify Coupon

**Slug:** `PAYHIP_VERIFY_COUPON`

Tool to verify a Payhip coupon code. Use when you need to check if a coupon code is valid and retrieve its details. Only available in v1 API.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `code` | string | Yes | The coupon code to verify. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Webhook Event - Paid

**Slug:** `PAYHIP_WEBHOOK_EVENT_PAID`

Tool to process Payhip's paid webhook event. Use when handling a purchase completion webhook from Payhip.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | string | Yes | Unique ID of the transaction |
| `date` | integer | Yes | Unix timestamp when purchase occurred |
| `type` | string | Yes | Event type identifier |
| `email` | string | Yes | Customer's email address |
| `items` | array | Yes | List of items in the order |
| `price` | integer | Yes | Total price in cents |
| `is_gift` | boolean | Yes | Whether the purchase was a gift |
| `currency` | string | Yes | Three-letter currency code |
| `signature` | string | Yes | HMAC SHA-256 signature of the payload using your API key |
| `ip_address` | string | Yes | Customer's IP address |
| `payhip_fee` | integer | Yes | Payhip fee in cents |
| `stripe_fee` | integer | Yes | Stripe fee in cents |
| `vat_applied` | boolean | Yes | Whether VAT was applied to the purchase |
| `payment_type` | string ("card" | "paypal") | Yes | Payment method used |
| `unconsented_from_emails` | boolean | Yes | Whether customer has opted out of emails |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Webhook Event - Refunded Payment

**Slug:** `PAYHIP_WEBHOOK_EVENT_REFUNDED`

Tool to process Payhip's refunded webhook event. Use when handling a payment refund event from Payhip.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `id` | string | Yes | Transaction ID |
| `type` | string | Yes | Event type identifier |
| `email` | string | Yes | Buyer email address |
| `items` | array | Yes | List of items included in the transaction |
| `price` | integer | Yes | Original price in cents or pennies |
| `is_gift` | boolean | Yes | Whether purchase was a gift |
| `currency` | string | Yes | ISO 4217 currency code, e.g., USD |
| `signature` | string | Yes | HMAC SHA-256 signature of the payload using your API key |
| `ip_address` | string | Yes | IP address of the buyer |
| `payhip_fee` | integer | Yes | Payhip fee in cents |
| `stripe_fee` | integer | Yes | Stripe fee in cents |
| `vat_applied` | boolean | Yes | Whether VAT was applied |
| `date_created` | integer | Yes | Unix timestamp when transaction was created |
| `payment_type` | string | Yes | Payment method used, e.g., card |
| `date_refunded` | integer | Yes | Unix timestamp when refund occurred |
| `amount_refunded` | integer | Yes | Amount refunded in cents or pennies |
| `unconsented_from_emails` | boolean | Yes | Whether buyer did not consent to marketing emails |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Webhook Event - Subscription Created

**Slug:** `PAYHIP_WEBHOOK_EVENT_SUBSCRIPTION_CREATED`

Tool to process Payhip's subscription.created webhook event. Use when handling a subscription start event from Payhip.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `type` | string | Yes | Event type identifier |
| `status` | string | Yes | Subscription status at creation; always 'active' for this event |
| `plan_name` | string | Yes | Name of the subscription plan |
| `signature` | string | Yes | HMAC SHA-256 signature of the payload using your API key |
| `customer_id` | string | Yes | Unique identifier for the customer |
| `gdpr_consent` | string ("Yes" | "No") | Yes | Customer's GDPR consent status |
| `product_link` | string | Yes | Payhip product link identifier |
| `product_name` | string | Yes | Name of the product |
| `customer_email` | string | Yes | Customer's email address |
| `subscription_id` | string | Yes | Unique identifier for the subscription |
| `customer_last_name` | string | Yes | Customer's last name |
| `customer_first_name` | string | Yes | Customer's first name |
| `date_subscription_started` | integer | Yes | Unix timestamp when the subscription started |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Webhook Event - Subscription Deleted

**Slug:** `PAYHIP_WEBHOOK_EVENT_SUBSCRIPTION_DELETED`

Tool to process Payhip's 'subscription.deleted' webhook event. Use when handling a subscription cancellation event from Payhip.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `type` | string | Yes | Event type identifier |
| `status` | string | Yes | Current subscription status; always 'canceled' for this event |
| `plan_name` | string | Yes | Name of the subscription plan |
| `signature` | string | Yes | HMAC SHA-256 signature of the payload using your API key |
| `customer_id` | string | Yes | Unique identifier for the customer |
| `gdpr_consent` | string ("Yes" | "No") | Yes | Whether the customer gave GDPR consent ('Yes' or 'No') |
| `product_link` | string | Yes | Payhip product link identifier |
| `product_name` | string | Yes | Name of the product |
| `customer_email` | string | Yes | Customer's email address |
| `subscription_id` | string | Yes | Unique identifier for the subscription |
| `customer_last_name` | string | Yes | Customer's last name |
| `customer_first_name` | string | Yes | Customer's first name |
| `date_subscription_deleted` | integer | Yes | Unix timestamp when subscription was canceled |
| `date_subscription_started` | integer | Yes | Unix timestamp when subscription started |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |
