Collapse Menu
Documentation
FastSpring App
Contact Support

Applying Customer Information to an Order

Overview

How to provide customer information to the order session and prevent the customer from having to enter it manually

Oftentimes, sellers already have customer information from login credentials or email marketing campaigns. Depending on the customer information you have, there are various ways to apply it to an order and expedite the checkout process. 

You have no customer information:

FastSpring creates an account at the end of the checkout process using the email address and name entered for the order. The account is given an ID and the order generates an account.created webhook. 

You have limited customer information:

If you do not have enough information to create a customer account, you can use the SBL command fastspring.builder.recognize on your webpage. When the customer lands on the checkout page, their email and name are pre-filled in checkout fields. Customers can edit these fields. When the order is completed, the account is given an ID and the order generates an account.created webhook. 

We do not recommend creating customer accounts out of tentative information. Please use fastspring.builder.recognize for unconfirmed information.

You have customer information but no FastSpring Account ID:

If you have the customer’s email address, name, and a customer ID, you can pre-create a customer account before they complete a purchase in your Store. To do this, use the /accounts API endpoint to return the Account ID. Alternatively, you can use the SBL to pass customer information on the frontend. 

You know your customer’s FastSpring Account ID:

If you have already collected the customer’s Account ID through the order.completed or account.created webhook, you can pass the customer information to the frontend using a secure payload. 

We recommend only passing the ID when you apply customer information to the order. You can do this through the FastSpring API by creating a session with the /sessions endpoint. Alternatively, you can use the Store Builder Library to pass the data with a secure request

Create an Account with Customer Information

FastSpring automatically creates new accounts for unrecognized names and email addresses at checkout. However, if you have an existing customer on your website that does not have a FastSpring Account ID, you can use their email address and name to create a customer account within the App. This way, customers do not need to enter their personal information at checkout; only payment details are required.

If you pass a FastSpring Account ID, the contact and accountCustomKey fields are ignored. FastSpring uses the name and email address associated with the Account ID regardless.

Using the Store Builder Library

If your backend houses customer information, this approach is required. Pass the existing information to the checkout process using a secure request. This will apply authenticated customer information to the session. 

{
  "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
  "contact":{  
     "email":"csustomer@gmail.org",
     "firstName":"Leeroy", "lastName":"Jenkins", 
     "company": null,       //optional
     "phone": null          //optional
   }
}

If you pass accountCustomKey when there is no Account ID in the payload, FastSpring attempts to locate the customer account associated with the key. If the account exists, FastSpring automatically uses the information associated with the accountCustomKey. Additional information is ignored. However, if no Account ID or accountCustomKey is present, FastSpring uses data from the contact field to populate the order. When the order is completed, a new account is created.

Using the FastSpring API 

Using the FastSpring API, you can create a new FastSpring account for a customer provided they have never completed an order in your FastSpring Store. If you already have an Account ID on file for that customer, you can use it 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.
    • The API response includes the account ID for the new customer account. Store the Account ID for future use.
  2. Use the Account ID to build a session via the /sessions endpoint. This requires you to pass the Account ID in the request. FastSpring returns the session ID as a result.