Developer Docs
  • 👋Get Started
  • Add Payment Methods in Optty
  • Custom API | Headless
    • 🖥️Direct API Integration
      • Environments
      • Order Flow
      • 1️⃣Create Access Token
      • 2️⃣Get APM Options
      • 3️⃣Create Order
      • 4️⃣Handle Payment Response
      • 5️⃣Refund Order
      • 🔥Handling Exceptions
  • Platforms
    • ◾BigCommerce
      • 🚀Activate Optty
      • ⚡Add Optty Widgets
        • 1️⃣Install the App
        • 2️⃣Create Widget Token
        • 3️⃣Edit Your Template
        • 4️⃣Widget Configuration
      • 💳Refunds
    • Magento 2
      • Install Optty Module
      • Configure the Optty Extension
      • One Step Checkout
    • Salesforce Commerce Cloud
      • Component Overview
      • Implementation Guide
      • Operation and Management
      • User Guide
    • 🟪WooCommerce
      • 🚀Install Optty
      • ⚡Setup Widgets
      • 💳Refunds
  • Widget
    • Widget Setup and Integration
    • Create Order Widget Integration
    • Handle Order Payment Widget Integration
  • API References
    • Create Order
      • Create Order Response
    • Refund Order
    • Void Order
    • Capture Order
    • Transaction Details
    • Create Customer Session
    • Best Practice
  • Go Live
  • Universal Payment Platform
    • Support Articles
Powered by GitBook
On this page
  • Parameters
  • Create Customer Session
  • Full Example
  1. API References

Create Customer Session

Optty widgets require a session token to verify the source the Widget is loading from, and be able to display the correct list of available Payment Methods.

Parameters

Content Type: application/json

Create Customer Session

POST https://api.qa.optty.com/merchants/customer/sessions

For live environment, please update the endpoint to https://api.optty.com

Headers

Name
Type
Description

Authentication*

string

Authorization: Bearer <token>

Request Body

Name
Type
Description

customerIdentifier*

string

A unique identifier for a merchant’s customer. This can be the customer’s email address, or “anonymous” if it is a user not logged in.

{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21lcklkZW50aWZpZXIiOiI2NDkzZDA3NTNmYjliNzBhNGY3YzFjYjE1ZTMwYzZjMmU1ZjE5Y2FlMWE1MGJiNTllMjRkMTYwMjIyOTcyMjgzMjA4OGJhZmRiMzAwNTA5MmQ4MTdjMzNhMTUyNzQyYjExZWMyZjJmYmJkYjlmN2FkYjFjMmMyMGQ3YzhjN2RiYyIsIm1lcmNoYW50SWQiOiI0NGFkMzIxMS0yYTgzLTRiNWUtYTJlNy03ZmZlNjhlZTkyMWMiLCJpYXQiOjE2MzM2ODM4NjksImV4cCI6MTYzNDI4ODY2OX0.4sTHdfV8aDJ26Lq1552cZIvpwwY6VPlBzoW2AGcAH8E",
    "ttl": 604800
}

Full Example

{
    "customerIdentifier":"anonymous"
}
curl -X POST "https://api.staging.optty.com/merchants/customer/sessions" \
-H "accept: application/json" \
-H "Authorization: Bearer {YOUR ACCESS TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"customerIdentifier\":\"anonymous\"}"
{
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21lcklkZW50aWZpZXIiOiI2NDkzZDA3NTNmYjliNzBhNGY3YzFjYjE1ZTMwYzZjMmU1ZjE5Y2FlMWE1MGJiNTllMjRkMTYwMjIyOTcyMjgzMjA4OGJhZmRiMzAwNTA5MmQ4MTdjMzNhMTUyNzQyYjExZWMyZjJmYmJkYjlmN2FkYjFjMmMyMGQ3YzhjN2RiYyIsIm1lcmNoYW50SWQiOiI0NGFkMzIxMS0yYTgzLTRiNWUtYTJlNy03ZmZlNjhlZTkyMWMiLCJpYXQiOjE2MzM5NDA2NzEsImV4cCI6MTYzNDU0NTQ3MX0.X5D3pbqMW_KbYA_SPpXAFwSD93Y60QE7i8CXF2Enw4c",
    "ttl": 604800
}

PreviousTransaction DetailsNextBest Practice

Last updated 1 year ago