Core Resources
Customer sessionsNew
Customer sessions are short-lived tokens scoped to a single
Customer. They allow a storefront or application to act on behalf of that customer without exposing the store's API token.This resource is new in the V2 reference. It also works when you send X-Recharge-Version: 2021-11.
#The customer session object
Attributes
- apiTokenstringThe session token scoped to the
Customer. - customerIdintegerUnique numeric identifier for the
Customerthe session was created for. - admin_emailstringThe email address of the store user the session was created for.Only returned when creating a customer support session.
{
"customer_session": {
"apiToken": "eyJhbGciOiJIUzI1NiJ9.example.signature",
"customerId": 90210001
}
}#Create a customer session
POST/customers/{id}/sessions
Creates a session token for a
Customer. Send an empty JSON object as the request body. If a storefront access token is passed in the X-Recharge-Storefront-Access-Token header, the scopes of the session are derived from that token.Scope
write_sessionscurl -X POST 'https://api.rechargeapps.com/customers/129593/sessions' \
-H 'X-Recharge-Version: v2' \
-H 'X-Recharge-Access-Token: your_api_token'{
"customer_session": {
"apiToken": "eyJhbGciOiJIUzI1NiJ9.example.signature",
"customerId": 90210001
}
}