Purchases

List Purchases

Returns a list of purchases in your account.:

GET /purchases

Parameters

  • status - Purchase status. See below for a full list of status codes.

  • product_id - Product ID

  • storefront_id - Storefront ID

  • customer_id - Customer ID

  • subscriber_id - Subscriber ID

  • customer_email - Customer email address. Does a “startswith” match. Not case sensitive.

  • customer_first_name - Customer first name. Does a “startswith” match. Not case sensitive.

  • customer_last_name - Customer last name. Does a “startswith” match. Not case sensitive.

  • date_min - Purchase created after. Accepts any format that PHP’s strtotime accepts.

  • date_max - Purchase created before. Accepts any format that PHP’s strtotime accepts.

  • total - Purchase total. Behavior is controlled by the total_op param.

  • total_op - How to compare the total parameter. eq (equals; default), ne (not equal), gt (greater than), lt (less than)

  • ship - Purchases with tangible goods that have not been shipped.

Response:

[{"id":1,"status":"...",...},{"id":2,"status":"...",...}]

Get Purchase

Returns information about a single purchase.:

GET /purchases/:id

The response is a JSON hash with the following attributes:

  • id (integer) - Unique ID

  • created_at (UNIX timestamp) - When the purchase was created.

  • updated_at (UNIX timestamp) - When the purchase was last updated.

  • storefront_id (integer) - Storefront ID.

  • salt (string) - Unique hash code.

  • status (string) - Purchase status (see below).

  • currency (string) - Currency.

  • subtotal (string) - Subtotal.

  • discount (string) - Discount amount.

  • tax (string) - Tax amount.

  • shipping (string) - Shipping amount.

  • total (string) - Total (subtotal + discount + tax + shipping)

  • processor_fee (string) - Total fee collected by the payment processor. Not recorded for all payment processors and is not reflected in the total.

  • buyer_email (string) - Buyer’s email address.

  • buyer_firstname (string) - Buyer’s first name.

  • buyer_lastname (string) - Buyer’s last name.

  • customer (object) - Customer information object.

  • customer_notes (string) - Notes from the customer.

  • custom_fields (array) - A list of custom fields and their responses.

  • shipping_firstname (string) - Shipping first name.

  • shipping_lastname (string) - Shipping last name.

  • shipping_street (string) - Shipping street address.

  • shipping_street2 (string) - Shipping street address line 2.

  • shipping_city (string) - Shipping city.

  • shipping_state (string) - Shipping state/province code.

  • shipping_zip_code (string) - Shipping ZIP/postal code.

  • shipping_country_code (string) - Shipping country code.

  • shipping_country (string) - Full shipping country name.

  • shipping_phone (string) - Shipping phone number.

  • shipping_vatin (string) - Shipping VAT identifier.

  • shipping_business_name (string) - Shipping business name.

  • shipping_carrier (string) - Shipping carrier (UPS, FedEx, etc)

  • shipping_tracking_number (string) - Tracking number for the shipment.

  • requires_shipping (boolean) - true if the purchase requires shipping to fulfill.

  • tangibles_to_ship (integer) - Number of goods that have not been shipped. 0 if all have been shipped. null if shipping wasn’t required.

  • billing_firstname (string) - Billing first name.

  • billing_lastname (string) - Billing last name.

  • billing_street (string) - Billing street address.

  • billing_street2 (string) - Billing street address line 2.

  • billing_city (string) - Billing city.

  • billing_state (string) - Billing state/province code.

  • billing_zip_code (string) - Billing ZIP/postal code.

  • billing_country_code (string) - Billing country code.

  • billing_card_type (string) - Billing card type.

  • billing_card_number (string) - Partial billing card number, padded with asterisks.

  • line_items (array)

  • coupons (array) - The coupons used with this purchase (if any)

  • ip_address (string) - IP address of the checkout location

  • marketing_optin (boolean) - true if the customer opted to receive marketing communications.

The line_items array has the following attributes:

  • id (integer) Unique ID

  • purchase_id (integer) Purchase ID

  • product_id (integer) Product ID

  • price (string) Line price.

  • quantity (integer) Line quantity.

  • subtotal (string) Line subtotal (price * quantity)

  • tax (string) Line tax.

  • discount (string) Line discount.

  • total (string) Line total (subtotal + tax + discount)

  • product_name (string) Product name.

  • download_limit (integer) How many times the product may be downloaded. 0 is “unlimited”.

  • download_count (integer) How many times the product has been downloaded.

  • expires_at (UNIX timestamp) When the download expires.

  • product_keys (array) All of the product keys delivered with this line item.

  • has_all_keys (boolean) true if all of the keys were successfully generated for the line item.

The custom_fields array has the following attributes:

  • label (string) Custom field label.

  • response (string) Customer’s response.

The coupons array has the following attributes:

  • name (string) The coupon name.

  • code (string) The code used to redeem the coupon.

  • discount_amount (string) The discount. Either as a percentage or as money.

  • discount_type (string) The type of discount. Either money or percent.

The customer object has the following attributes:

  • id (integer) - Unique ID

  • firstname (string) - Customer’s first name.

  • lastname (string) - Customer’s last name.

  • email (string) - Customer’s email address.

  • receives_email (boolean) - Boolean on whether your customer recieves email from your product updates.

  • created_at (UNIX timestamp) - When the purchase was created.

  • updated_at (UNIX timestamp) - When the purchase was last updated.

Purchase Status Codes

A purchase’s status will be one of the following:

  • ACT - Active. The purchase has completed and is paid.

  • PND - Pending. The purchase is pending payment.

  • RFD - Refunded. The purchase has been refunded in partial or full.

  • ERR - Error. There was an error verifying the purchase’s payment.

  • CAN - Canceled. The purchase was canceled.

  • HLD - Held. The purchase was held due to fraud or blacklist checks.

Reactivate Purchase

Reactivates a purchase. This method is identical in behavior to reactivating a purchase through the web site:

POST /purchases/:id/reactivate

Parameters

  • customer_email (string) - Customer email address. Omit or leave blank to send to the email address associated with the purchase.

  • refulfill (boolean) - Set to refulfill the purchase.

The response is a JSON hash with the following attributes:

  • status (string) - “OK” on success