Card Input

Overview

This page guides you through building your own UI, and process the transaction using our APIs.

🚧

This requires you to provide your PCI Compliance Certificate. If you don't have one, you can use our Checkout Card SDK to collect card information.

📘

We only accept encrypted card tokens.

1. Create a Token

After collecting your user's payment details, encrypt the data and call our Token API from your server to create a token.

curl --request POST \
  --url https://api.tap.company/v2/tokens \
  --header 'authorization: Bearer sk_test_XKokBfNWv6FIYuTMg5sLPjhJ' \
  --header 'content-type: application/json' \
  --data '{"card":{"address_city":"Some city","address_country":"Some country","address_line1":"First line","address_line2":"Second line","address_state":"Royal State","address_zip":"007","crypted_data":"Z6cYic0X0I71h9ABUxreudcF76iz5uthier1Ec4YPVv0WsId+F1DbeU0llRgrnXTlGtzzrmWiP+I8owc+Zq0GiYbFYs4se0zYcfLEqDrXgdGiQ+X0v8rwObhD/4ef+OARLrH/rfka0mVxtzTMGzxRivGlLQy27qyj0KtS+/ShY4TQ930iGVOzFOn5VdL8w1H/b6+9bgKtMlD8tGqy624Q2uz8pVHyGvmpuEa0yPoJEjYGC/9qUI6/KQXDw9EWw4ZbhwXNBKNFTUJjvvVcrMVpvktS3/T0PYFCRIpKXvY7wEXewrqG9/nDochyzjJtWPTz/eQ+bl8D26HXqgmb8gjoQ=="}}'

The response will include a token_id along with other card's information as follows:

{
  "id": "tok_4VpPvSNJUHn723embBWuAgoK",
  "object": "token",
  "card": {
    "id": "card_Yi1lfqAk7twr8Be3hTPg0Fv4",
    "object": "card",
    "address": {},
    "customer": "cst_sdsbd7tsd977",
    "funding": "CREDIT",
    "fingerprint": "t9g/phBxZ9ZR6JgHBZ8ty2Yfy",
    "brand": "AMEX",
    "exp_month": 12,
    "exp_year": 2019,
    "last_four": "0005",
    "first_six": "378282",
    "name": "test user"
  },
  "client_ip": "127.0.0.1",
  "created": 1533728879,
  "live_mode": false,
  "type": "CARD",
  "used": false
}

2. Process Payments

You can process the payment by passing the token in a Charge or Authorize request.

3. Handle Redirection

Some payment methods require additional redirection. KNET and BENEFIT require redirection to their pages where the users can fill in their card information.
3D secure cards and mada cards require redirection to the issuer authentication page.

If redirection is required, you will receive a url parameter in the transaction object.

"transaction": {
    ...
    "url":"https://sandbox.payments.tap.company/test_gosell/v3/payment/
    tap_process.aspx?chg=B2nmqEv7L9oCR0gKuACqGFfKPon2yWrh%2f87o6VPmjWc%3d",
     ...
  },

4. Retrieve Tap ID

After processing the transaction, the user will be redirected to your redirect_url, and you will receive the tap_id parameter in the response.

[tap_id] => chg_LV074720211604c4H52302314

From your server, send Retrieve a Charge request using this tap_id to retrieve the status of the charge.

... 
--url https://api.tap.company/v2/charges/chg_LV074720211604c4H52302314
...