Here is the process flow of a payment, from SDK to Server and back to SDK.
pay(SGPayRequest req)
function in you App.
SGPayRequest.PaymentChannel
, SDK launches third party vendor (google, apple or wechat) IAP flow.Code = 1101
to SDK. Otherwise, refer to 【Response Code Definition】for more detail.
Code:1101
to the SDK.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | exports.SGPay = function(req, res) { var receivedData =''; req.addListener('data', function(chunk){ receivedData += chunk; }); req.addListener('end', function() { try { console.log('SG paid received.\n'); console.log(info); if (receivedData == 'ok') { //check if order illegal in game server res.json('ok.'); //send game item } else { res.json('Order status error.'); } } catch (e) { res.json('Try error ' + e); } }); } |