支付类交易¶
支付请求¶
Node.JS Example¶
var Remote = require('jingtum-lib').Remote;
var remote = new Remote({server: 'ws://ts5.jingtum.com:5020', local_sign:true});
remote.connect(function (err, result){
if(err) return console.log('err: ', err);
var tx = remote.buildPaymentTx({
account: 'jB7rxg...qY2xLZ',
to: 'jDU...RESY62c',
amount: {
"value": 0.5,
"currency": "SWT",
"issuer": ""
}
});
tx.setSecret('sn37...XUWd');
tx.addMemo('给jDU...RESY62c支付0.5swt.');//可选
tx.submit(function(err, result) {
if(err) {return console.log('err:',err);}
console.log('payment result:', result);
});
});
C# Example¶
var remote = new Remote(@"ws://ts5.jingtum.com:5020", true);
remote.Connect(result =>
{
if (result.Exception != null)
{
Console.Write(result.Exception.Message);
}
else
{
var tx = remote.BuildPaymentTx(new PaymentTxOptions {
Account = "j9FGhAW9dSzL3RjbXkyW6Z6bHGxFk8cmB1",
To = "jBKaXuYemkAb5HytZgosAcWgWDZbBvz6KR",
Amount = new Amount
{
Value = "0.5",
Currency = "SWT",
Issuer = ""
}
})
tx.SetSecret("ssG......dNi");
tx.AddMemo("给jBKaXuYemkAb5HytZgosAcWgWDZbBvz6KR支付0.5swt.");
tx.Submit(txResult => {
Console.Write(txResult.Message);
// get result from txResult.Result
});
}
});