KriptoRamp / KriptoAPI
  • Getting started
    • Introduction
    • Use cases 📖
      • Fiat<>Crypto Onramp
      • Fiat<>Crypto Onramp (ledger)
      • Fiat<>Crypto Onramp (Payments in Crypto)
      • NFT Checkout
      • Onramp & Offramp with Bank Wire
    • Kripto Ramp Widget and Kripto White Label get started 🏁
    • Get API keys 🔑
  • Widget (Fiat Onramp)
    • Initialise Widget
    • Load Widget
    • Widget Configuration
    • Webhooks
      • Webhook Use Cases
  • Whitelabel API (Fiat Onramp / Offramp via Bank Wire)
    • API Reference
      • Authentication
        • Login
        • Logout
      • Endpoints
        • Users
          • Create User
          • Show user
          • Update User
          • User Balance
          • Master Balance
        • Compliance
        • Payments & bank wire
          • Add Bank
          • List Bank Details
          • View Bank Details
          • Remove a Bank
          • Deposit Instructions
          • User limits
          • Withdraw
        • Crypto Exchange & Wallet
          • Pairs
          • Exchange Rate
          • Buy Order
          • Sell Order
          • Currencies
          • Transaction List
          • User Transaction List
          • Show Transaction
          • Limits minimum
    • Webhooks & Websockets
  • Supported cryptocurrencies 🌍
    • KriptoRamp
    • Kripto White Label
  • Links
    • Kriptomat.io
Powered by GitBook
On this page
  • Initialise Widget With Webhook
  • Setup Webhook

Was this helpful?

  1. Widget (Fiat Onramp)

Webhooks

Initialise Widget With Webhook

The webhook (postback) can be used to have data sent straight to your server about widget transaction completes. By entering variables relevant to your project in the customFields you can track completed purchases and know which user completed, for which currency and how much.

POST https://api.kriptomat.io/widget/init 

{
	"token": "6a7d2e91d4cff64939450c74001da4f24fbabd2abae8b2fc1c79a561da9de14a",
	"asset_type": "eth",
	"to_address": "0x7873ce9E57c6aEEA16aD6AE759CE955736f14e96",
	"amount": 35,
	"amount_type": "fiat",
	"webhook_url": "https://yourDomain.com",
	"additional_fields[0]": "userId",
	"additional_fields[1]": "TransactionId",
}

Setup Webhook

A page on your site that receives POST data from Kriptomat when a transaction completes. Confirm IP location as being from Kriptomat - 174.138.2.203 Fetch Post data

{
	"uuid": "uuid",
	"amount": 0.5,
	"asset_type": "eth",
	"fiat_amount": "200",
	"to_address": "0x7873ce9E57c6aEEA16aD6AE759CE955736f14e96",
	"additional_fields[0]": "customContent1",
	"additional_fields[1]": "customContent2",
}

Then give your user loyalty points or assets or whatever you like.

PhP example

$postdata = file_get_contents("php://input");
$data = json_decode($postdata, true);
if (isset($data['uuid'])){ $uuid = $data['uuid']; }
if (isset($data['amount'])){ $amount = $data['amount']; }
if (isset($data['asset_type'])){ $asset_type = $data['asset_type']; }
if (isset($data['fiat_amount'])){ $fiat_amount = $data['fiat_amount']; }
if (isset($data['to_address'])){ $to_address = $data['to_address']; }
if (isset($data['network'])){ $network= $data['network']; }
if (isset($data['0'])){ $additional_fields1 = $data['0']; }
if (isset($data['1'])){ $additional_fields2 = $data['1']; }

Check the uuid (transaction id) has not been recorded already.

If not a duplicate, record the post details and reward the user if you so choose.

PreviousWidget ConfigurationNextWebhook Use Cases

Last updated 2 years ago

Was this helpful?