Welcome‎ > ‎Version 3‎ > ‎Publisher Api‎ > ‎Methods‎ > ‎2 - Consumer Related‎ > ‎

Linkable Orders

The Group Commerce platform allows purchases with or without an associated profile (a user account).  A purchase without a profile does not require the user to be signed up or logged in when purchasing.  Because of this, the purchase order is not associated with any particular profile.  If a user then signs up (creates a profile) after placing orders without a profile, he may want to associate those orders with his new profile so that he can view them in his purchase history page.  This method, linkable orders, is the first of two steps in that process (the second step is Link Orders).

Linkable orders finds orders that have been placed with a specific email address (presumably the email address that the user created his new profile with) and that are not associated with that new profile.  It marks those orders with a confirmationToken, and returns both the confirmationToken and a list of the ids of those orders.  It optionally sends an email to the email address that can be used to verify that the user actually owns that email address.  The email will contain a link of the form /profile/{userKey}/linkorders?confirmationToken={confirmationToken}&orderIds={comma separated list of order ids}.  The email will only be sent if one or more linkable orders is found.

Note that linkable orders are only associated with consumers with consumer type Unknown or Visitor.  This means that if an order was placed by a consumer with consumer type Account, it is not eligible for linking, and will not be returned for a get linkable orders request.  Purchases without an associated user account will be associated with consumers of type Visitor, and purchases with an associated user account will be associated with consumers of type Account.

See Link Orders for the next step.

Method: POST /api/v3/publisher/consumer/{userKey}/linkableOrders

Authentication: oauth
 
Parameters
userKey - the user key of the user's newly created account that he wants to link his old anonymously-purchased orders to

Post
Required Form Name Data Type Explanation
Yes
EmailAddress string The email address that the user purchased his old anonymous orders with.
No
SendEmail
bool
Whether or not to send the user a verification email.  Default value is false.

Returns
base response fields
confirmationToken - The unique confirmation token that marks the old orders and can be used to verify that the consumer owns the email address used to make the anonymous purchases.
orderIds - A list of the order ids that were placed anonymously by the email address.  These orders will be linked to the user's new profile during the Link Orders call.


Sample Request:

POST http://api.groupcommerce.com/api/v3/publisher/consumer/testuserkey/linkableOrders

Form: EmailAddress=mynewemail%40groupcommerce.com&SendEmail=True


OAuth oauth_signature="N455iVW4pn2P2I6XWsaeMwKBWuQ%3D", oauth_nonce="7127293", oauth_timestamp="1337033042", oauth_consumer_key="eeb6b959-b854-4ad1-b563-e801c83cf81d", oauth_signature_method="HMAC-SHA1", oauth_version="1.0"


Sample JSON Response:

{
    "errors": [],
    "lastPublished": "/Date(1337033051838)/",
    "success": true,
    "version": "3",
    "confirmationToken": "6cf6110c34ab41d5b708236e33847bdf",
    "orderIds": [
        82645,
        82647
    ]
}


Sample XML Response:

<getLinkableOrdersResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <errors />
  <lastPublished>2012-05-14T22:05:44.5773302Z</lastPublished>
  <success>true</success>
  <version>3</version>
  <confirmationToken>6cf6110c34ab41d5b708236e33847bdf</confirmationToken>
  <orderIds>
    <orderId>82645</orderId>
    <orderId>82647</orderId>
  </orderIds>
</getLinkableOrdersResponse>
Comments