Order Processing with REST APIs Tutorial
Step 3. Create a customer
Customers can make purchases in three ways:
- As a logged-in user
- As a guest user who logs in or creates an account when the order is placed
- As a guest user who does not create an account
This tutorial creates an order by a logged-in user. Magento provides additional REST endpoints for handling guest users.
Create a customer account
Creating a customer account requires admin permissions.
This example shows a simplified way of creating a customer account. Typically, you would not define a customer password using plain text. Instead, you would specify the payload without the
password parameter. By default if the call is successful, Magento sends a “Welcome” email to the customer that includes a request to set the password. You could also initiate a password reset email by calling
Bearer <admin token>
It is recommended that you substitute the value of the
Magento assigned this user
id value of
You can log in to the Luma store using the user name
firstname.lastname@example.org and password
Get the customer’s access token
To get a customer’s access token, you must specify the customer’s username and password in the payload. You do not need to specify an admin authorization token.
By default, a customer token is valid for 1 hour. To change this value, log in to Admin and go to Configuration > Services > OAuth > Access Token Expiration.
Magento returns the customer’s access token. This token must be specified in the authorization header of every call the customer makes on his or her own behalf.
Verify this step
- Log in to the Luma website using the email
- Click the account name (Jane) in the upper right corner and select My Account.
- Click Address Book to view the default billing and shipping addresses.