Applying Customer Information to an Order

If you already have some or all of your customer’s contact information, you can apply it to an order session to expedite the checkout process. This varies depending on the information that you have:

  • You have no customer information: FastSpring creates an account at the end of the checkout process with the email address and name entered for the order. FastSpring gives the account an ID and the order generates an account.created webhook.
  • You have limited customer information: Use the fastspring.builder.recognize command on your webpage. When the customer lands on the checkout page, the SBL prefills their name and email address in the checkout fields. Customers can edit these fields. When the order is complete, FastSpring gives the account an ID and generates an account.created webhook.
  • You have customer information, but no account ID: If you have the customer’s name, email address, and customer ID, you can create a customer account before they complete a transaction in your store. Use the /accounts endpoint to return the account ID, or use the SBL to pass customer information on the frontend.
  • You know your customer’s account ID: Pass the customer information from the account.created webhook to the frontend with a secure payload. We recommend only passing the ID when you apply customer information to the order. You can do this with the /sessions API endpoint, or by passing a secure request with the Store Builder Library.

Create a New Account with Customer Information

FastSpring automatically creates new accounts for unrecognized names and email addresses. However, if you have an existing customer on your website that does not have a FastSpring 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. 

If you pass an account ID, FastSpring ignores the contact and accountCustomKey fields. FastSpring uses the name and email address associated with the account ID.

Using the Store Builder Library

Pass the existing information to the checkout process using a secure request. This will apply authenticated customer information to the session. FastSpring requires this approach for backends that contain customer information.

{
  "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":"[email protected]",
     "firstName":"Chandra", "lastName":"Madiba", 
     "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. 

  • Existing Accounts: If the account exists, FastSpring automatically uses the information associated with the accountCustomKey, and ignores additional information.
  • No Account ID or accountCustomKey: If no Account ID or accountCustomKey is present, FastSpring uses data from the contact field to populate the order. After a successful transaction, FastSpring creates a new account.

Using the FastSpring API

With the FastSpring API, you can create a new FastSpring account for a customer who has never completed an order in your store. If you already have an account ID on file for that customer, use it to reference a customer during the checkout process. 

  1. Create a new customer account with the /accounts endpoint. Pass all required information to this endpoint.The API response will include the new account ID. Store the account ID for future use.
  2. Use the account ID to build a session with the /sessions endpoint. This requires you to pass the account ID in the request. FastSpring returns the session ID.