Deem Offers API Documentation

Purchases

Endpoint to create purchases for a third party reseller. This api is only to be used if the transaction is completely managed by the third party.

Create a purchase

POST https://<username>:<password>@api.offers.deem.com/api/v3/resellers/purchases

Required Parameters

Which fields are required depends on the type of the deal a purchase is being recorded for.

Daily Deal or On Going deals

  • deal_id
  • quantity
  • transaction_reference
  • transaction_date
  • transaction_amount
  • first_name
  • last_name

Shipped

  • deal_id
  • quantity
  • transaction_reference
  • transaction_date
  • transaction_amount
  • first_name
  • last_name
  • address_type
  • address1
  • address2
  • postal_code
  • city
  • state
  • country
  • telephone

Card Linked

  • deal_id
  • transaction_reference
  • transaction_date
  • transaction_amount

Available Fields

The following fields may be included in any purchase request. All fields sent will be used, though they may have little to no meaning for some requests.

deal_id
String The id of the deal that was purchased
transaction_reference
String Partner generated reference for the transaction
transaction_date (in ISO 8601 format)
String
first_name
String The first name of the user who made the purchase
last_name
String The last name of the user who made the purchase
transaction_amount
Integer The amount of the transaction in cents. (100 represents 1 dollar.)
quantity
Integer Number of deals to be purchased. If this is not specified and is not required, this will default to 1.
address_type
String Name associated with this shipping address (Home, Work, etc.)
address1
String First line of the shipping address
address2
String Second line of the shipping address
postal_code
String Postal/Zip code of the shipping address
city
String City name of the shipping address
state
String Two-character state abbreviation of the shipping address
country
String Two-character country abbreviation of the shipping address
telephone
String The telephone number of the user that made the purchase

Card Linked Request Example

POST https://<username>:<password>@api.offers.deem.com/api/v3/resellers/purchases.json
{
  "deal_id": "deal1234",
  "transaction_amount": "3599",
  "transaction_date": "2014-06-06T20:30:05Z",
  "transaction_reference": "trans1234",
  "first_name": "Hank",
  "last_name": "Rearden"
}

Daily Deal or On Going Request Example

POST https://<username>:<password>@api.offers.deem.com/api/v3/resellers/purchases.json
{
  "deal_id": "deal1234",
  "quantity": "2",
  "transaction_amount": "3599",
  "transaction_date": "2014-06-06T20:30:05Z",
  "transaction_reference": "trans1234",
  "first_name": "Hank",
  "last_name": "Rearden"
}

Daily Deal or On Going Shipped Request Example

POST https://<username>:<password>@api.offers.deem.com/api/v3/resellers/purchases.json
{
  "deal_id": "deal1234",
  "quantity": "2",
  "transaction_amount": "3599",
  "transaction_date": "2014-06-06T20:30:05Z",
  "transaction_reference": "trans1234",
  "first_name": "Hank",
  "last_name": "Rearden",
  "address_type": "Home",
  "address1": "123 Any St.",
  "address2": "Suite 100",
  "postal_code": "12345",
  "city": "Any Town",
  "state": "CA",
  "country": "US",
  "telephone": "312-555-1212"
}

Response

Status: 200 OK
{
  "id": "af063ec2",
  "transaction_reference": "client_ref_id",
  "amount": 0,
  "number_bought": 0,
  "fulfillment_state": "fulfilled",
  "created_at": "Fri Dec 16 19:11:15 UTC 2011",
  "deal": {
    "id": "la-1024-wsc-hair-studio-01-2",
    "title": "1024 WSC Salon - Other - $39 for $100",
    "image_url_abs": "http://hrugassets-staging.s3.amazonaws.com/ugassets/deal/images/4/b/84555f69/large.jpg"
  },
  "coupons": [
    {
      "id": "a21c5452d8",
      "expires_at": null,
      "created_at": "Fri Dec 16 19:14:55 UTC 2011",
      "qr_code_url": "http://domain/coupon/qr_code/ab231c9e",
      "qr_code": "apaosidnqw4tdsdpqi45jf091835ukdfq3-40695.kfmdg-q09i6m'ldfi8nqk6",
      "state": "valid",
      "redemption_code": null,
      "redeemed_at": null
    }
  ]
}

Error Responses

If there is an error creating the purchase or any required portion an error message will be returned.

422

error_type = “cannot_fulfill”
Not able to fulfill the purchase
error_type = “validations_failed”
Validation failed, which can be five failure types (“missing_field”, “missing”, “invalid”, “not_owner”, and “not_found”). Each type also has the associated resource that caused the error (“purchase”) and may also have a field narrowing down the specific attribute if applicable.

Error Response Example

Validation errors for purchase only

Status: 422 Unprocessable Entity
{
  "status": "error",
  "error_type": "validation_failed",
  "error_msg": "validation failed",
  "user_id": "ABC123",
  "errors": [
    {
      "type": "not_found",
      "message": "deal not found",
      "resource": "deal"
    }
  ]
}

Validation errors for purchase, and shipping address

Status: 422 Unprocessable Entity
{
  "status": "error",
  "error_type": "validation_failed",
  "error_msg": "validation failed",
  "errors": [
    {
      "type": "not_found",
      "message": "deal not found",
      "resource": "deal"
    },
    {
      "type": "missing_field",
      "message": "address_type is required",
      "field": "address_type",
      "resource": "shipping_address"
    }
  ]
}