Each unique buyer agent that seeks to buy from your seller service, will provide a KYAPay token to your seller service. This token will identify the buyer uniquely. The buyer agent's unique ID will be in the sub claim and the buying human's identity will be in the bid claim.
On your (seller's) end, you have the option to follow one of three typical paths from least effort to most effort (and also most secure).
- 
Require the agent to provide a kyatoken with each request typically in anHTTP header(we recommend naming the headerskyfire-pay-idfor consistency)- In this case, your service can use the kyatoken itself to authorize the agent's access and optionally create an account for the agent
- When the agent wants to make a purchase, your service would require a kya+paytoken to be provided (also typically in the header of the purchase request)
 
- In this case, your service can use the 
- 
Add a /create-acount-and-or-loginendpoint- In this case, this endpoint will require the agent to provide a kyatoken, typically in theHTTP headerof the request
- Your service will validate and extract the buyer's identity from the token and can then either create the agent's account and log the agent in or if the account already exists, then just log the agent in
- In this case, your service would typically return an Access tokenorSession tokento the agent for it to use in future requests
- When the agent wants to make a purchase, your service would require a paytoken to be provided (also typically in the header of the purchase request)
 
- In this case, this endpoint will require the agent to provide a 
- 
Add a /create-acount-and-or-loginendpoint and require a password- This is an extension of 2 (above)
- In this case, this endpoint will require the agent to provide a kyatoken, typically in theHTTP headerof the request
- Additionally this endpoint will require the agent to pass a passwordin thebodyof the request
- Your service will validate and extract the buyer's email address from the token (bid.skyfireEmail) and thepasswordfrom the request body
- Your service will then use your CIAM's APIs to create an account and / or login the agent using the email addressandpassword- This is typically a straightforward token exchange process and we can walk you through how to do this with your CIAM
- This approach exchanges a kyatoken for anaccesstoken in the CIAM
 
- The agent is expected to know whether it already has an account, and if so, to provide the correct passwordto login instead of creating an account
- In this integration the human principal, behind the agent, gains the ability to also login to your service
 
We recommend requiring Skyfire / KYAPay tokens to be passed to your service via an HTTP Header named skyfire-pay-id. You are welcome to use any other header or body parameter as well. We recommend NOT using the Authorization header to avoid conflicting with existing functionality that may already use that header.
Other paths may be possible and we are happy to discuss and support you in meeting your needs.
