Sessions

Use the /sessions endpoint to customize order sessions. For each order session, you can do one or more of the following:

  • Apply a coupon to the order
  • Override product pricing
  • Apply custom tags to the order

After you create a session, the response will contain the session ID. Use the session ID to collect the customer's payment. Customers do not have access to update any session information. After they complete their payment, the order appears on your Orders page.

By default, each session is valid for 24 hours. To change this, apply an expiration value of up to 7 days.

{
   "account": "igz8r5hcTWSKYygtly5zSQ",   
   "expiration": 7,            
   "items": [
       {
           "product": "prime-sub",
           "quantity": 1                           
       }
   ]
}

Prerequisites

  • Customer Account ID: If the customer does not have an existing account, create a new account for them.
  • Products Allowed: Specify which products to include in the session. If you include multiple variations of a product in the session, it will return an Error 400 message.
  • Country: Specify a payment country for tax purposes. Otherwise, the transaction may fail.

Collect Payment from a Custom Order

  1. Configure a session. Collect the Session ID.
  2. Web Storefronts: Append the Web Storefront URL with /sessions/ and the session ID. For example, if your session ID were 9rX2jKpLm4_Za8t3_Qu7v, you'd use this URL:
    https://yourexamplestore.onfastspring.com/session/9rX2jKpLm4_Za8t3_Qu7v
    
  3. Popup Storefronts: Pass the Session ID in the fastspring.builder.checkout method.

The API applies all information from your custom session to the Storefront. When the customer selects a payment method, FastSpring applies the information associated with their Account ID to the order session.