Collapse Menu
FastSpring App
Developer Tools
Contact Support

Applying Customer Information to the Order


This article discusses how you can provide customer information to the order session, to prevent the customer from having to enter it manually.

During the checkout flow, FastSpring can automatically create a customer account based on the data entered:  email, first and last name, company name, and phone number. FastSpring creates a new account when a customer email address that has not been used before is associated with a new order. Each new customer account receives a unique account ID. You can later use this ID to make changes on the account, create custom order sessions, or retrieve order and subscription history. 

In some cases, you may already have some information about the customer if you have customers log in to access areas of your website. As another example, you may have the customer's info on file if the customer is coming from an email broadcast, and you obtained their name and email address.

In both cases, you can apply customer information to the order to expedite the checkout process. See the diagram below for all available options:


No Customer Information is Available

In this case, once the customer completes the checkout, the account is created automatically, and you can capture account information using the account.created webhook event.


Some Customer Information is Available

You can use the fastspring.builder.recognize() method of the Store Builder Library to apply "tentatively known" information to the order. In this case, the information you apply is pre-filled during the checkout. 


We do not recommend creating customer accounts with FastSpring using "tentatively known" information. Please use "fastspring.builder.recognize()" for such information.


A Complete set of Customer Information is Available, and the Customer is Authenticated

In some cases, you may have confirmed a set of customer information. For example, if you have customers log in to your website or service, you may already have their name and email address on file. Ideally, you might have the customer confirm their email address when registering with you. If you have a complete set of data, you can create an account with FastSpring using that data. In this case, customers do not have to enter any personal details during checkout; only payment details are required. 


The FastSpring API Approach

Use the FastSpring API to pass customer information as follows. Note that these steps create a new FastSpring account for a customer who has never placed an order through your FastSpring Store. If you already have a FastSpring account ID on file for the customer, you can use that account ID to reference a customer during the checkout process.

  1. Create a new customer account using the /accounts endpoint, to which you pass all the required information.
  2. The API response includes the account ID for the new customer account. Store the account ID for future use.
  3. Use the account ID to build a session via the /sessions endpoint, which requires you to pass the account ID in the request. FastSpring returns the session ID as a result. You can find more details on this process in the /sessions article.


Store Builder Library Approach

This approach is required when your backend is aware of customer details and can pass the details to the checkout process.

To apply authenticated customer information, you need to use a secure request. You can learn more about this feature at Passing Sensitive Data with Secure Requests.

  "account": null,          // known FS account ID. If passed, the "contact" section is ignored. 
  "accountCustomKey": null, // OR: vendor provided custom account, at least 4 characters. Valid id contains _, a-z, A-Z, 0-9, -. When passing you are required to pass "contact" object below as well
     "firstName":"Leeroy", "lastName":"Jenkins", 
     "company": null,       //optional
     "phone": null          //optional


FastSpring Account ID is Available

If you have previously obtained and stored the customer's FastSpring account ID, we recommend passing only the ID when you apply customer information to the order. This is possible with both the FastSpring API (you can create a session using the /sessions endpoint) and the Store Builder Library approach (described above). 


Important Note About Customer Information that Will Be Used for the Order

  1. If you pass "account" (a valid FastSpring account ID) in the payload, the "contact" and "accountCustomKey" are ignored. FastSpring uses the information (name and email address) associated with the "account." 
  2. If you pass "accountCustomKey" and there is no "account" value in the payload, FastSpring attempts to locate the customer account associated with the custom key. If the account already exists (this is not the first order with the account), FastSpring uses the information associated with the "accountCustomKey". Any "contact" data you may pass is ignored. 
  3. If no "account" or "accountCustomKey" is present in the payload or there is no data associated with the "accountCustomKey," FastSpring uses data from the "contact" to populate the order. This data is stored along with the "accountCustomKey" (if present). Upon completion of the order, an "account" is generated and passed to you via webhooks. 


  • Pass only the "account" if you have it. 
  • Pass only the "accountCustomKey" if this is not the first order for this customer. 
  • Pass the "accountCustomKey" along with a complete "contact" object if this is the first order for the customer or you are not sure. 
  • If you do not have or use accounts, pass the "accountCustomKey" as null. 
  • If you would like to change the email address for an existing account, use the /accounts Server API endpoint.