Scenario: when user pay(100%) on my website using my API in which I want to perform 2 payment operation 1. goes to production account(50% amount) 2. goes to manager account (50% amount)
is this possible to achieve this in one trancation so that only one transaction hash is generated.
right now i am doing like this :4
var productionPublickey = 'GDENPKUMUNAYWCRT7E6NFN5HBMNPIUISY7EJG4TVR3RHMS7FPQ2QJLZL'; StellarSdk.Network.useTestNetwork();
var managerPublickey = 'GAF2HC3YYBF2JPTQJO6NDVEGOR4RIFZ5VRKQ4AH5DQ6R75ZPHJB5VGGV' var account = await server.loadAccount(sourcePublicKey) var transaction = new StellarSdk.TransactionBuilder(account) .addOperation(StellarSdk.Operation.payment({ destination: productionPublickey, asset: StellarSdk.Asset.native(),//native asset lumen amount: '50', })) .addMemo(StellarSdk.Memo.text('sent to production '))//optional .build(); transaction.sign(sourceKeypair); const temp = await server.submitTransaction(transaction) console.log('submitted', temp._links); account = await server.loadAccount(sourcePublicKey) var transaction = new StellarSdk.TransactionBuilder(account) .addOperation(StellarSdk.Operation.payment({ destination: managerPublickey, asset: StellarSdk.Asset.native(),//native asset lumen amount: '50', })) .addMemo(StellarSdk.Memo.text('sent to manager'))//optional .build(); transaction.sign(sourceKeypair); const temp2 = await server.submitTransaction(transaction) console.log('submitted', temp2._links); res.send('sent')