Here we will walk you through how to get a card from Channex using Channex PCI and then showing the card to the user with an Iframe.

Create test booking with credit card

Open https://booking.channex.io/ and create booking. It should be created with test card inside.

Channex auth

Authenticate with your login and password in Channex. Here we use sign_in method in https://staging.channex.io‚Äč

curl 'https://staging.channex.io/api/v1/sign_in' \
-H 'content-type: application/json' \
--data-raw '{"user":{"email":"$CHANNEX_EMAIL","password":"$CHANNEX_PASSWORD"}}'

In response by data.attributes.token path there is an auth token, which will be used in requests to channex through Channex PCI

Get bookings from Channex through Channex PCI

To get bookings with card tokens for your account you need to take bookings from Channex via Channex PCI

For the Channex staging account you should tell Channex PCI to grab cards from https://secure-staging.channex.io domain. You cannot make direct calls to secure-staging.channex.io because in response there would be plain cards and to perform such action you need to be pci dss certified.

Instead you are making requests to secure-staging.channex.io through our PCI service which would take plain cards and tokenize them for your account.

curl -v -X POST -H "Authorization: Bearer $CHANNEX_TOKEN" "https://pci.channex.io/api/v1/capture?api_key=$API_KEY&method=get&profile=channex&url=https%3A%2F%2Fsecure-staging.channex.io%2Fapi%2Fv1%2Fbooking_revisions%2Ffeed"

In response in bookings with cards there will be card tokens for your account. When you are looking to token please ensure that there is no "error" or "warning" field near token.

Create one-off tokens for card show iframe

Create a card info session token

curl -v -X POST -H "Content-Type: application/json" -d '{"session_token":{"scope":"card"}}' "https://pci.channex.io/api/v1/session_tokens?api_key=$API_KEY"

Create a CVV session token

curl -v -X POST -H "Content-Type: application/json" -d '{"session_token":{"scope":"service_code"}}' "https://pci.channex.io/api/v1/session_tokens?api_key=$API_KEY"

Embed card show iframe

On your frontend application place the code for the iframe, here is a test curl command to verify that you can receive iframe source

curl -v "https://pci.channex.io/api/v1/show_card?card_token=$CARD_TOKEN&session_token=$SESSION_TOKEN&service_code_token=$SERVICE_CODE_TOKEN"

If you follow this workflow step by step, in the end you should able to receive card show iframe. If some of steps are not clear or you have some concerns about steps, please let us know.