▶️Buy Button SDK

(see end of document for sdk-v2 )

Add the SDK

  • You can add it in a script tag.

now you can access the SDK through window.lyziBuyButton

  • angular project load in angular.json file

then load using “declare var lyziBuyButton: any;” in your component

Using the SDK

  • init Before using availables methods, you should init the SDK at first or, some methods will not work properly.

window.lyziBuyButton.init({ …config }, elementSelector) available config


  • generating html code snippet window.lyziBuyButton.generateSnippet({ …config })

return value

  • get the transaction code


  • Overriding stored button data Every button that is stored in db can be overridden by the url query params. you shouldn’t override the button id, if you override it then the button will not work.


Implementation sample

if you want to separate return, cancel and callback url functionality, now it possible by our sdk-v2. here is code implementation sample

  <script src=""></script>
  <!-- <script src=""></script> -->
  <a id="test-lyzi">Payer</a>
        buttonId: "64ac6818dd98b2001d1a02cc", //dev
        // buttonId: "65310584a8ea92001d8ba40c", //staging
        orderRef: "CURRENTORDER-FP-2023",
        price: 0.1,
        callbackUrl: '',
        returnUrl: '',
        cancelUrl: '',
        env: "dev",
        goods: {
          goodsName: "Gigabyte RX 570",
          goodsCategory: "1000",
          goodsType: "01",

if you pass of those 3 url params,

  • we will send webhook to callbackUrl by post method

  • redirect to cancelUrl if user cancel the payment

  • redirect to returnUrl after payment succeed

but if you still prefer use only callbackUrl, you’ll also get all those 3 above in your callbackUrl

Last updated