diff --git a/src/pay/index.js b/src/pay/index.js index 087bf41f..ff971ca7 100644 --- a/src/pay/index.js +++ b/src/pay/index.js @@ -194,17 +194,24 @@ Pay.prototype = { if (+amount > 0 && +amount !== +collection.unit) return respError({ error: { code: 400 } }); - const params = { - isInitialized: false, - address, - inscription, - collection, - amount, - memo, - traceId, - }; - - self.refreshSafePaymentInscription(params); + const qrCodeURL = `https://mixin.one${window.location.pathname}${window.location.search}`; + + self.api.code.generateSchema((resp) => { + if (resp.error) return respError(resp); + + const params = { + isInitialized: false, + address, + inscription, + collection, + amount, + memo, + traceId, + schemeId: resp.data.scheme_id, + }; + + self.refreshSafePaymentInscription(params); + }, qrCodeURL); }, resp.data.collection_hash); }, inscription); @@ -410,8 +417,18 @@ Pay.prototype = { refreshSafePaymentInscription: function (params) { const self = this; - const { isInitialized, address, collection, inscription, memo, traceId } = - params; + const { + isInitialized, + address, + collection, + inscription, + memo, + traceId, + schemeId, + } = params; + + const mixinURL = `mixin://mixin.one${window.location.pathname}${window.location.search}`; + const qrCodeURL = `https://mixin.one/schemes/${schemeId}`; self.api.payment.fetchSafeTrace(function (resp) { if (resp.error) { @@ -430,8 +447,6 @@ Pay.prototype = { } const payment = resp.data; - const mixinURL = `mixin://mixin.one${window.location.pathname}${window.location.search}`; - const qrCodeURL = `https://mixin.one${window.location.pathname}${window.location.search}`; const data = { logoURL: blueLogo, iconUrl: inscription.content_url,